Exemplo n.º 1
0
        public DiscreteMarkov(List <int> data, int count, int K = 5)
        {
            this.StateList   = data;
            this.LagPeriod   = K;
            this.Count       = count;
            this.CountStatic = StaticCount(data, count);
            this.ProbMatrix  = new List <DenseMatrix>();
            var t0 = DenseMatrix.OfArray(StaticProbability(this.CountStatic).ConvertToArray <double>());

            ProbMatrix.Add(t0);

            for (int i = 1; i < K; i++) //根据CK方程,计算各步的状态转移矩阵
            {
                var temp = ProbMatrix[i - 1] * t0;
                ProbMatrix.Add(temp);
            }
            if (ValidateMarkov())
            {
                CorrCoefficient();
                TimeWeight();
                PredictProb();
            }
            else
            {
                Console.WriteLine("马氏性 检验失败,无法进行下一步预测");
            }
        }
 private void initialize(int size, int laplaceConstant)
 {
     for (int i = 0; i < gridHeight; i++)
     {
         for (int j = 0; j < gridHeight; j++)
         {
             probMatrix[i][j] = new ProbMatrix(size);
         }
     }
     initializeAnswerMatrix();
 }