Comments (3)
Hi @jckkvs,
Thank you for your feedback! I think what you're looking for is NativeLearnerInspector
(introduced in the latest release), which provides support for explaining native scikit-learn models:
from facet.inspection import NativeLearnerInspector
inspector = NativeLearnerInspector(
model=native_scikit_learn_model_instance,
n_jobs=-3
)
Let me know if it solves your issue.
from facet.
Thank you. I wasn't aware that there's already a feature called NativeLearnerInspector
. I'll definitely make use of it.
from facet.
Thank you. I was unable to find the demo code, so I am providing the code that worked in my environment.
# standard imports
import pandas as pd
from sklearn.model_selection import RepeatedKFold, GridSearchCV
# some helpful imports from sklearndf
from sklearndf.pipeline import RegressorPipelineDF
from sklearndf.regression import RandomForestRegressorDF
# relevant FACET imports
from facet.data import Sample
from facet.selection import LearnerSelector, ParameterSpace
from sklearn.datasets import load_diabetes
X,y = load_diabetes(return_X_y=True)
data = load_diabetes()
X = pd.DataFrame(X)
X.columns = data["feature_names"]
y = pd.DataFrame(y)
y.columns = ["target"]
diabetes_df = pd.concat([X,y], axis=1)
# create FACET sample object
diabetes_sample = Sample(observations=diabetes_df, target_name="target")
# create a (trivial) pipeline for a random forest regressor
from sklearn.ensemble import RandomForestRegressor
rfr = RandomForestRegressor(n_jobs=-1)
rfr.fit(X,y)
# fit the model inspector
from facet.inspection import NativeLearnerInspector
inspector = NativeLearnerInspector(
model=rfr,
n_jobs=-3
)
inspector.fit(diabetes_sample)
# visualise synergy as a matrix
from pytools.viz.matrix import MatrixDrawer
synergy_matrix = inspector.feature_synergy_matrix()
MatrixDrawer(style="matplot%").draw(synergy_matrix, title="Synergy Matrix")
# visualise redundancy as a matrix
redundancy_matrix = inspector.feature_redundancy_matrix()
MatrixDrawer(style="matplot%").draw(redundancy_matrix, title="Redundancy Matrix")
# visualise redundancy using a dendrogram
import matplotlib
from pytools.viz.dendrogram import DendrogramDrawer
redundancy = inspector.feature_redundancy_linkage()
DendrogramDrawer().draw(data=redundancy, title="Redundancy Dendrogram")
from facet.
Related Issues (20)
- Add methods to model inspector to return SHAP values and associated feature data
- Add a UnivariateTargetSimulator
- Expose full distribution of outputs on simulation results
- Mismatch of feature ordering (matrices vs. dendograms) HOT 1
- Racism and the "load_boston" dataset HOT 2
- Run times are huge HOT 9
- ModuleNotFoundError: No module named 'facet.data'; 'facet' is not a package HOT 2
- gamma-facet==1.0.1 not compatible with latest shap==0.38.1 HOT 2
- Future Implementation for Tensorflow and Pytorch HOT 2
- SHAP Feature Values Inverted HOT 4
- understanding synergy asymmetry HOT 3
- README.rs dataset load can be automated for users HOT 1
- cannot import LearnerInspector etc HOT 1
- Trouble importing LearnerInspector HOT 7
- 'LearnerRanker' object has no attribute '_ensure_fitted' HOT 2
- Isolated Sphinx doc does not build due to missing pytools script HOT 3
- Versioning & Compatibility XGBoost HOT 1
- Support SAGE values similar to SHAP
- How to calculate SRI for nonlinear models?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from facet.