Exemple #1
0
        public static void Evol3_BuildAprioriInstance()
        {
            Helpers.Utils.Debug("Evol3 Apriori..");
            Stopwatch sw = new Stopwatch();

            sw.Start();

            string mysqlConStr = "SERVER=localhost;" +
                                 "DATABASE=uhs;" +
                                 "UID=root;" +
                                 "PASSWORD=pascal;";

            CekaMySQL sql = new CekaMySQL(mysqlConStr);

            ArffInstance uhsAi = sql.tableToInstance("UHS_EXTENDED_STORIES_2",
                                                     new string[] {
                "MNTHS_TO_1",
                "MNTHS_TO_2",
                "AGE",
                "STATUS",
                "T_NONE",
                "T_HORMONE",
                "T_SURGERY",
                "T_PRI_CHEMO",
                "T_ADJ_CHEMO",
                "T_ADJ_RT",
                "T_OOPH",
                "T_PLASTIC",
                "T_HER"
            }, -1, -1, false, false);

            long em = sw.ElapsedMilliseconds;

            Helpers.Utils.Debug(string.Format("Gathered MySQL ArffInstance {0} ms.", em));

            uhsAi.integrityCheck();

            uhsAi.rebuildAttributeValueByRange(0, 120);
            uhsAi.rebuildAttributeValueByRange(1, 120);
            uhsAi.rebuildAttributeValueByRange(2, 16);

            uhsAi.deletePatternMatchingDatasets(new List <string> {
                "[-19<->101]"
            });
            uhsAi.deletePatternMatchingDatasets(new List <string> {
                "*", "[-67<->53]"
            });

            uhsAi.removeUnusedAttributeValues();
            uhsAi.Relation = "uhs_ext_story_apriori_evol3";

            long em2 = sw.ElapsedMilliseconds;

            Helpers.Utils.Debug(string.Format("Prepared apriori set in {0} ms.", (em2 - em)));

            new ArffSaver(uhsAi).saveInstance("uhs_ext_story_apriori_evol3");

            Helpers.Utils.Debug(string.Format("Evol done, tooks {0} ms.", sw.ElapsedMilliseconds));
        }
Exemple #2
0
        public static void Evol4_BuildClassifierInstance()
        {
            Helpers.Utils.Debug("Evol4 Classifier..");
            Stopwatch sw = new Stopwatch();

            sw.Start();

            string mysqlConStr = "SERVER=localhost;" +
                                 "DATABASE=uhs;" +
                                 "UID=root;" +
                                 "PASSWORD=pascal;";

            CekaMySQL sql = new CekaMySQL(mysqlConStr);

            ArffInstance uhsAi = sql.tableToValidatedInstance("UHS_EXTENDED_STORIES_2",
                                                              new string[] {
                "MNTHS_TO_1",
                "MNTHS_TO_2",
                "AGE",
                "STATUS",
                "T_NONE",
                "T_HORMONE",
                "T_SURGERY",
                "T_PRI_CHEMO",
                "T_ADJ_CHEMO",
                "T_ADJ_RT",
                "T_OOPH",
                "T_PLASTIC",
                "T_HER"
            }, new string[] {
                "MNTHS_TO_1",
                "MNTHS_TO_2"
            }, -1, -1, false, false);

            long em = sw.ElapsedMilliseconds;

            Helpers.Utils.Debug(string.Format("Gathered MySQL ArffInstance + preparing.. in {0} ms.", em));

            uhsAi.deletePatternMatchingDatasets(new List <string>()
            {
                "*", "0"
            });

            int ageIndex = uhsAi.getIndexOfAttribute("AGE");

            uhsAi.rebuildAttributeValueByRange(ageIndex, 29);

            uhsAi.refineBackRangedAttribute(ageIndex, 3, 5);

            uhsAi.Relation = "uhs_ext_story_classifier_evol4";

            long em2 = sw.ElapsedMilliseconds;

            Helpers.Utils.Debug(string.Format("Prepared classifier set in {0} ms.", (em2 - em)));

            new ArffSaver(uhsAi).saveInstance("uhs_ext_story_classifier_evol4");

            Helpers.Utils.Debug(string.Format("Evol done, tooks {0} ms.", sw.ElapsedMilliseconds));
        }