Ejemplo n.º 1
0
        public NaiveBayesClassifier(IDistribution[,] distribution, IDistribution classDistribution)
        {
            _classes = distribution.GetLength(0);

            _distribution = distribution;
            _classesProbablityDistribution = classDistribution;
        }
        /// <summary>
        ///   Constructs a new Hidden Markov Model.
        /// </summary>
        /// <param name="topology">
        ///   A <see cref="Topology"/> object specifying the initial values of the matrix of transition 
        ///   probabilities <c>A</c> and initial state probabilities <c>pi</c> to be used by this model.
        /// </param>
        /// <param name="emissions">
        ///   The initial emission probability distributions for each state.
        /// </param>
        public ContinuousHiddenMarkovModel(ITopology topology, IDistribution[] emissions)
            : base(topology)
        {
            if (emissions == null)
            {
                throw new ArgumentNullException("emissions");
            }

            if (emissions.GetLength(0) != States)
            {
                throw new ArgumentException(
                    "The emission matrix should have the same number of rows as the number of states in the model.",
                    "emissions");
            }

            B = emissions;

            if (B[0] is IMultivariateDistribution)
                dimension = ((IMultivariateDistribution) B[0]).Dimension;
            else dimension = 1;
        }