Exemple #1
0
        public static void GetDefaultMultithreadedAprioriFlexJsonResultOfAliveAndDead()
        {
            Helpers.Utils.Debug("Getting threaded Apriori Flex Results of Alive and Dead datasets..");
            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_patient_story".ToUpper(),
                                                     new string[] {
                "INITIAL_PRESENTATION",
                "INT_1_PRES",
                "INT_2_PRES",
                "STATUS"
            }, -1, -1, false, true);

            Helpers.Utils.Debug("Gathered MySQL ArffInstance in " + sw.ElapsedMilliseconds + "ms.");
            uhsAi.Relation = "uhs_arff_total";

            Thread t1 = new Thread(new ThreadStart(delegate()
            {
                ArffInstance uhsAi2 = uhsAi.toCopy();
                uhsAi2.removeDatasetsPerAttributeValue("STATUS", "Y");
                uhsAi2.Relation = "uhs_arff_alive";
                new Ceka.Algorithms.Associaters.Apriori(uhsAi2, 0.2f, 0.1f, "apriori_result_alive");
            }));

            Thread t2 = new Thread(new ThreadStart(delegate()
            {
                ArffInstance uhsAi3 = uhsAi.toCopy();
                uhsAi3.removeDatasetsPerAttributeValue("STATUS", "N");
                uhsAi3.Relation = "uhs_arff_dead";
                new Ceka.Algorithms.Associaters.Apriori(uhsAi3, 0.2f, 0.1f, "apriori_result_dead");
            }));

            t1.Start();
            t2.Start();

            new Ceka.Algorithms.Associaters.Apriori(uhsAi, 0.2f, 0.1f, "apriori_result_total");

            t1.Join();
            t2.Join();

            Helpers.Utils.Debug("Json Apriori Flex Result Dump done, took " + sw.ElapsedMilliseconds + "ms."); sw.Stop();
        }
Exemple #2
0
        public static void GetDefaultDumpOfAliveAndDead()
        {
            Helpers.Utils.Debug("Dumping default alive and dead ARFF files..");
            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_patient_story".ToUpper(),
                                                     new string[] {
                "INITIAL_PRESENTATION",
                "INT_1_PRES",
                "INT_2_PRES",
                "STATUS"
            }, -1, -1, false, true);

            long em = sw.ElapsedMilliseconds;

            Helpers.Utils.Debug(string.Format("Gathered MySQL ArffInstance and stored total file in {0} ms.", em));

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

            ArffInstance uhsAi2 = uhsAi.toCopy();

            long em2 = sw.ElapsedMilliseconds;

            Helpers.Utils.Debug(string.Format("Copied ArffInstance in {0} ms.", (em2 - em)));

            uhsAi.removeDatasetsPerAttributeValue("STATUS", "Y");
            uhsAi.Relation = "uhs_arff_alive";

            long em3 = sw.ElapsedMilliseconds;

            Helpers.Utils.Debug(string.Format("Separated Alive Set in {0} ms.", (em3 - em2)));

            uhsAi2.removeDatasetsPerAttributeValue("STATUS", "N");
            uhsAi2.Relation = "uhs_arff_dead";

            long em4 = sw.ElapsedMilliseconds;

            Helpers.Utils.Debug(string.Format("Separated Dead Set in {0} ms.", (em4 - em3)));

            new ArffSaver(uhsAi).saveInstance("uhs_arff_alive");
            new ArffSaver(uhsAi2).saveInstance("uhs_arff_dead");

            long em5 = sw.ElapsedMilliseconds;

            Helpers.Utils.Debug(string.Format("Stored both sets in files, took {0} ms.", (em5 - em4)));

            sql.close();

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