Is shap compatible with PolynomialFeatures(degree=1)?

45 Views Asked by At

I am trying to plot shap.summary_plot for polynomial regression but it gives a dimension error

<class 'ValueError> shapes (12,) and (11,) are not aligned: 12(dim 0)!= 11(dim 0)
model = PolynomialFeatures(degree=1)

explainer = shap.Explainer(model = model, feature_names=df.columns,algorithm = 'auto')

when I try with LinearExplainer still getting the same error

explainer = shap.Explainer(model = model, algorithm = 'auto')
explainer = shap.LinearExplainer(model = model)


shap_values = explainer.shap_values(df)

I just want to know if shap is compatible with polynomial regression or not. And if it is compatible how to build the explainer

0

There are 0 best solutions below