public cFeedBackMessage Run() { base.Start(); if (!FeedBackMessage.IsSucceed) return FeedBackMessage; if (this.Input.Count > 1) { this.FeedBackMessage = new cFeedBackMessage(false, this); return this.FeedBackMessage; } #region parameters initialization //object _firstValue = base.ListProperties.FindByName("Number of Clusters"); //int NumOfClusters = 0; //if (_firstValue == null) //{ // base.GenerateError("-Number of Clusters- not found !"); // return base.FeedBackMessage; //} //try //{ // cProperty TmpProp = (cProperty)_firstValue; // NumOfClusters = (int)TmpProp.GetValue(); //} //catch (Exception) //{ // base.GenerateError("-Number of Clusters- cast didn't work"); // return base.FeedBackMessage; //} #endregion cMachineLearning MachineLearning = new cMachineLearning(/*cWell.GlobalInfo*/null); if (ParamAlgoForClustering == null) ParamAlgoForClustering = MachineLearning.AskAndGetClusteringAlgo(); if (ParamAlgoForClustering == null) { FeedBackMessage.IsSucceed = false; FeedBackMessage.Message = "Invalid Parameters"; return FeedBackMessage; } MachineLearning.SelectedClusterer = MachineLearning.BuildClusterer(ParamAlgoForClustering, this.Input); if (MachineLearning.SelectedClusterer != null) { cLinearize L = new cLinearize(); L.SetInputData(this.Input); L.Run(); cExtendedTable Test = L.GetOutPut(); ClusterEvaluation CE = MachineLearning.EvaluteAndDisplayClusterer(/*richTextBoxInfoClustering*/null, null, MachineLearning.CreateInstancesWithoutClass(this.Input)); double[] Assign = CE.getClusterAssignments(); base.Output = new cExtendedTable(this.Input); cExtendedList CL = new cExtendedList("Class ID"); CL.SetInfo(CE.clusterResultsToString()); base.Output.Add(CL); for (int i = 0; i < Assign.Length; i++) base.Output[base.Output.Count-1].Add(Assign[i]); } base.End(); return FeedBackMessage; }