示例#1
0
        /// <summary>
        ///   Creates a new object that is a copy of the current instance.
        /// </summary>
        ///
        /// <returns>
        ///   A new object that is a copy of this instance.
        /// </returns>
        ///
        public object Clone()
        {
            double[,] A = (double[, ])Transitions.Clone();
            double[,] B = (double[, ])Emissions.Clone();
            double[] pi = (double[])Probabilities.Clone();

            return(new HiddenMarkovModel(A, B, pi, logarithm: true));
        }
示例#2
0
        /// <summary>
        ///   Creates a new object that is a copy of the current instance.
        /// </summary>
        ///
        /// <returns>
        ///   A new object that is a copy of this instance.
        /// </returns>
        ///
        public object Clone()
        {
            double[,] A = (double[, ])Transitions.Clone();
            double[] pi = (double[])Probabilities.Clone();

            TDistribution[] B = new TDistribution[Emissions.Length];
            for (int i = 0; i < Emissions.Length; i++)
            {
                B[i] = (TDistribution)Emissions[i].Clone();
            }

            return(new HiddenMarkovModel <TDistribution>(A, B, pi, logarithm: true));
        }
示例#3
0
        /// <summary>
        ///   Converts this <see cref="HiddenMarkovModel">Discrete density Hidden Markov Model</see>
        ///   into a <see cref="HiddenMarkovModel{TDistribution}">arbitrary density model</see>.
        /// </summary>
        public HiddenMarkovModel <GeneralDiscreteDistribution> ToContinuousModel()
        {
            var transitions   = (double[, ])Transitions.Clone();
            var probabilities = (double[])Probabilities.Clone();

            var emissions = new GeneralDiscreteDistribution[States];

            for (int i = 0; i < emissions.Length; i++)
            {
                emissions[i] = new GeneralDiscreteDistribution(Accord.Math.Matrix.GetRow(Emissions, i));
            }

            return(new HiddenMarkovModel <GeneralDiscreteDistribution>(transitions, emissions, probabilities));
        }