WithFeatures() public méthode

Efficiently returns an identical example except with only the features at the indices specified by the argument. No copying of features is performed.
public WithFeatures ( IArrayView featureIndices ) : Example
featureIndices IArrayView
Résultat Example
Exemple #1
0
        /// <summary>
        /// Predicts the binary class of the binary example using the weighted vote of each weak learner
        /// </summary>
        protected override int PredictBinary(Example binaryExample, out double confidence)
        {
            confidence = 1.0;
            double weightedVote = 0;

            for (int i = 0; i < this.weakLearners.Length; i++)
            {
                weightedVote += this.alphas[i] *
                                this.weakLearners[i].Predict(binaryExample.WithFeatures(this.weakLearnerFeatures[i]));
            }

            if (weightedVote == 0)
            {
                return(this.NegativeExampleValue);
            }
            return(Math.Sign(weightedVote));
        }
        /// <summary>
        /// Predicts the binary class of the binary example using the weighted vote of each weak learner
        /// </summary>
        protected override int PredictBinary(Example binaryExample, out double confidence)
        {
            confidence = 1.0;
            double weightedVote = 0;
            for (int i = 0; i < this.weakLearners.Length; i++)
                weightedVote += this.alphas[i] *
                    this.weakLearners[i].Predict(binaryExample.WithFeatures(this.weakLearnerFeatures[i]));

            if (weightedVote == 0)
                return this.NegativeExampleValue;
            return Math.Sign(weightedVote);
        }