Example #1
0
        public static void UKI_CalEntropy_Eu(String path_saveTo, String path_loadFrom, List <int[]> keyPostureRange)
        {
            List <string> final_output = new List <string>();              //Data

            final_output.Add("id," + TheUKI.getHeader_20Joint("_dist_H")); //Header
            final_output.AddRange(TheEntropy.calEntropy_MotionData(path_loadFrom, keyPostureRange, 2, 3));
            TheTool.exportCSV_orTXT(path_saveTo, final_output, false);
        }
Example #2
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)
        }
Example #3
0
        //============================================================

        public static void UKI_CalEntropy_1By1(String path_saveTo, String path_loadFrom, List <int[]> keyPosture_Range)
        {
            try{
                List <string> final_output = new List <string>();//Data
                //Header
                string   origin_header = TheTool.read_File_getFirstLine(path_loadFrom);
                string   new_header    = "id";
                string[] h             = TheTool.splitText(origin_header, ",");
                for (int i = 2; i < h.Count(); i++)
                {
                    new_header += "," + h[i] + "_H";
                }
                final_output.Add(new_header);
                //
                final_output.AddRange(TheEntropy.calEntropy_MotionData(path_loadFrom, keyPosture_Range, 2, 1));
                TheTool.exportCSV_orTXT(path_saveTo, final_output, false);
            }catch (Exception ex) { TheSys.showError(ex); }
        }
Example #4
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);
        }