Пример #1
0
 /// <summary>
 /// Constructor to create the desired settings by the user for clustering.
 /// </summary>
 /// <param name="RawData">data to be clustered</param>
 /// <param name="KmeansMaxIterations">maximum allowed number of Kmeans iteration for clustering</param>
 /// <param name="NumberOfClusters">number of clusters</param>
 /// <param name="NumberOfAttributes">number of attributes for each sample</param>
 /// <param name="SaveObject">settings to save the clustering instance</param>
 /// <param name="KmeansAlgorithm">the desired Kmeans clustering algorithm (1 or 2)
 /// <ul style="list-style-type:none">
 /// <li> - 1: Centoids are the nearest samples to the means</li>
 /// <li> - 2: Centoids are the means</li>
 /// </ul></param>
 /// <param name="InitialGuess">a bool, if true Kmeans clustering start with an initial guess for the centroids else it will start with a random assignment.</param>
 /// <param name="LoadObject">settings to load a clustering instance. can be "" or null in case of not loading</param>
 /// <param name="Replace"></param>
 public ClusteringSettings(double[][] RawData,
                           int KmeansMaxIterations,
                           int NumberOfClusters,
                           int NumberOfAttributes,
                           SaveLoadSettings SaveObject,
                           int KmeansAlgorithm         = 1,
                           bool InitialGuess           = false,
                           SaveLoadSettings LoadObject = null,
                           bool Replace = false)
 {
     this.RawData = RawData;
     if (KmeansAlgorithm != 2)
     {
         this.KmeansAlgorithm = 1;
     }
     else
     {
         this.KmeansAlgorithm = 2;
     }
     this.KmeansMaxIterations = KmeansMaxIterations;
     this.NumberOfClusters    = NumberOfClusters;
     this.InitialGuess        = InitialGuess;
     this.NumberOfAttributes  = NumberOfAttributes;
     this.SaveObject          = SaveObject;
     this.LoadObject          = LoadObject;
 }
Пример #2
0
 /// <summary>
 /// JSON_Settings is a function that creates saving or loading settings for JSON files.
 /// </summary>
 /// <param name="filePath">path for saving to or loading from a destination</param>
 /// <param name="Replace">bool if true, overwriting an existing clustering instance is allowed</param>
 /// <param name="SaveLoadObject">the returned saved ot load JSON settings</param>
 /// <returns>a code and a message that state whether the function succeeded or encountered an error. When the function succeeds, it will return:
 /// <ul style="list-style-type:none">
 /// <li> - Code: 0, "OK" </li>
 /// </ul>
 /// </returns>
 public static AnomalyDetectionResponse JSON_Settings(string filePath, out SaveLoadSettings SaveLoadObject, bool Replace = false)
 {
     SaveLoadObject           = new SaveLoadSettings();
     SaveLoadObject.Method    = "JSON";
     SaveLoadObject.ModelPath = filePath;
     SaveLoadObject.Replace   = Replace;
     return(new AnomalyDetectionResponse(0, "OK"));
 }
Пример #3
0
 /// <summary>
 /// Constructor to create the desired settings by the user for checking to which cluster a sample belongs
 /// </summary>
 /// <param name="LoadProjectSettings">settings to the clustering intance that contains the clusters data</param>
 /// <param name="Sample">the sample to be checked</param>
 /// <param name="tolerance">a value in % representing the tolerance to possible outliers</param>
 public CheckingSampleSettings(SaveLoadSettings LoadProjectSettings, double[] Sample, double tolerance = 0)
 {
     this.LoadProjectSettings = LoadProjectSettings;
     this.Sample    = Sample;
     this.tolerance = tolerance;
 }