How can I have a script save model parameters?<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />I'm running JMP Pro 11.
I'm working on a project that involves fitting a lot of Gaussian processes. I wrote a script that reads in a set of data files, fits a Gaussian process to each one, makes predictions on another dataset, then writes the predictions to a file.
But now I want to save the model parameters (mu, sigma squared, theta) and write them to a separate file as well. How can I do this? First the model is created, gp. Then I want to save the model report. By hand I can do Edit > Copy as text, paste it into another file and save it. I can post process it to get the parameters out, although it isn't ideal. How can I have a script do this? Here's the code I have now:
gp = Gaussian Process( Y( :y ), X( ), Set Correlation Function( "Cubic" ) ); // that should be a : x, not a smiley face
gp << Save( ); // doesn't work
I couldn't get Save or Save Text File to work. I also tried some variations on Main Menu("Copy as text"), but I couldn't get that to work either.
Thanks for any help.
Re: How can I have a script save model parameters?Thanks Ron! The Report parameters NumberColBox command was exactly what I needed and I am in the process of adjusting the code for use in my own script.
Re: How can I have a script save model parameters?hi Jazz,
your question involves a few issues.
if you want to keep results of many processes it could be useful not to save the output of each run but rather extract the values into a data table and save that.
the following may not be the most sleek solution but it will give you an idea of what you may be looking into:
// creat a new empty table to house the results
ntd = New table ("parametes", add rows (5));
New column ("mu");
New column ("sig2");
New column ("theta");
for (i=1, i<=5, i++,
// open a data table
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
wait (0);
// run the gaussian process
parameters = gp = Gaussian Process( Y( :height), X( :weight ), Set Correlation Function( "Cubic" ) );
// extract the parameters from the report
mu = Report (parameters) [NumberColBox(5)] [1];
sig2 = Report (parameters) [NumberColBox(6)] [1];
theta = Report (parameters) [NumberColBox(1)] [1];
// put the values in the new table
ntd:mu[i] = mu;
ntd:sig2 [i] = sig2;
ntd:theta [i] = theta;
close (dt, nosave);
wait (1);
);
the loop is just a way of doing this many times and accumulating results, obviusly there is no point of reproducing the same results again and again.
hope this helps,
ron