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 plotted 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?
question from:
https://stackoverflow.com/questions/65837159/how-to-get-the-shap-values-of-each-feature 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…