Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
jvandyck
Helper IV
Helper IV

Shap value visualization in power bi

Hi

I am trying to visualize the output of a prediction model.

I have features, and these features produce a probability of the target. The output also includes the shap value of each feature, meaning the influence it has on the probability of the target.

The visualisation looks like this:

jvandyck_0-1701441822546.png

Each line is a feature and each bubble represents an observation. The colors indicate the value of the feature. The influence is on the X-axis. 

EG. the first feature, seniority in company: red means higher seniority and blue means lower seniority. The chart shows that lower seniority has a positive impact on the probability of the target, whereas higher seniority has a negative impact.

I am not able to find a PBI visualisation capable of showing this? Any siuggestions? Anyone who has developed something alike in python and imported it in pbi?

23 REPLIES 23
jvandyck
Helper IV
Helper IV

We did get it working on power bi desktop using python visuals, using the shap package. However on PBI service it does not work, probably because the shap package is not supported on PBI service. I have posted an idea to include it: https://ideas.fabric.microsoft.com/ideas/idea/?ideaid=2e5526e6-50f6-ee11-a73d-000d3a7ade4a. Please vote for it!

qqqqqwwwweeerrr
Super User
Super User

HI @jvandyck 

 

Long back i have tried to create this but shap value is model output and even if you use python in power bi, i wont work because the libary does not suppurted by power bi. 

 

Not sure if current version of power bi able to install that libary, if not then it is not possible for create shap value visualisation with current capabilites. 

 

Regards

jvandyck
Helper IV
Helper IV

any update? Thanks!

Hey,

I'd be highly interested in a solution as well!

Has somebody achieved to visualize it?

@@jvandyck: Unfortunately, the sample data is not accessible anymore.

Best

jvandyck
Helper IV
Helper IV

anyone?

in your sample data what is the meaning of positive_probs ?

 

This is what I have so far.  Not sure how you are color coding and how you are sizing the bubbles.

 

lbendlin_1-1702659762487.png

 

 

This already looks pretty good!

The postive_probs col lists the probability of the predicted event. The _shap cols give an indication of the influence on the probability. This is what I would like to see on the X axis, as you already did. The thing missing is the color coding on each line, which would have to indicate the value itself. Let's take age as an example. The X axis shows the age_shap value. Color coding should be applied to the bubbles, based on the actual age of each observation. This way the graph would tell me eg whether high age has positive influence on the prediction. I hope this clarifies?

As you probably noticed I used a standard scatter plot visual. That unforunately doesn't allow dynamic color changes. But you should be able to accomplish that with Deneb.

I have never used Deneb and I looked at some examples and not sure I will be able to create it. Could you work out an example?

It's on my list of things to try. No promises.

No idea what I am doing here - please modify as needed.

Thanks....finally took a look at it.

The bubble size does not need to change. Each bubble is one ID.

The color scale should only change within each Attribute. This way I can see how higher eg ages influence the shap values.

I hope you can fix this....THANKS!

@dm-p How can I specify a color scale for each y value separately?

 

lbendlin_0-1705677512420.png

 

This requirement will be a tall order in Vega-Lite if you want to solve just with the encoding channels, as they might be too simplistic for a 2-dimensional assignment. It may need creative use of a scale for the y-values and then expressions to drive hue based on the value domain for each y grouping.

I have very little available bandwidth for community support questions right now due to the work needed on Deneb's backlog. As luck would have it, this week we've just started to highlight people in the community (including on this forum) who actively welcome questions and might be better placed to be more hands-on with specific requirements. As such, I'm tagging in @giammariam, who may have a creative solution for this.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Thanks @dm-p @for the tag in, and thanks @lbendlin for the work you've done thus far. 

 

@jvandyck, this looks like a fun and challenging visual to try to produce. Give me a little time to digest everything here. I will report back with any questions I have. Thanks!



Madison Giammaria
Proud to be a Super User 😄
LinkedIn

Do you frequently use Deneb to provide insights to your stakeholders? Have you considered sponsoring this free and open source custom visual? More info here!

Any progress on this challenging visual?

Hi @jvandyck. Not sure if you saw my reply on 1/21, but could you please provide the .pbix again? The link you posted before has expired.



Madison Giammaria
Proud to be a Super User 😄
LinkedIn

Do you frequently use Deneb to provide insights to your stakeholders? Have you considered sponsoring this free and open source custom visual? More info here!

sorry I missed that one....here is the link to the sample data: https://acerta-my.sharepoint.com/:x:/g/personal/joos_van_dyck_acerta_be/ETD25i7mnLxKhfR-QvPPWw4BengE... 

lbendlin
Super User
Super User

Does it have to be Python or can it be Vega Lite/Deneb too?

Sure...as long as it works 😉

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.