scikit-MTR


Namescikit-MTR JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/hengzhe-zhang/Scikit-MTR
SummaryA sklearn-compatible framework for multi-task regression in Python.
upload_time2023-10-09 22:52:16
maintainer
docs_urlNone
authorHengzhe Zhang
requires_python>=3.6
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ๐Ÿ›  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

```bash
pip install scikit-mtr
```

## โšก Quick Start

Get up and running with `scikit-mtr` in a flash:

```python
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:

```python
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 Tree
- `LR`: ๐Ÿ“ˆ Linear Regression
- `RF`: ๐ŸŒณ Random Forest
- `ET`: ๐Ÿƒ Extra Trees
- `MLP`: ๐Ÿง  Multi-layer Perceptron
- `MOKP`: ๐Ÿ”ฎ MOKP Regressor

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hengzhe-zhang/Scikit-MTR",
    "name": "scikit-MTR",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Hengzhe Zhang",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/a1/4d/a7c6666ac55013999681e5d3e469d779aa0656c0fbbc15abfc7e278ebd62/scikit-MTR-0.1.0.tar.gz",
    "platform": null,
    "description": "# \ud83d\udee0 scikit-mtr: Multi-Task Regression in Python\r\n\r\n`scikit-mtr` provides a framework for multi-task regression using popular regression algorithms and introduces a\r\nstacking method to combine different regressors for enhanced performance.\r\n\r\n## \ud83c\udf1f Features\r\n\r\n- \ud83d\udcca Support for multiple regressors: Decision Trees, Linear Regression, Random Forests, Extra Trees, MLP, and MOKP.\r\n- \ud83c\udfc6 Stacking method to combine predictions from various regressors.\r\n\r\n## \ud83d\udce6 Installation\r\n\r\n```bash\r\npip install scikit-mtr\r\n```\r\n\r\n## \u26a1 Quick Start\r\n\r\nGet up and running with `scikit-mtr` in a flash:\r\n\r\n```python\r\nfrom sklearn.model_selection import train_test_split\r\n\r\nfrom scikit_mtr.multi_output_tools import multi_output_regressor, load_data_by_sklearn\r\n\r\nparams = {\r\n    'regressor': 'LR',\r\n    'dataset': 41467,\r\n    'random_seed': 0\r\n}\r\n\r\n# Load and split data\r\nX, y = load_data_by_sklearn(params['dataset'])\r\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=params['random_seed'])\r\n\r\n# Initialize regressor\r\nmodel = multi_output_regressor(params['regressor'])\r\nmodel.fit(X_train, y_train)\r\n\r\n# \ud83c\udfaf Make predictions\r\ny_pred_test = model.predict(X_test)\r\n```\r\n\r\n## \ud83d\udcda Using Stacking\r\n\r\n`scikit-mtr` introduces a powerful stacking method where base regressors' predictions serve as features for\r\nmeta-regressors:\r\n\r\n```python\r\nfrom scikit_mtr.multi_output_stacking import MultiTargetRegressorStacking\r\n\r\nbase_regressors = [LinearRegression() for _ in range(y_train.shape[1])]\r\nmeta_regressors = [LinearRegression() for _ in range(y_train.shape[1])]\r\n\r\nstacker = MultiTargetRegressorStacking(base_regressors, meta_regressors)\r\nstacker.fit(X_train, y_train)\r\nstacked_predictions = stacker.predict(X_test)\r\nprint(stacked_predictions)\r\n```\r\n\r\n## \ud83e\uddea Supported Regressors\r\n\r\nCurrently, the following regressors are in our arsenal:\r\n\r\n- `DT`: \ud83c\udf32 Decision Tree\r\n- `LR`: \ud83d\udcc8 Linear Regression\r\n- `RF`: \ud83c\udf33 Random Forest\r\n- `ET`: \ud83c\udf43 Extra Trees\r\n- `MLP`: \ud83e\udde0 Multi-layer Perceptron\r\n- `MOKP`: \ud83d\udd2e MOKP Regressor\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A sklearn-compatible framework for multi-task regression in Python.",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/hengzhe-zhang/Scikit-MTR"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6225c22c5d0ae89e4e0545fb196b3e52c49f6730f7431ff8d47b9adac263e4f8",
                "md5": "528ab325828a30072317dd0f9c3988f3",
                "sha256": "daf2d0f0472bfef80bee38fff06268204739efd3c312d28dd9d101d46ca78707"
            },
            "downloads": -1,
            "filename": "scikit_MTR-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "528ab325828a30072317dd0f9c3988f3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 6418,
            "upload_time": "2023-10-09T22:52:13",
            "upload_time_iso_8601": "2023-10-09T22:52:13.104992Z",
            "url": "https://files.pythonhosted.org/packages/62/25/c22c5d0ae89e4e0545fb196b3e52c49f6730f7431ff8d47b9adac263e4f8/scikit_MTR-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a14da7c6666ac55013999681e5d3e469d779aa0656c0fbbc15abfc7e278ebd62",
                "md5": "a579d287b6888476debd64afbb278db8",
                "sha256": "ff3b4e9a624c5a289e85af761beeeeb82b2db6f17a1efb2027eb790e68249cdd"
            },
            "downloads": -1,
            "filename": "scikit-MTR-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a579d287b6888476debd64afbb278db8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4799,
            "upload_time": "2023-10-09T22:52:16",
            "upload_time_iso_8601": "2023-10-09T22:52:16.095895Z",
            "url": "https://files.pythonhosted.org/packages/a1/4d/a7c6666ac55013999681e5d3e469d779aa0656c0fbbc15abfc7e278ebd62/scikit-MTR-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-09 22:52:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hengzhe-zhang",
    "github_project": "Scikit-MTR",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "scikit-mtr"
}
        
Elapsed time: 0.28685s