Esempio n. 1
0
        List <str2_double> getlistCorrelation()
        {
            List <str2_double> output = new List <str2_double>();

            try
            {
                foreach (List <String> group in TheUKI.list_bodyGroup_full)//List of Redundantable
                {
                    string[] feature = group.ToArray();
                    for (int i = 0; i < feature.Count(); i++)
                    {
                        string s1 = ""; string s2 = "";
                        if (i == feature.Count() - 1)
                        {
                            s1 = feature[i]; s2 = feature[0];
                        }
                        else
                        {
                            s1 = feature[i]; s2 = feature[i + 1];
                        }
                        str2_double new_data = new str2_double();
                        new_data.str1 = s1;
                        new_data.str2 = s2;
                        new_data.v    = TheTool.LinearRegression_Cal_Correlation(this.dt_raw_exclude, s1, s2);
                        output.Add(new_data);
                    }
                }
            }
            catch (Exception ex) { TheSys.showError(ex); }
            return(output);
        }
Esempio n. 2
0
        //MI for pair of redundantable feature
        public static List <str2_double> calMIList(DataTable dt, List <str_double> list_entropy)
        {
            List <str2_double> listMI = new List <str2_double>();

            try{
                foreach (List <String> group in TheUKI.list_bodyGroup_full)//List of Redundantable
                {
                    string[] feature = group.ToArray();
                    for (int i = 0; i < feature.Count(); i++)
                    {
                        string s1 = ""; string s2 = "";
                        if (i == feature.Count() - 1)
                        {
                            s1 = feature[i]; s2 = feature[0];
                        }
                        else
                        {
                            s1 = feature[i]; s2 = feature[i + 1];
                        }
                        List <string> pair = new List <string> {
                            s1, s2
                        };
                        str2_double new_data = new str2_double();
                        new_data.str1 = s1;
                        new_data.str2 = s2;
                        new_data.v    = TheTool.str_double_getDouble_byStr(list_entropy, s1);
                        new_data.v   += TheTool.str_double_getDouble_byStr(list_entropy, s2);
                        new_data.v   -= calJointEntropy(dt, pair);
                        //TheSys.showError(
                        //    Math.Round(TheTool.str_double_getDouble_byStr(list_entropy, s1),2) + " + " +
                        //    Math.Round(TheTool.str_double_getDouble_byStr(list_entropy, s2),2) + " - " +
                        //    calJointEntropy(dt, pair) + " = " + new_data.v);
                        listMI.Add(new_data);
                    }
                }
            }
            catch (Exception ex) { TheSys.showError(ex); }
            return(listMI);
        }