cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar

SHAP Values on Graph Builder- Ascending order

I am in the process of graphing SHAP Values from the profiler. As you can see on the image, the SHAP values are not in either ascending order or descending order? First, how do I instruct for the graph builder to graph the scatter plot/beeswarm plot to output in ascending order for all of the independent variables (together) in one plot? This way, I can look at one plot that shows the variable with the highest impact compared to all others.

Second, is there a way to change the legend so it shows there's a continuum for the legend instead of a marker? The continuum should go from high to low shap values.

 

Thank you,

Nisha

3 REPLIES 3
hogi
Level XII

Re: SHAP Values on Graph Builder- Ascending order

Is is OK for you to stack the data?
Then you can use "order by" via a manually calculated column:

hogi_0-1727114434025.png

 



dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );
dtstacked = dt  << Stack(
	columns( Column Group( "Processes" ) ));

dtstacked << New Column( "median",
	Formula( Col Quantile( :Processes, 0.5, :Label ) ),

)	;
	
	
dtstacked<< 	Graph Builder(
	Variables( X( :Processes ), Y( :Label, Order By( :median ) ) ),
	Elements( Box Plot( X, Y, Legend( 13 ) ) ),
	Local Data Filter(
		Add Filter(
			columns( :Label ),
			Where( :Label == {"A1", "A2N", "A2P", "A2P1", "B1", "B10", "CAP"} )
		)
	)
);


 

Re: SHAP Values on Graph Builder- Ascending order

Thank you, I will try this. I was hoping to be able to construct this using the graph builder itself, but its looking less possible.

 

hogi
Level XII

Re: SHAP Values on Graph Builder- Ascending order

In JMP there are always multiple ways to get where you want : )
Another alternative: sort the columns with ascending order of the values.
When you know the order, this can easily be done via "group".

Just open Graph builder and drag the group "sorted" onto the Y axis.
Up to 14 columns are possible till JMP changes the mode to "parallel plot".

Names Default to HERE(1);

showN Cols = 14;
Try(close(dt, noSave));
dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );


dtstacked = dt  << Stack(
	columns( Column Group( "Processes" ) ));
	
mysummary = dtstacked  << Summary(Group( :Label ),Median( :Processes ));

sorted = mysummary << Sort( By( :"Median(Processes)"n ), Order( Descending ) );

mycols = sorted[1::showNCols,"Label"];
dt << Group Columns( "sorted", mycols );