cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
shrirams
Level III

Question about how to use fit object for prediction in JSL

Hi - I have 2 columns X and Y. I am using the Neural platform to fit Y with X, because it is quite non-linear. Now, I want to use the fitted model to predict Y for a given X. How do I accomplish this in JSL?

 

I have the following code:

obj = dt << Neural(
Y( :Vg ),
X( :Id ),
Informative Missing( 0 ),
Validation Method( "Holdback", 0.3333 )
);

After I have done the fit, I need to use this fit object to predict Y for certain values of X in another table. But, I am not sure how I can write JSL for that. Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Question about how to use fit object for prediction in JSL

From the neural platform you can save the formula to your table

jthi_0-1708977045434.png

and move it (or all of them, depending on your model) to other table if both have similarly named columns. Below is one example script

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

nn = dt << Neural(
	Y(:sex),
	X(:height, :weight),
	Informative Missing(0),
	Validation Method("Holdback", 0.3333),
	Fit(NTanH(3))
);

cur_cols = dt << Get Column Names("String");
nn << (Fit[1] << Save Profile Formulas);
new_cols = dt << Get Column Names("String");

Remove From(new_cols, 1, N Items(cur_cols));

dt2 = Open("$SAMPLE_DATA/Big Class Families.jmp");

For Each({colname}, new_cols,
	colscript = Column(dt, colname) << get script;
	Eval(EvalExpr(
		Send(dt2, Expr(colscript));
	));
);

 

If you have JMP Pro you can also use Formula Depot which makes this maybe a bit easier.

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Question about how to use fit object for prediction in JSL

From the neural platform you can save the formula to your table

jthi_0-1708977045434.png

and move it (or all of them, depending on your model) to other table if both have similarly named columns. Below is one example script

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

nn = dt << Neural(
	Y(:sex),
	X(:height, :weight),
	Informative Missing(0),
	Validation Method("Holdback", 0.3333),
	Fit(NTanH(3))
);

cur_cols = dt << Get Column Names("String");
nn << (Fit[1] << Save Profile Formulas);
new_cols = dt << Get Column Names("String");

Remove From(new_cols, 1, N Items(cur_cols));

dt2 = Open("$SAMPLE_DATA/Big Class Families.jmp");

For Each({colname}, new_cols,
	colscript = Column(dt, colname) << get script;
	Eval(EvalExpr(
		Send(dt2, Expr(colscript));
	));
);

 

If you have JMP Pro you can also use Formula Depot which makes this maybe a bit easier.

-Jarmo
shrirams
Level III

Re: Question about how to use fit object for prediction in JSL

Hi - thanks a lot for providing the example script. Could you explain how I can modify if my column name in the other table is different? Also, could you please clarify how the JSL will change if I have Formula Depot? Thanks again!