Skip to main content

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).

Installation

With pip:

pip install decision-tree-morfist

With conda:

conda install -c systemallica decision-tree-morfist

Usage

Initialising the model

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:
    mrf.fit(X, y)
    
    Where X are the training examples and Y are their respective labels(if they are categorical) or values(if they are numerical)

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:

  1. Clone the repository.
  2. Run poetry install.
  3. 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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

decision_tree_morfist-0.4.0.tar.gz (14.4 kB view hashes)

Uploaded Source

Built Distribution

decision_tree_morfist-0.4.0-py3-none-any.whl (13.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page