Tree Methods

Tree Methods API Reference

Functions

(M::CART)(x)

This is a universal CART object predict function.

source
ClassificationTree(x, y; gainfn = entropy, maxdepth = 4, minbranchsize = 3)

Builds a CART object using either gini or entropy as a partioning method. Y must be a one hot encoded 2-Array. Predictions can be formed by calling the following function from the CART object: (M::CART)(x).

*Note: this is a purely nonrecursive decision tree. The julia compiler doesn't like storing structs of nested things. I wrote it the recursive way in the past and it was quite slow, I think this is true also of interpretted languages like R/Python...So here it is, nonrecursive tree's!

source
OneHotOdds(Y)

Calculates the odds of a one-hot formatted probability matrix. Returns a tuple.

source
RegressionTree(x, y; gainfn = ssd, maxdepth = 4, minbranchsize = 3)

Builds a CART object using ssd as a partioning method. Y must be a one column Array. Predictions can be formed by calling the following function from the CART object: (M::CART)(x).

*Note: this is a purely nonrecursive decision tree. The julia compiler doesn't like storing structs of nested things. I wrote it the recursive way in the past and it was quite slow, I think this is true also of interpretted languages like R/Python...So here it is, nonrecursive tree's!

source
entropy(v)

Calculates the Shannon-Entropy of a probability vector v. Returns a scalar. A common gain function used in tree methods.

source
gini(p)

Calculates the GINI coefficient of a probability vector p. Returns a scalar. A common gain function used in tree methods.

source
ssd(p)

Calculates the sum squared deviations from a decision tree split. Accepts a vector of values, and the mean of that vector. Returns a scalar. A common gain function used in tree methods.

source