Decidex v0.0.2 Decidex View Source
A decision tree library for small datasets.
Link to this section Summary
Types
A value of some feature
.
A predicted or actual outcome for an example feature vector features
.
A decision tree.
A training dataset.
Functions
An example decision tree.
An example training dataset.
Learns a decision tree from training_data
.
Predicts the outcome for features
feature vector using decision_tree
.
Link to this section Types
feature()
View Source
feature() :: any()
feature() :: any()
A feature - a parameter of the data.
feature_value()
View Source
feature_value() :: any()
feature_value() :: any()
A value of some feature
.
features()
View Source
features() :: %{optional(feature()) => feature_value()}
features() :: %{optional(feature()) => feature_value()}
Represented as a map from feature
to corresponding feature_value
.
outcome()
View Source
outcome() :: any()
outcome() :: any()
A predicted or actual outcome for an example feature vector features
.
t()
View Source
t() ::
{feature(), %{optional(feature_value()) => t() | outcome()}} | outcome()
t() :: {feature(), %{optional(feature_value()) => t() | outcome()}} | outcome()
A decision tree.
Represented as a recursive data structure, each node of which can either be an outcome
,
or a tuple of a feature
and a map from all possible feature_value
s to subtrees or outcome
s.
training_data() View Source
A training dataset.
Represented as a list of tuples of features
(feature vectors) and outcome
s.
Link to this section Functions
example()
View Source
example() :: t()
example() :: t()
An example decision tree.
This is a slightly modified example from these slides.
example_training_data()
View Source
example_training_data() :: training_data()
example_training_data() :: training_data()
An example training dataset.
This is a slightly modified example from these slides.
learn(training_data, opts \\ [])
View Source
learn(training_data(), opts :: Keyword.t()) :: t()
learn(training_data(), opts :: Keyword.t()) :: t()
Learns a decision tree from training_data
.
You can switch learning algorithm using opts
parameter :algorithm
.
By default it's set to Decidex.LearningAlgorithms.ID3
.
Returns the learned decision tree.
predict(decision_tree, features) View Source
Predicts the outcome for features
feature vector using decision_tree
.
Returns an outcome
.