Mockingjay.DecisionTree protocol (Mockingjay v0.1.0)

A protocol for extracting decision trees from a model and getting information about the model.

This protocol can be used for any model that uses decision trees as its base model. As such, this can be used for both ensemble and single decision tree models. This protocol requires that the model implement the Mockingjay.Tree struct for representing decision trees. This protocol also requires that all decsision split conditions in the model are the same condition. The model does not need to be a perfect binary tree, but it must be a binary tree.

Link to this section Summary

Functions

Returns the condition used to split the data.

Returns the number of classes in the model.

Returns the number of features in the model.

Returns a list of Mockingjay.Tree struct representing the decision tree.

Link to this section Types

@type t() :: term()

Link to this section Functions

Link to this function

condition(data)

@spec condition(data :: any()) :: :greater | :less | :greater_equal | :less_equal

Returns the condition used to split the data.

Link to this function

num_classes(data)

@spec num_classes(data :: any()) :: pos_integer()

Returns the number of classes in the model.

Link to this function

num_features(data)

@spec num_features(data :: any()) :: pos_integer()

Returns the number of features in the model.

@spec trees(data :: any()) :: [Tree.t()]

Returns a list of Mockingjay.Tree struct representing the decision tree.