Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Model tuning - Optimization per line

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Apr 6, 2018 7:44 AM
(1550 views)

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

2 REPLIES 2

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Model tuning - Optimization per line