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

Model tuning - Optimization per line

Dear all,

 

I will first of all try to introduce with an example the problem I am facing. Imagine a table with 100 lines and 6 columns (PAR1, PAR2, VAR, MOD, MEA, ERR).

The column MOD contains a model (=a formula) that depends on 3 parameters P1, P2 and VAR.

The values of the columns P1 and P2 are fixed and different for each lines.

The column VAR contains the third parameters, which is initialized at a default value at the beginning (let's say 1). To give a concret example, let's imagine that MOD contains the following formula: MOD[i] = 3.P1[i]^3+COS(2.P2[i]^2+VAR[i]).

The column MEA contains the results of a measurement, different for each line.

And finaly, ERR contains the quadratic error between the model and the measurement, that is to say: ERR[i] = (MOD[i] - MEA[i])^2.

 

My target is to determine, for each line, the value of VAR[i] so that the value of the model is equal to the one of the measurement.

 

In Excel, I would use the Solver to do that. We can also imagine a JSL script in which, for each line, an algorithm (simple dichotomy, Newton, Brent, ...) will find the root of the function F[i] = MOD[i] - MEA[i] by minimizing the quantity ERR[i].

 

But, I am wondering if there is a simpler alternative to do that? With a JMP platform?

 

Waiting for your kind answer.

Stéphane

PS: Be indulgent for my first contribution/question in the community! :-)

1 ACCEPTED SOLUTION

Accepted Solutions
cwillden
Super User (Alumni)

Re: Model tuning - Optimization per line

 You could probably use minimize() on your desired cost function to get the optimal value of VAR, optimizing each row in a loop.  Here's how you might set something like that up:

dt = Current Data Table();
cost = expr(abs(3 * :PAR1[i] ^ 3 + Cos( 2 * :PAR1[i] ^ 2 + VAR1 ) - :MEA[i]));
for(i=1, i<=N Row(dt), i++,
	:VAR[i] = Minimize(cost,{VAR1(-5, 5)});
);

Since you are only optimizing 1 error (no need to minimize a sum of squared errors), you can just use the simpler cost function of the error without squaring.

There are many more arguments that you can use with minimize().  Also check out Constrained Minimize().  This seemed to work on my test table I set up and the errors were minimized as long as I put in a reasonable value for MEA.

-- Cameron Willden

View solution in original post

2 REPLIES 2
cwillden
Super User (Alumni)

Re: Model tuning - Optimization per line

 You could probably use minimize() on your desired cost function to get the optimal value of VAR, optimizing each row in a loop.  Here's how you might set something like that up:

dt = Current Data Table();
cost = expr(abs(3 * :PAR1[i] ^ 3 + Cos( 2 * :PAR1[i] ^ 2 + VAR1 ) - :MEA[i]));
for(i=1, i<=N Row(dt), i++,
	:VAR[i] = Minimize(cost,{VAR1(-5, 5)});
);

Since you are only optimizing 1 error (no need to minimize a sum of squared errors), you can just use the simpler cost function of the error without squaring.

There are many more arguments that you can use with minimize().  Also check out Constrained Minimize().  This seemed to work on my test table I set up and the errors were minimized as long as I put in a reasonable value for MEA.

-- Cameron Willden

Re: Model tuning - Optimization per line

Perfect! I did not know that these 2 functions - Minimize() and Constrained Minimize() - were existing. Thanks a lot for your help