Ejemplo n.º 1
0
 private void calculatePxValues(TrainingSet nonAnomaliesSet, TrainingSet anomaliesSet, PxFormula formula)
 {
     nonAnomaliesPxValues = new double[nonAnomaliesSet.getCountOfRecords()];
     for (int i = 0; i < nonAnomaliesSet.getCountOfRecords(); i++)
     {
         nonAnomaliesPxValues[i] = formula.calculate(nonAnomaliesSet.getAllRecords()[i]);
     }
     anomaliesPxValues = new double[anomaliesSet.getCountOfRecords()];
     for (int i = 0; i < anomaliesSet.getCountOfRecords(); i++)
     {
         anomaliesPxValues[i] = formula.calculate(anomaliesSet.getAllRecords()[i]);
     }
 }
Ejemplo n.º 2
0
 private void calculatePxValues(TrainingSet nonAnomaliesSet, TrainingSet anomaliesSet, PxFormula formula)
 {
     nonAnomaliesPxValues = new double[nonAnomaliesSet.getCountOfRecords()];
     for (int i = 0; i < nonAnomaliesSet.getCountOfRecords(); i++)
     {
         nonAnomaliesPxValues[i] = formula.calculate(nonAnomaliesSet.getAllRecords()[i]);
     }
     anomaliesPxValues = new double[anomaliesSet.getCountOfRecords()];
     for (int i = 0; i < anomaliesSet.getCountOfRecords(); i++)
     {
         anomaliesPxValues[i] = formula.calculate(anomaliesSet.getAllRecords()[i]);
     }
 }
Ejemplo n.º 3
0
 public void calcAccuracy(TrainingSet nonAnomaliesSet, TrainingSet anomaliesSet, PxFormula formula)
 {
     calculatePxValues(nonAnomaliesSet, anomaliesSet, formula);
     double max_p_x_value = formula.calculate(formula.getNu());
     List<KeyValuePair<int, double>> list = new List<KeyValuePair<int, double>>();
     double h = max_p_x_value / 50;
     for (int i = 0; i < 50; i++)
     {
         double e = 0 + h*i;
         int count = 0;
         foreach (double value in anomaliesPxValues)
         {
             if (value < e)
             {
                 count++;
             }
         }
         list.Add(new KeyValuePair<int, double>(count, e));
     }
     formula.setE(list.First(x => x.Key == list.Max(y => y.Key)).Value);
 }
Ejemplo n.º 4
0
        public void calcAccuracy(TrainingSet nonAnomaliesSet, TrainingSet anomaliesSet, PxFormula formula)
        {
            calculatePxValues(nonAnomaliesSet, anomaliesSet, formula);
            double max_p_x_value = formula.calculate(formula.getNu());
            List <KeyValuePair <int, double> > list = new List <KeyValuePair <int, double> >();
            double h = max_p_x_value / 50;

            for (int i = 0; i < 50; i++)
            {
                double e     = 0 + h * i;
                int    count = 0;
                foreach (double value in anomaliesPxValues)
                {
                    if (value < e)
                    {
                        count++;
                    }
                }
                list.Add(new KeyValuePair <int, double>(count, e));
            }
            formula.setE(list.First(x => x.Key == list.Max(y => y.Key)).Value);
        }