# RIM-interpret
RIM-interpret is a Python package designed to enhance the interpretability of machine learning models.
## Installation
Use pip to install RIM-interpret.
## Usage
RIM-interpret is compatible with most linear and tree-based regression models. In the future, we hope to expand the compatibility to inlcude more regression models and an option for classification tasks.
```python
import RIM_interpret
import sklearn
import pandas as pd
from sklearn import datasets
from sklearn.linear_model import ElasticNet
from sklearn.model_selection import train_test_split
#Import example dataset and convert to pandas df
data = datasets.load_diabetes()
df = pd.DataFrame(data.data, columns=data.feature_names)
df['target'] = data.target
print(df.head())
#Predictors
X=df.drop("target", axis=1)
#Target
y=df["target"]
#Train/test split
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.3, random_state=42)
#Train elastic net regression model
en_model = ElasticNet(alpha = 0.1, l1_ratio = 0.5)
fit_en = en_model.fit(X_train, y_train)
#Create dataframes to test
pfi_df_en = RIM_interpret.get_pfi(fit=fit_en, X_test=X_test, y_test=y_test)
shap_df_en = RIM_interpret.get_shap(fit=fit_en, X_test=X_test, model_type="Linear")
lime_df_en = RIM_interpret.get_lime(fit=fit_en, X_train=X_train, X_test=X_test)
inter_df_en = RIM_interpret.get_inter(fit=fit_en, X_train=X_train, X_test=X_test, y_test=y_test model_type="Linear")
```
## Contributing
Please create a GitHub issue for any bugs or questions (https://github.com/xloffree/RIM-interpret).
## License
[MIT](https://choosealicense.com/licenses/mit/)
Raw data
{
"_id": null,
"home_page": "",
"name": "RIM-interpret",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "interpretability,lime,machine learning,modelling,omics,permutation feature importance,rim,shap",
"author": "",
"author_email": "Xavier Loffree <Xavix500@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/25/bb/d7179e7cc428e3d715bc7130a7bef264fe6446d3ac8d0e6a95a7171e7ee4/rim_interpret-0.0.5.tar.gz",
"platform": null,
"description": "# RIM-interpret\n\nRIM-interpret is a Python package designed to enhance the interpretability of machine learning models.\n\n## Installation\n\nUse pip to install RIM-interpret.\n\n## Usage\n\nRIM-interpret is compatible with most linear and tree-based regression models. In the future, we hope to expand the compatibility to inlcude more regression models and an option for classification tasks.\n\n```python\nimport RIM_interpret\n\nimport sklearn\nimport pandas as pd\nfrom sklearn import datasets\nfrom sklearn.linear_model import ElasticNet\nfrom sklearn.model_selection import train_test_split\n\n\n#Import example dataset and convert to pandas df\ndata = datasets.load_diabetes()\ndf = pd.DataFrame(data.data, columns=data.feature_names)\ndf['target'] = data.target\nprint(df.head())\n#Predictors\nX=df.drop(\"target\", axis=1)\n#Target\ny=df[\"target\"]\n\n#Train/test split\nX_train, X_test, y_train, y_test = train_test_split(\n X, y, test_size=0.3, random_state=42)\n\n\n#Train elastic net regression model\nen_model = ElasticNet(alpha = 0.1, l1_ratio = 0.5)\nfit_en = en_model.fit(X_train, y_train)\n#Create dataframes to test\npfi_df_en = RIM_interpret.get_pfi(fit=fit_en, X_test=X_test, y_test=y_test)\nshap_df_en = RIM_interpret.get_shap(fit=fit_en, X_test=X_test, model_type=\"Linear\")\nlime_df_en = RIM_interpret.get_lime(fit=fit_en, X_train=X_train, X_test=X_test)\ninter_df_en = RIM_interpret.get_inter(fit=fit_en, X_train=X_train, X_test=X_test, y_test=y_test model_type=\"Linear\")\n\n```\n\n## Contributing\n\nPlease create a GitHub issue for any bugs or questions (https://github.com/xloffree/RIM-interpret).\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)",
"bugtrack_url": null,
"license": "",
"summary": "Interpretability metrics for machine learning models",
"version": "0.0.5",
"project_urls": {
"Bug Tracker": "https://github.com/xloffree/RIM-interpret/issues",
"Homepage": "https://github.com/xloffree/RIM-interpret"
},
"split_keywords": [
"interpretability",
"lime",
"machine learning",
"modelling",
"omics",
"permutation feature importance",
"rim",
"shap"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "348f27d4b90496de11a10b54a7a1f70f270b02c4a9f8c40a20437bd1a597f1e6",
"md5": "6feb2770d463171fa28cfd9df0b28034",
"sha256": "e4ea1cf7563cfb0e80fd8c3cebb7353a66e41333129a64df48f50d1acaf34f90"
},
"downloads": -1,
"filename": "rim_interpret-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6feb2770d463171fa28cfd9df0b28034",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 4586,
"upload_time": "2023-08-21T04:01:16",
"upload_time_iso_8601": "2023-08-21T04:01:16.270267Z",
"url": "https://files.pythonhosted.org/packages/34/8f/27d4b90496de11a10b54a7a1f70f270b02c4a9f8c40a20437bd1a597f1e6/rim_interpret-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "25bbd7179e7cc428e3d715bc7130a7bef264fe6446d3ac8d0e6a95a7171e7ee4",
"md5": "636ad18028328a7417b0027ec132f55b",
"sha256": "08f36bef5a6134ffbfc2e11a414b4485a888a092ed007aa1082df7aab7632687"
},
"downloads": -1,
"filename": "rim_interpret-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "636ad18028328a7417b0027ec132f55b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4821,
"upload_time": "2023-08-21T04:01:17",
"upload_time_iso_8601": "2023-08-21T04:01:17.780226Z",
"url": "https://files.pythonhosted.org/packages/25/bb/d7179e7cc428e3d715bc7130a7bef264fe6446d3ac8d0e6a95a7171e7ee4/rim_interpret-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-21 04:01:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "xloffree",
"github_project": "RIM-interpret",
"github_not_found": true,
"lcname": "rim-interpret"
}