/// <summary> /// Handle through the tree and check where the example data would land /// or how it would be classified. Set this result in the example data. /// </summary> /// <param name="example">The example to classify.</param> public override void CareForTestExample(IExampleRow example) { if (!this.IsLeaf) { // Compare Values of the Feature of the current split if (example.Items.Where(x => x.RelatedFeature.Name == this.OutgoingSplit.FeatureName).Single().Value <= this.OutgoingSplit.Value) { // If smaller equal -> recursion to the left this.LeftNode?.CareForTestExample(example); } else { // If greater -> recursion to the right this.RightNode?.CareForTestExample(example); } } else { // Create a test result IClassificationResult result = new ClassificationResult(example); result.ClassifiedAs = this.Population.Max(x => x.Class); example.Classification = result; } }
/// <summary> /// Initializes a new instance of the <see cref="ClassificationResult"/> class. /// </summary> /// <param name="row">The classified row.</param> public ClassificationResult(IExampleRow row) { this.ClassifiedRow = row; }
/// <summary> /// Handle through the tree and check where the example data would land /// or how it would be classified. Set this result in the example data. /// </summary> /// <param name="example">The example to classify.</param> public abstract void CareForTestExample(IExampleRow example);