
Security News
Insecure Agents Podcast: Certified Patches, Supply Chain Security, and AI Agents
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.
treeinterpreter
Advanced tools
Package for interpreting scikit-learn's decision tree and random forest predictions.
Package for interpreting scikit-learn's decision tree and random forest predictions.
Allows decomposing each prediction into bias and feature contribution components as described in http://blog.datadive.net/interpreting-random-forests/. For a dataset with n features, each prediction on the dataset is decomposed as prediction = bias + feature_1_contribution + ... + feature_n_contribution.
It works on scikit-learn's
Free software: BSD license
The easiest way to install the package is via pip::
$ pip install treeinterpreter
::
from treeinterpreter import treeinterpreter as ti
rf = RandomForestRegressor() rf.fit(trainX, trainY)
prediction, bias, contributions = ti.predict(rf, testX)
Prediction is the sum of bias and feature contributions::
assert(numpy.allclose(prediction, bias + np.sum(contributions, axis=1))) assert(numpy.allclose(rf.predict(testX), bias + np.sum(contributions, axis=1)))
More usage examples at http://blog.datadive.net/random-forest-interpretation-with-scikit-learn/.
FAQs
Package for interpreting scikit-learn's decision tree and random forest predictions.
We found that treeinterpreter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.

Security News
The planned feature introduces a review step before releases go live, following the Shai-Hulud attacks and a rocky migration off classic tokens that disrupted maintainer workflows.