Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Highlighted
Level I

## JMP Automatic Surrogate creation

Hello all,

I am coding in an app using jsl (and yes, I know I can create a dashboard to do that :) ) and I am using surrogates. So far, the way it works is that I manually try out different types of surrogates (e.g. stepwise, NN, polynomials etc.) and according to my R2 and other available metrics, I decide which one to choose for each dependent variable of my analysis. My question is: is there a less manual way for JMP to automatically create surrogates, try different types out and keep the ones with the most accurate fit instead of me going ahead and creating the different types manually and choosing?

Thanks,

Eva

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Level III

## Re: JMP Automatic Surrogate creation

Hello Eva,

Please take a look at the following example:

``````dt = Open( "\$SAMPLE_DATA/Boston Housing.jmp" );
neural_fits = Neural(
Y( :chas ),
X( :crim, :indus, :nox, :rooms, :age, :distance, :radial ),
);
// =========== You need to modify the above for your specific problem
min_neurons = 5;
max_neurons = 10;
r2_list = {};
For( i=min_neurons, i<=max_neurons, i++,
neural_fits << Fit( NTanH( i ) )
);
For( i=1, i<=(max_neurons-min_neurons+1), i++,
r2_list = Insert( r2_list, ( neural_fits << ( Fit[i] << Get RSquare Validation ) )[1] )
);
best_r2_fit = Loc Max( Matrix( r2_list ) );
For( i=(max_neurons-min_neurons+1), i>=1, i--, // must be backwards because the fit numbers shift as you remove them
If( i != best_r2_fit,
neural_fits << ( Fit[i] << Remove Fit )
)
);``````

This script creates 6 different Neural models and makes a decision based on validation R2 to pick one. Insert some "show" statements here and there to see what's going on.

When you extend this to other methods, you'll have to find their specific commands to extract R2 information (or whatever metric you'd like to work with). This is specific to the neural platform. You can put together a more complicated logic if you want to vary the number of other types of activation functions or go into boosting etc.

Hope this helps and let me know if you have further questions.

What we see of the real world is not the unvarnished real world but a model of the real world, constructed so it is useful for dealing with the real world. —Richard Dawkins
Highlighted
Level III

## Re: JMP Automatic Surrogate creation

Hello Eva,

Please take a look at the following example:

``````dt = Open( "\$SAMPLE_DATA/Boston Housing.jmp" );
neural_fits = Neural(
Y( :chas ),
X( :crim, :indus, :nox, :rooms, :age, :distance, :radial ),
);
// =========== You need to modify the above for your specific problem
min_neurons = 5;
max_neurons = 10;
r2_list = {};
For( i=min_neurons, i<=max_neurons, i++,
neural_fits << Fit( NTanH( i ) )
);
For( i=1, i<=(max_neurons-min_neurons+1), i++,
r2_list = Insert( r2_list, ( neural_fits << ( Fit[i] << Get RSquare Validation ) )[1] )
);
best_r2_fit = Loc Max( Matrix( r2_list ) );
For( i=(max_neurons-min_neurons+1), i>=1, i--, // must be backwards because the fit numbers shift as you remove them
If( i != best_r2_fit,
neural_fits << ( Fit[i] << Remove Fit )
)
);``````

This script creates 6 different Neural models and makes a decision based on validation R2 to pick one. Insert some "show" statements here and there to see what's going on.

When you extend this to other methods, you'll have to find their specific commands to extract R2 information (or whatever metric you'd like to work with). This is specific to the neural platform. You can put together a more complicated logic if you want to vary the number of other types of activation functions or go into boosting etc.

Hope this helps and let me know if you have further questions.

What we see of the real world is not the unvarnished real world but a model of the real world, constructed so it is useful for dealing with the real world. —Richard Dawkins
Article Labels

There are no labels assigned to this post.