コード例 #1
0
        /**
         * Utility method to copy the contents of a ClassifierResult.
         *
         * @return  a copy of this {@code ClassifierResult} which will not be affected
         * by changes to the original.
         */
        public ClassificationExperiment <T> copy()
        {
            ClassificationExperiment <T> retVal = new ClassificationExperiment <T>();

            retVal.actualValues = (T[])actualValues.Clone();
            //retVal.actualValues = Arrays.copyOf(actualValues.CopyTo(, actualValues.length);
            //retVal.probabilities = new TIntObjectHashMap<double[]>(probabilities);
            retVal.probabilities = new Dictionary <int, double[]>(probabilities);

            return(retVal);
        }
コード例 #2
0
        public bool Equals(ClassificationExperiment <T> obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }

            ClassificationExperiment <T> other = (ClassificationExperiment <T>)obj;

            if (!actualValues.SequenceEqual(other.actualValues))
            {
                return(false);
            }
            if (probabilities == null)
            {
                if (other.probabilities != null)
                {
                    return(false);
                }
            }
            else
            {
                foreach (int key in probabilities.Keys)
                {
                    if (!probabilities[key].SequenceEqual((double[])other.probabilities[key]))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }