cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
rummeln
Level I

Script to save prediction formula of PLS

Hello,

I'm using a script to run PLS on my data, but I'm having a hard time getting it to save the prediction formula & values into a column in the data sheet.  Is this possible?  Here's what I'm using so far:

Names Default To Here( 1 );
<
P = Partial Least Squares(
	Y( :Viability ),
	X( :Name( "976" ), :Name( "778" ), :Name( "973" ), ),
	Validation Method( None, Initial Number of Factors( 15 ) ),
	Fit( Method( NIPALS ), Number of Factors( 15 ) ), 

);
P << prediction formula;
>

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Script to save prediction formula of PLS

Here is the example from the Scripting Index that shows how to Save Prediction Formula

txnelson_0-1659401558503.png

And here is an example using a slight modification to your code, and using the Semiconductor Capability sample data table

Names Default To Here( 1 );
dt =
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

P = Partial Least Squares(
	Y( :PNP1 ),
	X( :Name( "NPN1" ), :Name( "NPN2" ), :Name( "NPN3" ), ),
	Validation Method( None, Initial Number of Factors( 15 ) ),
	Fit( Method( NIPALS ), Number of Factors( 15 ) ), 

);
P << obj << (Fit[1] << Save Prediction Formula);
Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: Script to save prediction formula of PLS

Here is the example from the Scripting Index that shows how to Save Prediction Formula

txnelson_0-1659401558503.png

And here is an example using a slight modification to your code, and using the Semiconductor Capability sample data table

Names Default To Here( 1 );
dt =
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

P = Partial Least Squares(
	Y( :PNP1 ),
	X( :Name( "NPN1" ), :Name( "NPN2" ), :Name( "NPN3" ), ),
	Validation Method( None, Initial Number of Factors( 15 ) ),
	Fit( Method( NIPALS ), Number of Factors( 15 ) ), 

);
P << obj << (Fit[1] << Save Prediction Formula);
Jim
rummeln
Level I

Re: Script to save prediction formula of PLS

Worked like a charm, thanks Jim!

hogi
Level XII

Re: Script to save prediction formula of PLS

Is there a function to get the prediction formula from a fit as JSL code - without saving it to a column or using a Formula Depot?

Something more robust than

 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
myFit = dt << Fit Model( Y( :height ), Effects( :age, :sex ), Run() );
FormulaExpr=Arg(Arg(myFit << Get Prediction Formula,3))