Subscribe Bookmark RSS Feed

Scripting the partition platform

vt_sailor

Occasional Contributor

Joined:

May 11, 2017

The partition platform is very good at splitting on parameters in a way that is correct from a statistical point of view but is not appropriate given domain knowledge of the dataset.  Now, I can't expect JMP to have domain knowledge, but I would like to script the partition platform so I can serve up the candidates JMP selects to the user so they can pick the one that makes sense given their domain knowledge AND is near the top of the list for splitting from a statistical point of view.  What I'm struggling with is how to rebuild the tree after the user makes their choice.  I've tried several iterations of viewing the script after various splits and I just can't seem to grasp the structure.  Has anyone figured this out?

 

Thank you

Ray

4 REPLIES
ian_jmp

Staff

Joined:

Jun 23, 2011

You might want to use domain knowledge to 'lock columns'. Here's the example from 'Help > Scripting Index':

Names Default To Here( 1 );
obj = Open( "$SAMPLE_DATA/Car Poll.jmp" ) <<
Partition(
	Y( :country ),
	X( :sex, :marital status, :age, :type, :size )
);
obj << Lock Columns( 1, :age, :size );
(obj << report)[CheckboxBox( 1 )] << Select;
Wait( .5 );
obj << Lock Columns( 0 );
Wait( .5 );
obj << Lock Columns( 1 );

Generally the Scripting Index is a great place to start if you need to figure something out.

vt_sailor

Occasional Contributor

Joined:

May 11, 2017

ian_jmp,

Thank you for responding to my question. The problem is that I need to
erase and re-create the tree each time a user selects a split. What I'm
doing is cracking the candidates table and then popping up a window showing
box and trend plots for each of the top nn candidates. The user than
selects the one they like the best. The best would be if JMP would let me
feed in the choice and "click on" the split-specific option.
Unfortunately--according to JMP support--this is not possible. It's adding
the additional capability to aid in selecting among the candidates that
drives the need to rebuild the tree. It would be best if I could
completely take over the platform so the user didn't have to use any of the
split / prune , red triangle drop-down buttons.
Dan_Obermiller

Joined:

Apr 3, 2013

Here is a script from a tree where two specific (non-optimal) splits were made:

 

Partition(
   Y( :Oxy ),
   X( :Age, :Weight, :Runtime, :RunPulse, :RstPulse, :MaxPulse ),
   Informative Missing( 1 ),
   Initial Splits( :Age >= 45, {}, {:RstPulse >= 60} ),
   SendToReport(
      Dispatch( {}, "Partition Report", FrameBox, {Frame Size( 480, 56 )} ),
      Dispatch( {}, "Candidates", OutlineBox, {Close( 0 )} )
)
);

 

It looks like all previous splits are just listed in the Initial Splits part of the code. The first split would be on the variable :Age for my example. Then for the >=45 group, there is no further split (the empty brackets). For Age < 45, that branch is split by :RstPulse. If the next split were on the :RstPulse leaf, then it would be {:RstPulse>=60, {newvar >= value}}.

 

I hope this helps.

Dan Obermiller
ian_jmp

Staff

Joined:

Jun 23, 2011

I can imagine that it would be possible to write a UI that uses 'Partition' in the background but keeps its report hidden. This may or may not be a lot of work, depending on what functionality you want, and what workflow you want to support.

Generally, in trying to 'take over' platforms that are designed for interactive use, some things are possible and some are not.

Not sure if it helps but, if you could train users to press an 'update' button you could do this kind of thing:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Car Poll.jmp" );
par = dt << Partition(
					Y( :country ),
					X( :sex, :marital status, :age, :type, :size )
					);
parRep = Report(par);
parRep[ListBox(4)] << prepend(ButtonBox("Update", updateScript));
updateScript =
Expr(
	Beep();
	setClipboard("");
	par << copyScript;
	treeSoFar = Parse(getClipboard());
	treeSoFar;
);

'updateScript' caould take any action possible in JSL (and here it just duplicates the existing report).