///<summary>
        ///Produce a set of metrics of a Model by running a set of Test data against it.
        ///</summary>
        public AnomalyDetectionMetrics Evaluate()
        {
            var testData = Model.Transform(DataView);
            AnomalyDetectionMetrics adMetrics = objContext.AnomalyDetection.Evaluate(testData);

            return(adMetrics);
        }
 public static void PrintAnomalyDetectionMetrics(string name, AnomalyDetectionMetrics metrics)
 {
     Console.WriteLine($"************************************************************");
     Console.WriteLine($"*       Metrics for {name} anomaly detection model      ");
     Console.WriteLine($"*-----------------------------------------------------------");
     Console.WriteLine($"*       Area Under ROC Curve:                       {metrics.AreaUnderRocCurve:P2}");
     Console.WriteLine($"*       Detection rate at false positive count: {metrics.DetectionRateAtFalsePositiveCount}");
     Console.WriteLine($"************************************************************");
 }
 public static void Print(string name, AnomalyDetectionMetrics metrics)
 {
     Console.WriteLine($"*************************************************************************************************************");
     Console.WriteLine($"*       Metrics for {name} Anomaly Detection model");
     Console.WriteLine($"*------------------------------------------------------------------------------------------------------------");
     Console.WriteLine($"*       AUC:           {metrics.AreaUnderRocCurve:P2}");
     Console.WriteLine($"*************************************************************************************************************");
     Console.WriteLine();
 }
Exemple #4
0
        private static void EvaluateModel(MLContext mlContext, ITransformer model, IDataView testDataView)
        {
            // Evaluate the model and show accuracy stats
            Console.WriteLine("===== Evaluating Model's accuracy with Test data =====");

            var predictions = model.Transform(testDataView);

            AnomalyDetectionMetrics metrics = mlContext.AnomalyDetection.Evaluate(predictions);

            ConsoleHelper.PrintAnomalyDetectionMetrics("RandomizedPca", metrics);
        }
 /// <summary>
 /// Check that a <see cref="AnomalyDetectionMetrics"/> object is valid.
 /// </summary>
 /// <param name="metrics">The metrics object.</param>
 public static void AssertMetrics(AnomalyDetectionMetrics metrics)
 {
     Assert.InRange(metrics.AreaUnderRocCurve, 0, 1);
     Assert.InRange(metrics.DetectionRateAtFalsePositiveCount, 0, 1);
 }
Exemple #6
0
 public ModelTrainingMetricsResponse(AnomalyDetectionMetrics metrics)
 {
     AUC = metrics.AreaUnderRocCurve;
     FalsePositiveRate = metrics.DetectionRateAtFalsePositiveCount;
 }
Exemple #7
0
 /// <summary>
 /// Check that a <see cref="AnomalyDetectionMetrics"/> object is valid.
 /// </summary>
 /// <param name="metrics">The metrics object.</param>
 public static void AssertMetrics(AnomalyDetectionMetrics metrics)
 {
     Assert.InRange(metrics.Auc, 0, 1);
     Assert.InRange(metrics.DrAtK, 0, 1);
 }