/// <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); }