Beispiel #1
0
        /// <summary>
        /// 获得所有车号/名次的熵
        /// </summary>
        /// <param name="reviewCnt"></param>
        /// <param name="stepLong"></param>
        /// <returns></returns>
        public override List <double> getEntropyList(int reviewCnt)
        {
            //Dictionary<string, double> ret = new Dictionary<string, double>();
            double ret = 0;
            Dictionary <string, double> CntList = new Dictionary <string, double>();
            string        key_model             = "{0}_{1}";
            List <double> AllColsList           = new List <double>();

            for (int i = 0; i < 10; i++)//遍历所有表列
            {
                string        strCol  = string.Format("{0}", (i + 1) % 10);
                List <double> colList = new List <double>();
                for (int val = 0; val < 10; val++)
                {
                    string strKey = string.Format(key_model, strCol, val);
                    //////List<double> keyInReviewCnt = new List<double>();
                    //////for (int r = 0; r < reviewCnt; r++)
                    //////{
                    //////    string strVal = val.ToString();
                    int ExistCnt = FindLastDataExistCount(reviewCnt, strKey, val.ToString());
                    //////    keyInReviewCnt.Add((double)ExistCnt);
                    //////}
                    //////double KeyInReviewStdDev = ProbMath.CalculateStdDev(keyInReviewCnt.ToArray());
                    double p = (double)(ExistCnt / reviewCnt);
                    CntList.Add(strKey, p);
                    colList.Add(p);
                }
                double colEntropy = EntropyClass.GetEntropy(colList.ToArray());//获得各车/次熵值
                AllColsList.Add(colEntropy);
            }
            ret = ProbMath.CalculateStdDev(CntList.Values.ToArray());
            AllColsList.Add(ret);
            return(AllColsList);
        }
Beispiel #2
0
        private void btn_Bayes_Click(object sender, EventArgs e)
        {
            double Atrue  = double.Parse(this.txt_N.Text);
            double Btrue  = double.Parse(this.txt_M.Text);
            double Afalse = double.Parse(this.txt_N1.Text);
            double Bfalse = double.Parse(this.txt_M1.Text);

            this.txt_Return.Text = string.Format("{0}", EntropyClass.GetBayes(Atrue, Afalse, Btrue, Bfalse));
        }