Ejemplo n.º 1
0
        public override int Run(string[] args)
        {
            Console.WriteLine("Start");
            fill_params(args);
            Console.WriteLine("Params get \nfile in {0} \n", file_in);

            Class_learn_set = BaseUFSLoader.LoadLearnFromUFS(file_in);
            Console.WriteLine("Tra load");

            Class_test_set = BaseUFSLoader.LoadTestFromUFS(file_in);
            Console.WriteLine("Tst load");
            conf = new PSOBacterySearchConf();
            conf.Init(Class_learn_set.CountVars);
            conf.loadParams(confParams);
            Console.WriteLine("Conf Filed");

            Class_Pittsburg = new PCFuzzySystem(Class_learn_set, Class_test_set);
            Class_Pittsburg = PCFSUFSLoader.loadUFS(Class_Pittsburg, file_in);

            Console.WriteLine("Classifier created");
            optimaze        = new Term_config_PSO_Bactery();
            Class_Pittsburg = optimaze.TuneUpFuzzySystem(Class_Pittsburg, conf);
            Console.WriteLine("Optimization complite");
            PCFSUFSWriter.saveToUFS(Class_Pittsburg, file_out);
            Console.WriteLine("Saved");
            return(1);
        }
Ejemplo n.º 2
0
        public override int Run(string[] args)
        {
            Console.WriteLine("Start");
            fill_params(args);
            Console.WriteLine("Params get \nfile tra {0} \nfile name tst {1} ", file_learn, file_test);
            Class_learn_set = new SampleSet(file_learn);
            Class_learn_set = new SampleSet(file_learn);
            Console.WriteLine("Tra create");
            Class_test_set = new SampleSet(file_test);
            Console.WriteLine("Tst create");
            conf = new InitBySamplesConfig();
            conf.Init(Class_learn_set.CountVars);

            fill_conf();
            Console.WriteLine("Conf Filed");
            Class_Pittsburg = new PCFuzzySystem(Class_learn_set, Class_test_set);
            Console.WriteLine("Classifier created");
            generator = new GeneratorRulesBySamples();

            Class_Pittsburg = generator.Generate(Class_Pittsburg, conf);
            //         GeneratorRulesBySamples.InitRulesBySamples(Class_Pittsburg, func);
            //    SingletoneApproximate = generator.Generate(SingletoneApproximate, conf);
            Console.WriteLine("Gereration complite");

            PCFSUFSWriter.saveToUFS(Class_Pittsburg, file_out);
            Console.WriteLine("Saved");
            return(1);
        }
Ejemplo n.º 3
0
        private void save_FS(PCFuzzySystem FS, string Name_alg)
        {
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }


            string file_name = DateTime.Now.ToLongDateString() + " " + DateTime.Now.TimeOfDay.ToString("hh','mm','ss") + " (" + Thread.CurrentThread.ManagedThreadId.ToString() + ")" + "[" + FS.ValueComplexity().ToString() + "]{" + Name_alg + "}.ufs";

            PCFSUFSWriter.saveToUFS(FS, path + file_name);
        }
Ejemplo n.º 4
0
        private void saveFS(PCFuzzySystem Classifier, string path, string dataSet, int seed, int numstep, int globalCounter, bool isPath)
        {
            string RootPath = path + "\\" + dataSet + "\\";

            if (!Directory.Exists(RootPath))
            {
                Directory.CreateDirectory(RootPath);
            }
            string name = globalCounter.ToString() + "_s" + seed.ToString();

            if (isPath)
            {
                name += "_p" + numstep.ToString();
            }
            name += ".ufs";
            PCFSUFSWriter.saveToUFS(Classifier, RootPath + name);
        }
Ejemplo n.º 5
0
        public override int Run(string[] args)
        {
            Console.WriteLine("Start");
            fill_params(args);


            foreach (string filenametra in System.IO.Directory.GetFiles(file_learn, "*tra.dat", System.IO.SearchOption.AllDirectories))
            {
                string filenameTST = filenametra.Replace("tra.dat", "tst.dat");

                Console.WriteLine("Params get \nfile tra {0} \nfile name tst {1} ", filenametra, filenameTST);
                Class_learn_set = new SampleSet(filenametra);
                Console.WriteLine("Tra create");
                Class_test_set = new SampleSet(filenameTST);
                Console.WriteLine("Tst create");
                conf = new InitBySamplesConfig();
                conf.Init(Class_learn_set.CountVars);

                // fill_conf();
                conf.loadParams(confParams);

                file_out = filenametra.Replace("tra.dat", ((InitBySamplesConfig)conf).IBSTypeFunc.ToString() + "_out.ufs");
                Console.WriteLine("Conf Filed");
                Class_Pittsburg = new PCFuzzySystem(Class_learn_set, Class_test_set);
                Console.WriteLine("Classifier created");
                generator = new GeneratorRulesBySamples();

                Class_Pittsburg = generator.Generate(Class_Pittsburg, conf);
                Console.WriteLine("Generation complite");

                PCFSUFSWriter.saveToUFS(Class_Pittsburg, file_out);

                StreamWriter sw = new StreamWriter(Path.Combine(file_learn, ((InitBySamplesConfig)conf).IBSTypeFunc.ToString() + "_log.txt"), true);
                sw.WriteLine(filenametra + "\t" + Class_Pittsburg.ErrorLearnSamples(Class_Pittsburg.RulesDatabaseSet[0]));
                sw.WriteLine(filenameTST + "\t" + Class_Pittsburg.ErrorTestSamples(Class_Pittsburg.RulesDatabaseSet[0]));
                sw.Close();

                Console.WriteLine("Saved");
            }
            return(1);
        }
