Hi,
thanks for your amazing package,I applied it to binary classification
however,I dont't know why the output value and base value are so weird
my model is LightGBM(python 3.7)
the shap_values1 is 2-d,when I input it into shap.force_plot directly,it errors
I guess it represend base value 0/1 respectively,so I chose shap_values1[1] as the first param in shap.force_plot,however,the output value was so weird,it should be range 0 from 1, could you give me some questions about it?
Thanks very much,I'm looking forward your rely!

in the link of "Census income classification with LightGBM (https://slundberg.github.io/shap/notebooks/tree_explainer/Census%20income%20classification%20with%20LightGBM.html)
I found the ouptput value in it is also negative (-8.43),how can it be explained?

Try add option : link = 'logit'
shap.force_plot( explainer.expected_value[1], shap_values[1][0,:], link = 'logit' )
wow锛宨t woks ,thank you very much!
By default we explain the log-odds margin output of LightGBM models since that is a good space for additivity of effects. If you want to explain the probability output you can use model_output='probability'. Using the link option of the force plot is another option that transforms the axes values from log odds to probability for plotting.
Thank you for your reply锛寃hen the output value of link = 'logit' not equal to original LightGBM's probability ,I realized it may not be correct.
However,I don't find the param of model_output='probability' in shap.force_plot and shap.TreeExplainer ,could you give me some hints?
Thank you very much!
I find it in shap.TreeExplainer however,it show errors
assert model_output == "margin", "Only margin model_output is supported for feature_dependence="tree_path_dependent""
AssertionError: Only margin model_output is supported for feature_dependence="tree_path_dependent"
model_output='probability' links to feature_dependence="independent",
feature_dependence="independent" links to data is background dataset
when I set data to my train_data,it still not work,showing
AttributeError: 'TreeEnsemble' object has no attribute 'values'
the code is as follows:
explainer = shap.TreeExplainer(model_top, data = X_test_top, model_output='probability')
how can I set 'data'?
I solved my problem ,it seems that model should be fit again.
I still have a confusion,my dataset is unbalanced,is about class 0:class 1=1:12, how to choose background dataset?
in the notion ,says "Anywhere from 100 to 1000 random background samples are good
sizes to use.",should I create a background dataset in class 0:class 1=1:12?
Thanks again!
The background dataset determines the prior expectation we have before seeing the data for the example we are explaining. So it normally makes sense to just use a random subsample of the training data. But sometimes you want to start with a different prior, like perhaps just those people who were accepted for a loan by the algorithm. That way you explain why people are different from those who got a loan, rather than why they are different from the training dataset.
thanks your explaination!
above mentioned
AssertionError: Only margin model_output is supported for feature_dependence="tree_path_dependent"
I find the reason is the category features leading to...
Most helpful comment
Try add option : link = 'logit'
shap.force_plot( explainer.expected_value[1], shap_values[1][0,:], link = 'logit' )