<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Model tuning - Optimization per line in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Model-tuning-Optimization-per-line/m-p/54578#M30856</link>
    <description>&lt;P&gt;&amp;nbsp;You could probably use minimize() on your desired cost function to get the optimal value of VAR, optimizing each row in a loop.&amp;nbsp; Here's how you might set something like that up:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
cost = expr(abs(3 * :PAR1[i] ^ 3 + Cos( 2 * :PAR1[i] ^ 2 + VAR1 ) - :MEA[i]));
for(i=1, i&amp;lt;=N Row(dt), i++,
	:VAR[i] = Minimize(cost,{VAR1(-5, 5)});
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;There are many more arguments that you can use with minimize().&amp;nbsp; Also check out Constrained Minimize().&amp;nbsp; 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.&lt;/P&gt;</description>
    <pubDate>Fri, 06 Apr 2018 20:16:29 GMT</pubDate>
    <dc:creator>cwillden</dc:creator>
    <dc:date>2018-04-06T20:16:29Z</dc:date>
    <item>
      <title>Model tuning - Optimization per line</title>
      <link>https://community.jmp.com/t5/Discussions/Model-tuning-Optimization-per-line/m-p/54543#M30842</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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).&lt;/P&gt;&lt;P&gt;The column MOD contains a model (=a formula) that depends on 3 parameters P1, P2 and VAR.&lt;/P&gt;&lt;P&gt;The values of the columns P1 and P2 are fixed and different for each lines.&lt;/P&gt;&lt;P&gt;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]).&lt;/P&gt;&lt;P&gt;The column MEA contains the results of a measurement, different for each line.&lt;/P&gt;&lt;P&gt;And finaly, ERR contains the quadratic error between the model and the measurement, that is to say: ERR[i] = (MOD[i] - MEA[i])^2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, I am wondering if there is a simpler alternative to do that? With a JMP platform?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Waiting for your kind answer.&lt;/P&gt;&lt;P&gt;Stéphane&lt;/P&gt;&lt;P&gt;PS: Be indulgent for my first contribution/question in the community! :)&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 14:44:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Model-tuning-Optimization-per-line/m-p/54543#M30842</guid>
      <dc:creator>Steph_Georges</dc:creator>
      <dc:date>2018-04-06T14:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Model tuning - Optimization per line</title>
      <link>https://community.jmp.com/t5/Discussions/Model-tuning-Optimization-per-line/m-p/54578#M30856</link>
      <description>&lt;P&gt;&amp;nbsp;You could probably use minimize() on your desired cost function to get the optimal value of VAR, optimizing each row in a loop.&amp;nbsp; Here's how you might set something like that up:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
cost = expr(abs(3 * :PAR1[i] ^ 3 + Cos( 2 * :PAR1[i] ^ 2 + VAR1 ) - :MEA[i]));
for(i=1, i&amp;lt;=N Row(dt), i++,
	:VAR[i] = Minimize(cost,{VAR1(-5, 5)});
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;There are many more arguments that you can use with minimize().&amp;nbsp; Also check out Constrained Minimize().&amp;nbsp; 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.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 20:16:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Model-tuning-Optimization-per-line/m-p/54578#M30856</guid>
      <dc:creator>cwillden</dc:creator>
      <dc:date>2018-04-06T20:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Model tuning - Optimization per line</title>
      <link>https://community.jmp.com/t5/Discussions/Model-tuning-Optimization-per-line/m-p/54667#M30893</link>
      <description>&lt;P&gt;Perfect! I did not know that these 2 functions - Minimize() and Constrained Minimize() - were existing. Thanks a lot for your help&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 05:54:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Model-tuning-Optimization-per-line/m-p/54667#M30893</guid>
      <dc:creator>Steph_Georges</dc:creator>
      <dc:date>2018-04-09T05:54:17Z</dc:date>
    </item>
  </channel>
</rss>

