コード例 #1
0
        public void AddOutgoingEdge(HmmState <TValue, TObservation> to, double logProbability)
        {
            if (this.Model == null)
            {
                throw new InvalidOperationException();
            }
            if (to == null)
            {
                throw new ArgumentNullException(nameof(to));
            }
            if (to.Model != this.Model)
            {
                throw new ArgumentException(nameof(to));
            }
            if (!(logProbability <= 0.0))
            {
                throw new ArgumentOutOfRangeException(nameof(logProbability));
            }

            if (double.IsNegativeInfinity(logProbability))
            {
                this._outgoingEdges.Remove(to.Index);
            }
            else
            {
                this._outgoingEdges[to.Index] = logProbability;
            }
        }
コード例 #2
0
        public SingingPositionTracker(HmmState <PitchHmmState, PitchHmmEmission> startState)
        {
            this._model = startState.Model;

            // 初期状態はスタートが 1
            this._stateLogProbabilities = new List <KeyValuePair <int, double> >(this._model.States.Count)
            {
                new KeyValuePair <int, double>(startState.Index, 0.0)
            };
        }
コード例 #3
0
        public void AddState(HmmState <TStateValue, TObservation> state)
        {
            if (state == null)
            {
                throw new ArgumentNullException(nameof(state));
            }

            state.SetModel(this, this._states.Count);
            this._states.Add(state);
        }