I am currently working with the SHAP library, I already generated my charts with the avg contribution of each feature, however I would like to know the exact value that is ploted on the chart
import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression from sklearn.datasets import load_boston import shap boston = load_boston() regr = pd.DataFrame(boston.data) regr.columns = boston.feature_names regr['MEDV'] = boston.target X = regr.drop('MEDV', axis = 1) Y = regr['MEDV'] fit = LinearRegression().fit(X, Y) explainer = shap.LinearExplainer(fit, X, feature_dependence = 'independent') # I used 'independent' because the result is consistent with the ordinary # shapely values where `correlated' is not shap_values = explainer.shap_values(X) shap.summary_plot(shap_values, X, plot_type = 'bar')
How can I get the exact values that are depicted of the chart?
https://stackoverflow.com/questions/65837159/shap-library-python-how-to-get-the-shap-values-of-each-feature January 22, 2021 at 07:15AM
没有评论:
发表评论