Choose Language Hide Translation Bar
Highlighted
lwx228
Level VII

When the decision tree operation is completed, can JSL be used to save "save prediction formula"?

Hello, everyone!

2018-10-02_16-06-50.png

 

I did step 1 first: manually click "GO" in the menu interface of the window and wait for the completion of decision tree operation.


I want to use JSL for the next step: how do code JSL to save the window menu operation to "save prediction formula" in the data table?Thank you very much!

 


p<<save prediction formula;

4 REPLIES 4
Highlighted
txnelson
Super User

Re: When the decision tree operation is completed, can JSL be used to save "save prediction for

Here is the example from the Scripting Indix for the Partition Platform for Saving Prediction Formula

     Help==>Scripting Index...............Partition==>Save Predicion Formula

savepred.PNG

Names Default To Here( 1 );
obj = Open( "$SAMPLE_DATA/Boston Housing.jmp" ) <<
Partition(
	Y( :mvalue ),
	X(
		:crim,
		:zn,
		:indus,
		:chas,
		:nox,
		:rooms,
		:age,
		:distance,
		:radial,
		:tax,
		:pt,
		:b,
		:lstat
	),
	Split Best( 4 )
);
obj << Save Prediction Formula;
Jim
Highlighted
lwx228
Level VII

Re: When the decision tree operation is completed, can JSL be used to save "save prediction for

Thank Jim!


This time, I have a special requirement that I do not want to use JSL to automatically make the decision tree, but only use JSL to copy the formula behind the decision tree.

Or another way of asking:
A table and a decision tree window are now opened. The name of the table is not necessarily Boston housing.jmp.
How do I get the names of these two files with JSL?Thank you very much!I will not use JSL to get another file name that is not the current interface.
Highlighted
gzmorgan0
Super User

Re: When the decision tree operation is completed, can JSL be used to save "save prediction for

This might be more generic than what I think you requested. Jim might have a better solution.  Note the syntax to get the scrciptable object in case you want to sen messages to the Partition object.  This assumes only one partition window  and gets the first one.

Names Default to Here(1);

rptList = Get WindowList("Reports");
  
//Assuming one partition
For(i=1, i<=nitems(rptList), i++,
    ttl = rptList[i] << get window title;
	If (contains(ttl, "- Partition of"),
	    treeref = rptList[i];
	    dtref = (treeref[Outline Box(1)] <<  get scriptable object) << get data table; 
	    dtnme = dtref << get name;
	    varnme = Munger( ttl, 1, dtnme || " - Partition of ","");
	    Break(); 
	);
);

show(ttl, dtnme, varnme, treeref<<get window title);

func = column(dtref, varnme || " Predictor") << get formula;

show(func);

 

 

 

Highlighted
lwx228
Level VII

Re: When the decision tree operation is completed, can JSL be used to save "save prediction for

I seem to have mixed things up.I thought of another way.Thank you very much!
Article Labels

    There are no labels assigned to this post.