/// <summary>
 /// a static function that returns the single instance of MinCircleDetector object
 /// </summary>
 /// <param name="csvFilePath"> a csv file where the flight's data is </param>
 /// /// <param name="colNames"> the names of the csv's columns </param>
 /// <returns> instance of LinearRegressionDetector </returns>
 public static LinearRegressionDetector GetInstance(string csvFilePath, List <string> colNames)
 {
     if (instance == null)
     {
         instance = new LinearRegressionDetector(csvFilePath, colNames);
     }
     return(instance);
 }
Esempio n. 2
0
 /// <summary>
 /// A constructor for the user control
 /// </summary>
 /// <param name="csvFilePath">The csv file path to detect anomalies</param>
 /// <param name="colNames"> the names of the csv's columns </param>
 public LinearRegressionGraph(string csvFilePath, List <string> colNames)
 {
     InitializeComponent();
     try
     {
         this.vm          = new LinearGraphViewModel(LinearRegressionDetector.GetInstance(csvFilePath, colNames));
         this.DataContext = this.vm;
         // draw x and y axis on the canvas
         Path xAxis = CreateAxis(new System.Windows.Point(margin, LinearGraph.Height / 2), new System.Windows.Point(LinearGraph.Width, LinearGraph.Height / 2));
         LinearGraph.Children.Add(xAxis);
         Path yAxis = CreateAxis(new System.Windows.Point(LinearGraph.Width / 2, LinearGraph.Height), new System.Windows.Point(LinearGraph.Width / 2, 0));
         LinearGraph.Children.Add(yAxis);
     }
     catch { }
 }
Esempio n. 3
0
 public LinearGraphViewModel(LinearRegressionDetector model)
 {
     this.model = model;
 }