ISmDecisionTree.RelevanceMeasure

Syntax

RelevanceMeasure: IBinaryModelRelevanceMeasure;

Description

The RelevanceMeasure property returns binary classification quality criteria.

Comments

Criteria of classification quality are calculated, if explanatory series is binary.

Example

To execute the example, add a link to the Stat system assembly.

Sub UserProc;
Var
    dTree: SmDecisionTree;
    expl, ex1, ex2: Array[
12Of Double;
    res: Integer;
Begin
    dTree := 
New SmDecisionTree.Create;
    
// Set initial data
    ex1[0] := 0; ex2[0] := 0; expl[0] := 0;
    ex1[
1] := 0; ex2[1] := 1; expl[1] := 1;
    ex1[
2] := 1; ex2[2] := 0; expl[2] := 0;
    ex1[
3] := 1; ex2[3] := 1; expl[3] := 1;
    ex1[
4] := 0; ex2[4] := 0; expl[4] := 0;
    ex1[
5] := 0; ex2[5] := 1; expl[5] := 1;
    ex1[
6] := 1; ex2[6] := 0; expl[6] := 1;
    ex1[
7] := 1; ex2[7] := 1; expl[7] := 1;
    ex1[
8] := 1; ex2[8] := 1; expl[8] := 0;
    ex1[
9] := 1; ex2[9] := 0; expl[9] := 0;
    ex1[
10] := 1; ex2[10] := 0; expl[10] := 1;
    ex1[
11] := 1; ex2[11] := 1; expl[11] := 1;
    
// Set explained series
    dTree.Dependent.Value := expl;
    
// Set explanatory series
    dTree.Explanatories.Add.Value := ex1;
    dTree.Explanatories.Add.Value := ex2;
    
// Run calculation and output results
    res := dTree.Execute;
    
If res <> 0 Then
        Debug.WriteLine(dTree.Errors);
    
Else
        
// Display classification quality criteria      
        Debug.WriteLine("Classification quality criteria");
        Debug.Indent;
        Debug.WriteLine(
"Number of truly positive values: " + dTree.RelevanceMeasure.TruePositive.ToString);
        Debug.WriteLine(
"Number of truly negative values: " + dTree.RelevanceMeasure.TrueNegative.ToString);
        Debug.WriteLine(
"Number of false positive values: " + dTree.RelevanceMeasure.FalsePositive.ToString);
        Debug.WriteLine(
"Number of false negative values: " + dTree.RelevanceMeasure.FalseNegative.ToString);
        Debug.WriteLine(
"Overall accuracy: " + dTree.RelevanceMeasure.Accuracy.ToString);
        Debug.WriteLine(
"F - estimate: " + dTree.RelevanceMeasure.F1.ToString);
        Debug.WriteLine(
"Accuracy of positive result: " + dTree.RelevanceMeasure.Precision.ToString);
        Debug.WriteLine(
"Completeness of positive result: " + dTree.RelevanceMeasure.Recall.ToString);
        Debug.Unindent;
    
End If;
End Sub UserProc;

After executing the example, the console window will display classification quality criteria.

See also:

ISmDecisionTree