Ejemplo n.º 6
0
 public override int Run(string[] args)
 {
     Console.WriteLine("Start");
     fill_params(args);
     Console.WriteLine("Params get \nfile tra {0} \nfile name tst {1} ", file_learn, file_test);
     Class_learn_set = new SampleSet(file_learn);
     Console.WriteLine("Tra create");
     Class_test_set = new SampleSet(file_test);
     Console.WriteLine("Tst create");
     conf = new InitEveryoneWithOptimal();
     conf.Init(Class_learn_set.CountVars);
     conf.loadParams(confParams);
     Console.WriteLine("Conf Filed");
     Class_Pittsburg = new PCFuzzySystem(Class_learn_set, Class_test_set);
     Console.WriteLine("Classifier created");
     generator       = new GeneratorRulesEveryoneWithOptimal();
     Class_Pittsburg = generator.Generate(Class_Pittsburg, conf) as PCFuzzySystem;
     Console.WriteLine("Gereration complite");
     PCFSUFSWriter.saveToUFS(Class_Pittsburg, file_out);
     Console.WriteLine("Saved");
     return(1);
 }
Ejemplo n.º 7
0
        protected void savetoUFS(List <KnowlegeBasePCRules> Source, int startpos, int endPos, int TryNum)
        {
            KnowlegeBasePCRules temp = result.RulesDatabaseSet[0];


            if (!Directory.Exists(PathAlgSource))
            {
                Directory.CreateDirectory(PathAlgSource);
            }
            string[] files = Directory.GetFiles(PathAlgSource, "*.ufs");
            foreach (string file in files)
            {
                File.Delete(file);
            }

            for (int i = startpos; i <= endPos; i++)
            {
                result.RulesDatabaseSet[0] = Source[i];

                PCFSUFSWriter.saveToUFS(result, PathAlgSource + TryNum.ToString() + "_" + i.ToString() + ".ufs");
            }
            result.RulesDatabaseSet[0] = temp;
        }
Ejemplo n.º 8
0
        public override void Work()
        {
            GIBNormal      = fuzzy_system.getGIBNormal();
            GIBSumStraigth = fuzzy_system.getGIBSumStrait();
            GIBSumReverce  = fuzzy_system.getGIBSumReverse();

            GICNormal     = fuzzy_system.getGICNormal();
            GICSumReverce = fuzzy_system.getGICSumReverce();
            GICSumStraigh = fuzzy_system.getGICSumStraigth();

            GISNormal      = fuzzy_system.getGISNormal();
            GISSumReverce  = fuzzy_system.getGISSumReverce();
            GISSumStraigth = fuzzy_system.getGISSumStraigt();

            LindisNormal     = fuzzy_system.getLindisNormal();
            LindisSumStraigh = fuzzy_system.getLindisSumStraight();
            LindisSumReverce = fuzzy_system.getLindisSumReverse();

            NormalIndex       = fuzzy_system.getNormalIndex();
            SumReverseIndex   = fuzzy_system.getIndexSumReverse();
            SumsStraigthIndex = fuzzy_system.getIndexSumStraigt();
            PCFSUFSWriter.saveToUFS(fuzzy_system, Source);
        }
Ejemplo n.º 9
0
      protected void savetoUFS(List <KnowlegeBasePCRules> Source, int startpos, int endPos, int TryNum)
      {
          KnowlegeBasePCRules temp = result.RulesDatabaseSet[0];

          string PathAlg = (new FileInfo(Application.ExecutablePath)).DirectoryName + "\\FS\\toBactery\\";

          if (!Directory.Exists(PathAlg))
          {
              Directory.CreateDirectory(PathAlg);
          }
          string[] files = Directory.GetFiles(PathAlg, "*.ufs");
          foreach (string file in files)
          {
              File.Delete(file);
          }

          for (int i = startpos; i <= endPos; i++)
          {
              result.RulesDatabaseSet[0] = Source[i];

              PCFSUFSWriter.saveToUFS(result, PathAlg + TryNum.ToString() + "_" + i.ToString() + ".ufs");
          }
          result.RulesDatabaseSet[0] = temp;
      }
Ejemplo n.º 10
0
 private void writePCtoUFS(IFuzzySystem FS, string fileName)
 {
     PCFSUFSWriter.saveToUFS(FS as PCFuzzySystem, fileName);
 }