
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
.. image:: https://img.shields.io/pypi/v/eli5.svg :target: https://pypi.python.org/pypi/eli5 :alt: PyPI Version
.. image:: https://github.com/eli5-org/eli5/actions/workflows/python-package.yml/badge.svg?branch=master :target: https://github.com/eli5-org/eli5/actions :alt: Build Status
.. image:: https://codecov.io/github/TeamHG-Memex/eli5/coverage.svg?branch=master :target: https://codecov.io/github/TeamHG-Memex/eli5?branch=master :alt: Code Coverage
.. image:: https://readthedocs.org/projects/eli5/badge/?version=latest :target: https://eli5.readthedocs.io/en/latest/?badge=latest :alt: Documentation
ELI5 is a Python package which helps to debug machine learning classifiers and explain their predictions.
.. image:: https://raw.githubusercontent.com/eli5-org/eli5/refs/heads/master/docs/source/static/readme-show-prediction.png :alt: explain_prediction for text data
.. image:: https://raw.githubusercontent.com/eli5-org/eli5/refs/heads/master/docs/source/static/gradcam-catdog.png :alt: explain_prediction for image data
.. image:: https://raw.githubusercontent.com/eli5-org/eli5/refs/heads/master/docs/source/static/readme-show-weights.png :alt: explain_weights for text data
It provides support for the following machine learning frameworks and packages:
scikit-learn_. Currently ELI5 allows to explain weights and predictions of scikit-learn linear classifiers and regressors, print decision trees as text or as SVG, show feature importances and explain predictions of decision trees and tree-based ensembles. ELI5 understands text processing utilities from scikit-learn and can highlight text data accordingly. Pipeline and FeatureUnion are supported. It also allows to debug scikit-learn pipelines which contain HashingVectorizer, by undoing hashing.
Keras_ - explain predictions of image classifiers via Grad-CAM visualizations.
xgboost_ - show feature importances and explain predictions of XGBClassifier, XGBRegressor and xgboost.Booster.
LightGBM_ - show feature importances and explain predictions of LGBMClassifier, LGBMRegressor and lightgbm.Booster.
CatBoost_ - show feature importances of CatBoostClassifier, CatBoostRegressor and catboost.CatBoost.
lightning_ - explain weights and predictions of lightning classifiers and regressors.
sklearn-crfsuite_. ELI5 allows to check weights of sklearn_crfsuite.CRF models.
OpenAI_ python client. ELI5 allows to explain LLM predictions with token probabilities.
ELI5 also implements several algorithms for inspecting black-box models
(see Inspecting Black-Box Estimators
_):
Permutation importance
_ method can be used to compute feature importances
for black box estimators.Explanation and formatting are separated; you can get text-based explanation
to display in console, HTML version embeddable in an IPython notebook
or web dashboards, a pandas.DataFrame
object if you want to process
results further, or JSON version which allows to implement custom rendering
and formatting on a client.
.. _lightning: https://github.com/scikit-learn-contrib/lightning .. _scikit-learn: https://github.com/scikit-learn/scikit-learn .. _sklearn-crfsuite: https://github.com/scrapinghub/sklearn-crfsuite .. _LIME: https://eli5.readthedocs.io/en/latest/blackbox/lime.html .. _TextExplainer: https://eli5.readthedocs.io/en/latest/tutorials/black-box-text-classifiers.html .. _xgboost: https://github.com/dmlc/xgboost .. _LightGBM: https://github.com/Microsoft/LightGBM .. _Catboost: https://github.com/catboost/catboost .. _Keras: https://keras.io/ .. _Permutation importance: https://eli5.readthedocs.io/en/latest/blackbox/permutation_importance.html .. _Inspecting Black-Box Estimators: https://eli5.readthedocs.io/en/latest/blackbox/index.html .. _OpenAI: https://github.com/openai/openai-python
License is MIT.
Check docs <https://eli5.readthedocs.io/>
_ for more.
.. note::
This project was previously developed at https://github.com/TeamHG-Memex/eli5/
with support from Hyperion Gray <https://www.hyperiongray.com>
_.
eli5-permutation-importance
);eli5.explain_weights_df
,
eli5.explain_weights_dfs
, eli5.explain_prediction_df
,
eli5.explain_prediction_dfs
,
eli5.format_as_dataframe <eli5.formatters.as_dataframe.format_as_dataframe>
and eli5.format_as_dataframes <eli5.formatters.as_dataframe.format_as_dataframes>
functions allow to export explanations to pandas.DataFrames;eli5.explain_prediction
now shows predicted class for binary
classifiers (previously it was always showing positive class);eli5.explain_prediction
supports targets=[<class>]
now
for binary classifiers; e.g. to show result as seen for negative class,
you can use eli5.explain_prediction(..., targets=[False])
;eli5.explain_prediction
and eli5.explain_weights
for libsvm-based linear estimators from sklearn.svm: SVC(kernel='linear')
(only binary classification), NuSVC(kernel='linear')
(only
binary classification), SVR(kernel='linear')
, NuSVR(kernel='linear')
,
OneClassSVM(kernel='linear')
;eli5.explain_weights
for LightGBM_ estimators in Python 2 when
importance_type
is 'split' or 'weight';eli5.explain_prediction
for recent LightGBM_ versions;eli5.explain_weights
and eli5.explain_prediction
works with xgboost.Booster, not only with sklearn-like APIs;eli5.formatters.as_dict.format_as_dict
is now available as
eli5.format_as_dict
;eli5.explain_weights
for XGBoost models trained on
pandas.DataFrame;eli5.explain_weights
for LightGBM models trained on
pandas.DataFrame;eli5.explain_prediction
for XGBoost
models trained on pandas.DataFrame when feature names contain dots;eli5.explain_prediction
for
xgboost, sklearn, LightGBM and lightning.eli5.explain_weights
:
it is now possible to pass a Pipeline object directly. Curently only
SelectorMixin-based transformers, FeatureUnion and transformers
with get_feature_names
are supported, but users can register other
transformers; built-in list of supported transformers will be expanded
in future. See sklearn-pipelines
for more.eli5.sklearn.unhashing.invert_hashing_and_fit
.
See sklearn-unhashing
.eli5.explain_weights
for Lasso regression with a single
feature and no intercept.eli5.explain_prediction
and
eli5.explain_weights
are now supported for
LGBMClassifier
and LGBMRegressor
(see eli5 LightGBM support <library-lightgbm>
)... _LightGBM: https://github.com/Microsoft/LightGBM
eli5.xgboost.explain_prediction_xgboost
eli5.explain_prediction
: new 'top_targets' argument allows
to display only predictions with highest or lowest scores;eli5.explain_weights
allows to customize the way feature importances
are computed for XGBClassifier and XGBRegressor using importance_type
argument (see docs for the eli5 XGBoost support <library-xgboost>
);eli5.explain_weights
uses gain for XGBClassifier and XGBRegressor
feature importances by default; this method is a better indication of
what's going, and it makes results more compatible with feature importances
displayed for scikit-learn gradient boosting methods.eli5.explain_prediction
works for XGBClassifier, XGBRegressor
from XGBoost and for ExtraTreesClassifier, ExtraTreesRegressor,
GradientBoostingClassifier, GradientBoostingRegressor,
RandomForestClassifier, RandomForestRegressor, DecisionTreeClassifier
and DecisionTreeRegressor from scikit-learn.
Explanation method is based on
http://blog.datadive.net/interpreting-random-forests/ .eli5.explain_weights
now supports tree-based regressors from
scikit-learn: DecisionTreeRegressor, AdaBoostRegressor,
GradientBoostingRegressor, RandomForestRegressor and ExtraTreesRegressor.eli5.explain_weights
works for XGBRegressor;TextExplainer <lime-tutorial>
class allows to explain predictions
of black-box text classification pipelines using LIME algorithm;
many improvements in eli5.lime <eli5-lime>
.sklearn.pipeline.FeatureUnion
support in
eli5.explain_prediction
;eli5.explain_weights
and eli5.explain_prediction
support
more linear estimators from scikit-learn: HuberRegressor, LarsCV, LassoCV,
LassoLars, LassoLarsCV, LassoLarsIC, OrthogonalMatchingPursuit,
OrthogonalMatchingPursuitCV, PassiveAggressiveRegressor,
RidgeClassifier, RidgeClassifierCV, TheilSenRegressor.eli5.explain_weights
supports feature_filter
in addition
to feature_re
for filtering features, and eli5.explain_prediction
now also supports both of these arguments;eli5.explain_prediction
;show_feature_values=True
formatter argument allows to display
input feature values;XGBoost <https://github.com/dmlc/xgboost>
__
package);eli5.explain_weights
support for sklearn OneVsRestClassifier;sklearn-crfsuite <https://github.com/TeamHG-Memex/sklearn-crfsuite>
__
support;lightning <https://github.com/scikit-learn-contrib/lightning>
__ support;eli5.show_weights
and eli5.show_prediction
functions;eli5.explain_weights
and eli5.explain_prediction
functions;eli5.lime <eli5-lime>
improvements: samplers for non-text data,
bug fixes, docs;feature_re
argument allows to show only a subset of features;target_names
argument allows to change display names of targets/classes;targets
argument allows to show a subset of targets/classes and
change their display order;explain_prediction
can be a tuple (num_positive, num_negative);Pre-release.
FAQs
Debug machine learning classifiers and explain their predictions
We found that eli5 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.