/// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
        /// </returns>
        /// <param name="other">An object to compare with this object.</param>
        public bool Equals(BayesianFeature <F> other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(Feature.Equals(other.Feature));
        }
Example #2
0
        internal BayesianFeature <F> GetBayesianFeature(F feature, bool create)
        {
            if (knowledge.ContainsKey(feature))
            {
                var bf = knowledge[feature];
                if (Comparer.Compare(bf.Feature, feature) == 0)
                {
                    return(bf);
                }
            }
            else if (create)
            {
                var bf = new BayesianFeature <F>(feature);

                knowledge[feature] = bf;

                return(bf);
            }

            return(null);
        }