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)
Run/Build locally
To run the project, you need Poetry. Once installed:
- Clone the repository.
- Run
poetry install. - The development environment is ready. You can test it by running
pytest.
TODO:
- Speed up the learning algorithm implementation (morfist is currently much slower than the Random Forest implementation available in scikit-learn)
Metadata
Release files for decision-tree-morfist 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| decision_tree_morfist-0.4.0.tar.gz | 14.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| decision_tree_morfist-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.4 kB
Release files / decision_tree_morfist-0.4.0.tar.gz
| Download URL | decision_tree_morfist-0.4.0.tar.gz |
|---|---|
| Size | 14.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c491f25b70ad4b47f4f73e5513e1634833ea4de021de4c13bf3902f2bdfaac4c
|
|
BLAKE2b-256 checksum How to use checksums |
0c08bcce4e3a1085d946537a75d53210c27dcfa2c73e8bbc0f1b83196bfdb83f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.3
|
Release files / decision_tree_morfist-0.4.0-py3-none-any.whl
| Download URL | decision_tree_morfist-0.4.0-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc0352b91f0119ff47d4872d920a5150aa0e2f0609ab4faadd8320055dc32dbf
|
|
BLAKE2b-256 checksum How to use checksums |
e812594831a844d904d20b60a601f384d777416d2cde48eefa24019ecdcc2fa8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.3
|