public PoptvrSystem(DataSet dataset, ClusterSetting clusterSetting, ClusterFacadeInterface clusterFacade, Settings settings) { this.dataset = dataset; this.clusterSetting = clusterSetting; this.clusterFacade = clusterFacade; this.appConfig = new AppConfig(settings); }
public ClusterInterface getOutputCluster(AppConfig appConfig) { ClusterInterface cluster = new RCT(dataset.NumberOfOutputNodes, this.clusterSetting.OutputClusterSize, dataset.TotalNumberOfRecords); cluster.computeInitialCentroids(dataset.DesiredOutputs, new double[0, 0], dataset.TotalNumberOfRecords); cluster.computeFinalCentroids(dataset.DesiredOutputs, dataset.DesiredOutputs, dataset.TotalNumberOfRecords); return cluster; }
public ClusterInterface getInputCluster(AppConfig appConfig) { ClusterInterface cluster = new SOcluster(dataset.NumberOfInputNodes, clusterSetting.InputClusterSize); cluster.computeInitialCentroids(dataset.Inputdata, new double[0, 0], dataset.TotalNumberOfRecords); cluster.computeFinalCentroids(dataset.Inputdata, new double[0, 0], dataset.TotalNumberOfRecords); return cluster; }
public ClusterInterface getInputCluster(AppConfig appConfig) { ClusterInterface cluster = new MLVQ(this.dataset.NumberOfInputNodes, this.clusterSetting.InputClusterSize); cluster.computeInitialCentroids(this.dataset.Inputdata, new double[0, 0], this.dataset.TotalNumberOfRecords); FileWriter fileWriter = new FileWriter(appConfig); fileWriter.WriteDoubleArray("inputIniCent.txt", cluster.Centroids); fileWriter.WriteDoubleArray("inputIniWidths.txt", cluster.Widths); cluster.computeFinalCentroids(this.dataset.Inputdata, this.dataset.DesiredOutputs, this.dataset.TotalNumberOfRecords); fileWriter.WriteDoubleArray("inputFinCent.txt", cluster.Centroids); fileWriter.WriteDoubleArray("inputFinWidths.txt", cluster.Widths); return cluster; }
public static PoptvrModel RuleReduction(PoptvrModel poptvr, DataSet dataset, AppConfig appConfig) { Console.WriteLine("Start RSPOP reduction ..."); double[] CO = new double[dataset.NumberOfOutputNodes * poptvr.OutputClusterSize]; double[] COr = new double[dataset.NumberOfOutputNodes * poptvr.OutputClusterSize]; string res = "Removed from total " + poptvr.RuleLayer.Length + "\n"; for (int k = 0; k < poptvr.RuleLayer.Length; k++) { for (int i = 0; i < dataset.TotalNumberOfRecords; i++) { Console.Write("at condition " + k + "\t" + "record " + i + "\n"); poptvr.forwardFeed(SystemFunctions.getArrayAtRow(dataset.Inputdata, i)); for (int j = 0; j < dataset.NumberOfOutputNodes * poptvr.OutputClusterSize; j++) { CO[j] = poptvr.ConsequenceLayer[j].Output; } for (int l = 0; l < poptvr.InputClusterSize; l++) { bool deterioration = false; poptvr.RuleLayer[k].PointBlocked = true; poptvr.RuleLayer[k].PointBlockedAt = l; poptvr.forwardFeed(SystemFunctions.getArrayAtRow(dataset.Inputdata, i)); for (int j = 0; j < dataset.NumberOfOutputNodes * poptvr.OutputClusterSize; j++) { COr[j] = poptvr.ConsequenceLayer[j].Output; if (COr[j] < CO[j]) { deterioration = true; } else { for (int m = 0; m < CO.Length; m++) { if (COr[j] > CO[m]) { deterioration = true; break; } } } if (deterioration) { break; } } if (!deterioration) { res += (l + " is remove at " + k + "\n"); poptvr.RuleLayer[k].PointBlocked = false; } if (deterioration) { poptvr.RuleLayer[k].PointBlocked = false; } } } } FileWriter fileWriter = new FileWriter(appConfig); fileWriter.WriteToFile(appConfig.getOutputFolder() + "Removed Rule.txt", res); return poptvr; }
public FileWriter(AppConfig appConfig) { this.appConfig = appConfig; }