Table of Contents

Class DTrees

Namespace
OpenCvSharp.ML
Assembly
OpenCvSharp.dll

Decision tree

public class DTrees : StatModel, IDisposable, ICvPtrHolder
Inheritance
DTrees
Implements
Derived
Inherited Members

Constructors

DTrees()

protected DTrees()

DTrees(nint)

Creates instance by raw pointer cv::ml::SVM*

protected DTrees(nint p)

Parameters

p nint

Properties

CVFolds

If CVFolds > 1 then algorithms prunes the built decision tree using K-fold cross-validation procedure where K is equal to CVFolds. Default value is 10.

public int CVFolds { get; set; }

Property Value

int

MaxCategories

Cluster possible values of a categorical variable into K < =maxCategories clusters to find a suboptimal split.

public int MaxCategories { get; set; }

Property Value

int

MaxDepth

The maximum possible depth of the tree.

public int MaxDepth { get; set; }

Property Value

int

MinSampleCount

If the number of samples in a node is less than this parameter then the node will not be split. Default value is 10.

public int MinSampleCount { get; set; }

Property Value

int

Priors

The array of a priori class probabilities, sorted by the class label value.

public Mat Priors { get; set; }

Property Value

Mat

RegressionAccuracy

Termination criteria for regression trees. If all absolute differences between an estimated value in a node and values of train samples in this node are less than this parameter then the node will not be split further. Default value is 0.01f.

public float RegressionAccuracy { get; set; }

Property Value

float

TruncatePrunedTree

If true then pruned branches are physically removed from the tree. Otherwise they are retained and it is possible to get results from the original unpruned (or pruned less aggressively) tree. Default value is true.

public bool TruncatePrunedTree { get; set; }

Property Value

bool

Use1SERule

If true then a pruning will be harsher. This will make a tree more compact and more resistant to the training data noise but a bit less accurate. Default value is true.

public bool Use1SERule { get; set; }

Property Value

bool

UseSurrogates

If true then surrogate splits will be built. These splits allow to work with missing data and compute variable importance correctly. Default value is false.

public bool UseSurrogates { get; set; }

Property Value

bool

Methods

Create()

Creates the empty model.

public static DTrees Create()

Returns

DTrees

DisposeManaged()

Releases managed resources

protected override void DisposeManaged()

GetNodes()

Returns all the nodes. all the node indices are indices in the returned vector

public DTrees.Node[] GetNodes()

Returns

Node[]

GetRoots()

Returns indices of root nodes

public int[] GetRoots()

Returns

int[]

GetSplits()

Returns all the splits. all the split indices are indices in the returned vector

public DTrees.Split[] GetSplits()

Returns

Split[]

GetSubsets()

Returns all the bitsets for categorical splits. Split::subsetOfs is an offset in the returned vector

public int[] GetSubsets()

Returns

int[]

Load(string)

Loads and creates a serialized model from a file.

public static DTrees Load(string filePath)

Parameters

filePath string

Returns

DTrees

LoadFromString(string)

Loads algorithm from a String.

public static DTrees LoadFromString(string strModel)

Parameters

strModel string

he string variable containing the model you want to load.

Returns

DTrees