Example #1
0
        public static SAFuzzySystem loadUFS(this SAFuzzySystem Approx, string fileName)
        {
            XmlDocument Source = new XmlDocument();

            Source.Load(fileName);
            return(Approx.loadUFS(Source));
        }
        public RecombineUFSApproximate(string UFSPAth)
            : base(UFSPAth)

        {
            SampleSet LearnTable = BaseUFSLoader.LoadLearnFromUFS(Source);
            SampleSet TestTable  = BaseUFSLoader.LoadTestFromUFS(Source);

            fuzzy_system = new SAFuzzySystem(LearnTable, TestTable);
            fuzzy_system = fuzzy_system.loadUFS(Source);
        }
Example #3
0
        public static IFuzzySystem LoadUFS(string FileName, out FuzzySystemRelisedList.TypeSystem TypeFS)
        {
            IFuzzySystem result = null;

            TypeFS = FuzzySystemRelisedList.TypeSystem.PittsburghClassifier;
            XmlDocument Source = new XmlDocument();

            Source.Load(FileName);
            XmlNode temp       = Source.SelectSingleNode("FuzzySystem");
            string  typestring = temp.Attributes.GetNamedItem("Type").Value.ToLowerInvariant();

            switch (typestring)
            {
            case "approximatortakagisugeno":
            {
                TSAFuzzySystem TSAFS = new TSAFuzzySystem(LoadLearnFromUFS(Source), LoadTestFromUFS(Source));
                TSAFS.loadUFS(Source);
                result = TSAFS;
                TypeFS = FuzzySystemRelisedList.TypeSystem.TakagiSugenoApproximate;
                break;
            }

            case "approximatorsingleton":
            {
                SAFuzzySystem SAFS = new SAFuzzySystem(LoadLearnFromUFS(Source), LoadTestFromUFS(Source));
                SAFS.loadUFS(Source);
                result = SAFS;
                TypeFS = FuzzySystemRelisedList.TypeSystem.Singletone;
                break;
            }

            case "classifierpittsburgh":
            {
                PCFuzzySystem PCFS = new PCFuzzySystem(LoadLearnFromUFS(Source), LoadTestFromUFS(Source));
                PCFS.loadUFS(Source);
                result = PCFS;
                TypeFS = FuzzySystemRelisedList.TypeSystem.PittsburghClassifier;
                break;
            }
            }

            return(result);
        }
Example #4
0
        private void LoadAllFS()
        {
            PathFilesUFS = Directory.GetFiles(rootDitectory, "*.UFS", SearchOption.AllDirectories).ToList();
            PCFuzzySystem Classifier = null;
            SampleSet     tempcTable = null, temptestcTable = null;

            SAFuzzySystem Approx = null;
            SampleSet     tempaTable = null, temptestaTable = null;

            for (int i = 0; i < PathFilesUFS.Count(); i++)
            {
                try
                {
                    if (isApprox)
                    {
                        tempaTable     = BaseUFSLoader.LoadLearnFromUFS(PathFilesUFS[i]);
                        temptestaTable = BaseUFSLoader.LoadTestFromUFS(PathFilesUFS[i]);
                        Approx         = new SAFuzzySystem(tempaTable, temptestaTable);
                        Approx         = Approx.loadUFS(PathFilesUFS[i]);
                    }
                    else
                    {
                        tempcTable     = BaseUFSLoader.LoadLearnFromUFS(PathFilesUFS[i]);
                        temptestcTable = BaseUFSLoader.LoadTestFromUFS(PathFilesUFS[i]);
                        Classifier     = new PCFuzzySystem(tempcTable, temptestcTable);
                        Classifier     = Classifier.loadUFS(PathFilesUFS[i]);
                    }
                }
                catch (Exception ex)
                {
                    isApprox = !isApprox;
                    try
                    {
                        if (isApprox)
                        {
                            tempaTable     = BaseUFSLoader.LoadLearnFromUFS(PathFilesUFS[i]);
                            temptestaTable = BaseUFSLoader.LoadTestFromUFS(PathFilesUFS[i]);
                            Approx         = new SAFuzzySystem(tempaTable, temptestaTable);
                            Approx         = Approx.loadUFS(PathFilesUFS[i]);
                        }
                        else
                        {
                            tempcTable     = BaseUFSLoader.LoadLearnFromUFS(PathFilesUFS[i]);
                            temptestcTable = BaseUFSLoader.LoadTestFromUFS(PathFilesUFS[i]);
                            Classifier     = new PCFuzzySystem(tempcTable, temptestcTable);
                            Classifier     = Classifier.loadUFS(PathFilesUFS[i]);
                        }
                    }
                    catch (Exception ex1)
                    {
                        Console.Write("{0} \n{1} \n{2}", ex.Data.ToString(), ex.Message, ex.Source);
                        Console.Write("{0} \n{1} \n{2}", ex1.Data.ToString(), ex1.Message, ex.Source);
                        continue;
                    }
                }

                if (isApprox)
                {
                    addApproxValue(Approx);
                }
                else
                {
                    addClassifierValue(Classifier);
                }
                GC.Collect();
            }

            CleanRepeatesAndNullB_Click(this, null);
        }