Multi-target Random Forest implementation that can mix both classification and regression tasks.
Project description
morfist: mixed-output-rf
Multi-target Random Forest implementation that can mix both classification and regression tasks.
Morfist implements the Random Forest algorithm (Breiman, 2001) with support for mixed-task multi-task learning, i.e., it is possible to train the model on any number of classification tasks and regression tasks, simultaneously. Morfist's mixed multi-task learning implementation follows that proposed by Linusson (2013).
- Breiman, L. (2001). Random forests. Machine learning, 45(1), 5-32.
- Linusson, H. (2013). Multi-output random forests.
Installation
With pip:
pip install decision-tree-morfist
With conda:
conda install -c systemallica decision-tree-morfist
Usage
Initialising the model
- Similarly to a scikit-learn RandomForestClassifier, a MixedRandomForest can be initialised in this way:
from morfist import MixedRandomForest
mrf = MixedRandomForest(
n_estimators=n_trees,
min_samples_leaf=1,
classification_targets=[0]
)
For more info on the possible parameters, visit the documentation.
Training the model
- Once the model is initialised, it can be fitted like this:
Where X are the training examples and Y are their respective labels(if they are categorical) or values(if they are numerical)mrf.fit(X, y)
Prediction
- The model can be now used to predict new instances.
- Class/value:
mrf.predict(x)
- Probability:
mrf.predict_proba(x)
TODO:
- Speed up the learning algorithm implementation (morfist is currently much slower than the Random Forest implementation available in scikit-learn)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for decision-tree-morfist-0.3.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d0fe1bee3a0daa2cc0ba5c62bbfbd75bbbe94aeaf7be6ed7dcd64927a82991a |
|
MD5 | 419c80e6771360687f1e9928de7f10ff |
|
BLAKE2b-256 | 2f0d51c23efec2d4d0ccf2c8cbec5f9d68df56b4bfd66594efe8c010bb49aa08 |
Close
Hashes for decision_tree_morfist-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8cbba3ff31affe77a76021c1fd5cd6b4419d21d8b3687aae76baab76e69ada7 |
|
MD5 | d9aba4bea204acf7816654e15169a8c5 |
|
BLAKE2b-256 | 650c443b3bc6a83d498e3e59dd4eb785f2575fd8e43b94a1f442cf5eb6fe2fe0 |