Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// same as tableToInstance(), but it adds validity checking
        /// </summary>
        /// <param name="table"></param>
        /// <param name="table_col"></param>
        /// <param name="numeric"></param>
        /// <param name="startIndex"></param>
        /// <param name="endIndex"></param>
        /// <param name="firstUndefined"></param>
        /// <param name="secondUndefined"></param>
        /// <returns></returns>
        public ArffInstance tableToValidatedInstance(string table, string[] table_col, string[] numeric, int startIndex = -1, int endIndex = -1, bool firstUndefined = false, bool secondUndefined = false)
        {
            ArffInstance ai = this.tableToInstance(table, table_col, startIndex, endIndex, firstUndefined, secondUndefined);

            if (numeric != null)
            {
                foreach (string an in numeric)
                {
                    ai.turnAttributeIntoNumeric(an, "numeric");
                }
            }

            ai.Headers.CleanUp();
            ai.removeUnusedAttributeValues();
            ai.integrityCheck();

            return(ai);
        }