Exemple #1
0
        public PoptvrModel PopLearn()
        {
            this.poptvr = new PoptvrModel(this.dataset, this.clusterSetting);
            this.poptvr.initMembership(inputCluster, outputCluster);

            this.poptvr.popLearn();
            FileWriter fileWriter = new FileWriter(this.appConfig);
            fileWriter.WritePopLearnOutput(this.poptvr);

            return this.poptvr;
        }
Exemple #2
0
        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;
        }
Exemple #3
0
        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;
        }
Exemple #4
0
 public void PopTest(DataSet dataset)
 {
     string result = PoptvrModel.POPTest(this.poptvr, dataset);
     FileWriter fileWriter = new FileWriter(this.appConfig);
     fileWriter.WritePopTestOutput(result);
 }