Exemple #1
0
        void process01EntropyAlgo()
        {
            this.dt_ready = TheTool.dataTable_partitize(dt_raw_exclude, partition_range); //01 partitize
            //------------------------------------------------------------------------------
            this.EnAlgo_first_list_F = TheTool.dataTable_getColList(dt_raw_exclude);      //unselected feature (pointed by id)
            this.list_entropy        = TheEntropy.calEntropy(dt_ready);
            this.list_MI             = TheEntropy.calMIList(dt_ready, list_entropy);      //for reuse MI
            //Feature Selection Start : get first --------------------------------------
            String fi1 = TheEntropy.temp_colWithHigestEntropy;

            this.EnAlgo_first_list_F.Remove(fi1);
            this.EnAlgo_first_S = TheData.getFeature(fi1, dt_threshold_pose1, dt_threshold_pose2);//Initial Threshold is assigned here (Not optimized)
        }
Exemple #2
0
        void process01DCFS()
        {
            //prepare
            this.DCFS_listDelta            = getListDelta();
            this.DCFS_listDeltaCorrelation = TheTool.list_Copy(DCFS_listDelta);
            this.DCFS_first_list_F         = TheTool.dataTable_getColList(dt_raw_exclude);
            this.DCFS_listCorrelation      = getlistCorrelation();
            //pick first feature
            string fi1 = DCFS_listDelta_getMaxValue();

            this.DCFS_first_list_F.Remove(fi1);
            this.DCFS_first_S = TheData.getFeature(fi1, dt_threshold_pose1, dt_threshold_pose2);
            DCFS_listDelta_update(fi1);
        }
Exemple #3
0
        //path_prefix = "" if no export needed
        //looptime is negative in case auto
        public List <Feature> process02_selectCandidate(string path_prefix, int methodSelection, int loopTime)
        {
            // F: threshold not needed, so just string
            // S: threshold is needed, so use Feature
            this.score_regression_summary = new List <String>();//keep summary
            String         selected;
            List <string>  local_list_F = new List <string>();
            List <Feature> local_list_S0 = new List <Feature>();
            List <string>  local_list_S = new List <string>();
            List <m_If>    local_rules_forTest = new List <m_If>();
            double         best_scoreTRUE = 0; double best_scoreFALSE = 0; double best_scoreTotal = 0;
            //-- add first feature----------
            Feature local_first_S = new Feature();

            if (methodSelection == TheEntropy.methodSelection_DCFS)
            {
                local_list_F.AddRange(DCFS_first_list_F);
                local_first_S = this.DCFS_first_S.Copy();
            }
            else
            {
                local_list_F.AddRange(EnAlgo_first_list_F);
                local_first_S = this.EnAlgo_first_S.Copy();
            }
            selected = local_first_S.name;
            process02sub_optimizeFeature(local_rules_forTest, ref local_first_S, ref best_scoreTRUE, ref best_scoreFALSE, ref best_scoreTotal);
            process02sub_checkGoOn(best_scoreTRUE, best_scoreFALSE, best_scoreTotal); //get initial score
            local_list_S0.Add(local_first_S);                                         //to add threshold
            local_list_S.Add(selected);
            local_rules_forTest.Add(TheMapData.convertFeature_to_If(local_first_S));
            //-------------------
            if (selection_autoNumber)
            {
                loopTime = local_list_F.Count();
            }
            for (int i = 2; i < loopTime + 2; i++)
            {
                if (local_list_F.Count == 0)
                {
                    break;
                }                                      //out of data
                if (methodSelection == TheEntropy.methodSelection_DCFS)
                {
                    selected = DCFS_listDelta_getMaxValue();
                    if (path_prefix != "")
                    {
                        TheTool.exportCSV_orTXT(path_prefix + i + ".csv", DCFS_listDelta_getListString(true), false);
                    }
                }
                else
                {
                    selected = TheEntropy.select1Candidate_entropy(methodSelection, dt_ready, local_list_F, local_list_S, list_entropy, list_MI);
                    if (path_prefix != "")
                    {
                        TheTool.exportCSV_orTXT(path_prefix + i + ".csv", TheTool.str_double_getListString(TheEntropy.temp_listEntropy), false);
                    }
                }
                Feature selected0 = TheData.getFeature(selected, dt_threshold_pose1, dt_threshold_pose2);
                process02sub_optimizeFeature(local_rules_forTest, ref selected0, ref best_scoreTRUE, ref best_scoreFALSE, ref best_scoreTotal);
                Boolean goOn = process02sub_checkGoOn(best_scoreTRUE, best_scoreFALSE, best_scoreTotal);
                if (methodSelection == TheEntropy.methodSelection_DCFS)
                {
                    DCFS_listDelta_update(selected);
                }
                if (selection_autoNumber == false || goOn)
                {
                    local_list_F.Remove(selected);
                    local_list_S0.Add(selected0);
                    local_list_S.Add(selected);
                    local_rules_forTest.Add(TheMapData.convertFeature_to_If(selected0));
                }
                else
                {
                    break;
                }
            }
            return(local_list_S0);
        }