A sklearn-compatible framework for multi-task regression in Python.
Project description
🛠 scikit-mtr: Multi-Task Regression in Python
scikit-mtr
provides a framework for multi-task regression using popular regression algorithms and introduces a
stacking method to combine different regressors for enhanced performance.
🌟 Features
- 📊 Support for multiple regressors: Decision Trees, Linear Regression, Random Forests, Extra Trees, MLP, and MOKP.
- 🏆 Stacking method to combine predictions from various regressors.
📦 Installation
pip install scikit-mtr
⚡ Quick Start
Get up and running with scikit-mtr
in a flash:
from sklearn.model_selection import train_test_split
from scikit_mtr.multi_output_tools import multi_output_regressor, load_data_by_sklearn
params = {
'regressor': 'LR',
'dataset': 41467,
'random_seed': 0
}
# Load and split data
X, y = load_data_by_sklearn(params['dataset'])
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=params['random_seed'])
# Initialize regressor
model = multi_output_regressor(params['regressor'])
model.fit(X_train, y_train)
# 🎯 Make predictions
y_pred_test = model.predict(X_test)
📚 Using Stacking
scikit-mtr
introduces a powerful stacking method where base regressors' predictions serve as features for
meta-regressors:
from scikit_mtr.multi_output_stacking import MultiTargetRegressorStacking
base_regressors = [LinearRegression() for _ in range(y_train.shape[1])]
meta_regressors = [LinearRegression() for _ in range(y_train.shape[1])]
stacker = MultiTargetRegressorStacking(base_regressors, meta_regressors)
stacker.fit(X_train, y_train)
stacked_predictions = stacker.predict(X_test)
print(stacked_predictions)
🧪 Supported Regressors
Currently, the following regressors are in our arsenal:
DT
: 🌲 Decision TreeLR
: 📈 Linear RegressionRF
: 🌳 Random ForestET
: 🍃 Extra TreesMLP
: 🧠 Multi-layer PerceptronMOKP
: 🔮 MOKP Regressor
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
scikit-MTR-0.1.0.tar.gz
(4.8 kB
view details)
Built Distribution
File details
Details for the file scikit-MTR-0.1.0.tar.gz
.
File metadata
- Download URL: scikit-MTR-0.1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff3b4e9a624c5a289e85af761beeeeb82b2db6f17a1efb2027eb790e68249cdd |
|
MD5 | a579d287b6888476debd64afbb278db8 |
|
BLAKE2b-256 | a14da7c6666ac55013999681e5d3e469d779aa0656c0fbbc15abfc7e278ebd62 |
File details
Details for the file scikit_MTR-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: scikit_MTR-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | daf2d0f0472bfef80bee38fff06268204739efd3c312d28dd9d101d46ca78707 |
|
MD5 | 528ab325828a30072317dd0f9c3988f3 |
|
BLAKE2b-256 | 6225c22c5d0ae89e4e0545fb196b3e52c49f6730f7431ff8d47b9adac263e4f8 |