<?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: Improve JSL efficiency: How to close the plot window after each run, to make the JSL run faster without crush PC. in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Improve-JSL-efficiency-How-to-close-the-plot-window-after-each/m-p/248424#M48752</link>
    <description>&lt;P&gt;And here's my attempt at Parallel Assign.&amp;nbsp; I'm still learning how it works.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");
summarize(dt, ages = By(:age));

::results = J(nitems(ages), 3, -1);
driver = ::results[0, 1];
age_rows = {};
for(i=1, i&amp;lt;=nitems(ages), i++,
	insert into(age_rows, dt &amp;lt;&amp;lt; Get Rows Where(:age == Num(ages[i])));
);
y = dt:height &amp;lt;&amp;lt; Get Values();
x = dt:weight &amp;lt;&amp;lt; Get Values();
m = mean(x);
Parallel Assign({a = ages, ar = age_rows, y = y, x = x, m = m}, 
	driver[i]  = (
		rows = ar[i];
		ys = y[rows];
		xs = x[rows];
		xs2 = xs||(xs-m)^2;
		print(i, ys, xs2);
		batch interactive(1);
		Try({b, vb} = Least Squares Solve(ys, xs2)); 
		batch interactive(0);
		::results[i, 0] = b`
	);
);
show(::results);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 20 Feb 2020 01:54:46 GMT</pubDate>
    <dc:creator>vince_faller</dc:creator>
    <dc:date>2020-02-20T01:54:46Z</dc:date>
    <item>
      <title>Improve JSL efficiency: How to close the plot window after each run, to make the JSL run faster without crush PC.</title>
      <link>https://community.jmp.com/t5/Discussions/Improve-JSL-efficiency-How-to-close-the-plot-window-after-each/m-p/248126#M48704</link>
      <description>&lt;P&gt;I am currently have a big table to run a polynomial fit.&lt;/P&gt;
&lt;P&gt;1. The goal: generate polynomial fit parameters and export it as a table.&lt;/P&gt;
&lt;P&gt;2. The problem: using below JSL, it takes too long time to run the whole table. so I can only subset the table into small groups to run to avoid PC crush.&lt;/P&gt;
&lt;P&gt;3. The reason: Below table need to fit the polynominal curve first, then generate the summary table,&amp;nbsp; finally export all classes into 1 table.&lt;/P&gt;
&lt;P&gt;Assuming there are 100k classes, it will take a long time to fit the&amp;nbsp;polynominal curve, then export to table.&lt;/P&gt;
&lt;P&gt;4. Help needed: Can someone help me to modify the JSL? Make it to fit for each class with&amp;nbsp;polynomial curve, then export to table, then close the &amp;nbsp;polynominal curve window. This will save the &lt;SPAN&gt;DDR SDRAM&amp;nbsp;&lt;/SPAN&gt;to keep running all 100k classes adding up only exporting a table of 100k classes, without generating a plots window of 100k.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();

biv = Bivariate( Y( :weight ), X( :age ), Fit Polynomial( 2, {Line Color( {47, 193, 29} )} ), By( :class ) );

rbiv = biv &amp;lt;&amp;lt; report;

Summarize( groups = by( class ) ); // A list of all by-groups
n = N Items( groups );
//Create output table and fill with estimates
dtOut = New Table( "Polynominal parameters",
	New Column( "class", Character ),
	New Column( "T", numeric ),
	New Column( "T2", numeric ),
	addrows( n )
);

For( j = 1, j &amp;lt;= n, j++,
	Estimates = rbiv[j]["Polynomial Fit Degree=2"]["Parameter Estimates"][1][3] &amp;lt;&amp;lt; get as matrix;
	:class[j] = groups[j];
	:T[j] = Estimates[2];
	:T2[j] = Estimates[3];
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 12:32:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Improve-JSL-efficiency-How-to-close-the-plot-window-after-each/m-p/248126#M48704</guid>
      <dc:creator>Stokes</dc:creator>
      <dc:date>2020-02-19T12:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: Improve JSL efficiency: How to close the plot window after each run, to make the JSL run faster without crush PC.</title>
      <link>https://community.jmp.com/t5/Discussions/Improve-JSL-efficiency-How-to-close-the-plot-window-after-each/m-p/248140#M48705</link>
      <description>&lt;P&gt;You do not need to iterate over every class. Send the &amp;lt;&amp;lt; Make Combined Data Table to the Table Box in the first Parameter Estimates outline.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 21:37:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Improve-JSL-efficiency-How-to-close-the-plot-window-after-each/m-p/248140#M48705</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2020-02-18T21:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: Improve JSL efficiency: How to close the plot window after each run, to make the JSL run faster without crush PC.</title>
      <link>https://community.jmp.com/t5/Discussions/Improve-JSL-efficiency-How-to-close-the-plot-window-after-each/m-p/248147#M48707</link>
      <description>&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;Can you help to modify based on the jsl above?&lt;/P&gt;&lt;P&gt;Not clear how to do it...&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 21:48:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Improve-JSL-efficiency-How-to-close-the-plot-window-after-each/m-p/248147#M48707</guid>
      <dc:creator>Stokes</dc:creator>
      <dc:date>2020-02-18T21:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Improve JSL efficiency: How to close the plot window after each run, to make the JSL run faster without crush PC.</title>
      <link>https://community.jmp.com/t5/Discussions/Improve-JSL-efficiency-How-to-close-the-plot-window-after-each/m-p/248208#M48720</link>
      <description>&lt;P&gt;Try this code to start with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt1 = Current Data Table();

// launch Bivariate with more than one By group, save list of analysis layer references
biv = dt1 &amp;lt;&amp;lt; Bivariate( Y( :weight ), X( :age ), By( :sex ), Fit Polynomial( 2 ) );

// obtain first report layer reference and save
rbiv = biv[1] &amp;lt;&amp;lt; Report;

// use first reference to send table box message
dt2 = rbiv["Parameter Estimates"][TableBox(1)] &amp;lt;&amp;lt; Make Combined Data Table;

// process results as a data table&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then add code to modify the data table to suit your needs.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 10:46:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Improve-JSL-efficiency-How-to-close-the-plot-window-after-each/m-p/248208#M48720</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2020-02-19T10:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: Improve JSL efficiency: How to close the plot window after each run, to make the JSL run faster without crush PC.</title>
      <link>https://community.jmp.com/t5/Discussions/Improve-JSL-efficiency-How-to-close-the-plot-window-after-each/m-p/248398#M48749</link>
      <description>&lt;P&gt;Thanks a lot,&amp;nbsp; this is a better solution than my original one.&lt;/P&gt;&lt;P&gt;I add a For loop to subset the large table into small one and use your script to solve my problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 22:07:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Improve-JSL-efficiency-How-to-close-the-plot-window-after-each/m-p/248398#M48749</guid>
      <dc:creator>Stokes</dc:creator>
      <dc:date>2020-02-19T22:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Improve JSL efficiency: How to close the plot window after each run, to make the JSL run faster without crush PC.</title>
      <link>https://community.jmp.com/t5/Discussions/Improve-JSL-efficiency-How-to-close-the-plot-window-after-each/m-p/248420#M48751</link>
      <description>&lt;P&gt;A couple of other methods if you don't care about the actual plots.&amp;nbsp; I sometimes see slow downs just to render a large amount of plots.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Calculate it without the platform.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");
summarize(dt, ages = By(:age));
dtOut = New Table( "Polynominal parameters",
	New Column( "class", Character ),
	New Column( "T", numeric ),
	New Column( "T2", numeric ), 
	addrows(nitems(ages))
);

for(i=1, i&amp;lt;=nitems(ages), i++, 
	rows = dt &amp;lt;&amp;lt; Get Rows Where(:age == Num(ages[i]));
	y = dt:height[rows];
	x = dt:weight[rows];
	x2 = x||(x-ColMean(dt:weight))^2;
	{b, vb} = Least Squares Solve(y, x2);
	dtOut:class[i] = ages[i];
	dtOut:T[i] = b[2];
	dtOut:T2[i] = b[3];
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2. instead of plotting a bunch of charts with a by variable you could plot one chart with a group by variable (I've had this help sometimes).&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;biv = dt &amp;lt;&amp;lt; Bivariate(
	Y( :height ),
	X( :weight ),
	Group By(:age),
	Fit Polynomial( 2 ),
	invisible
);
report(biv)["Parameter Estimates"][TableBox(1)] &amp;lt;&amp;lt; Make Combined Data Table
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And &amp;lt;&amp;lt;Invisible on platforms almost always helps.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 01:26:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Improve-JSL-efficiency-How-to-close-the-plot-window-after-each/m-p/248420#M48751</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2020-02-20T01:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Improve JSL efficiency: How to close the plot window after each run, to make the JSL run faster without crush PC.</title>
      <link>https://community.jmp.com/t5/Discussions/Improve-JSL-efficiency-How-to-close-the-plot-window-after-each/m-p/248424#M48752</link>
      <description>&lt;P&gt;And here's my attempt at Parallel Assign.&amp;nbsp; I'm still learning how it works.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");
summarize(dt, ages = By(:age));

::results = J(nitems(ages), 3, -1);
driver = ::results[0, 1];
age_rows = {};
for(i=1, i&amp;lt;=nitems(ages), i++,
	insert into(age_rows, dt &amp;lt;&amp;lt; Get Rows Where(:age == Num(ages[i])));
);
y = dt:height &amp;lt;&amp;lt; Get Values();
x = dt:weight &amp;lt;&amp;lt; Get Values();
m = mean(x);
Parallel Assign({a = ages, ar = age_rows, y = y, x = x, m = m}, 
	driver[i]  = (
		rows = ar[i];
		ys = y[rows];
		xs = x[rows];
		xs2 = xs||(xs-m)^2;
		print(i, ys, xs2);
		batch interactive(1);
		Try({b, vb} = Least Squares Solve(ys, xs2)); 
		batch interactive(0);
		::results[i, 0] = b`
	);
);
show(::results);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Feb 2020 01:54:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Improve-JSL-efficiency-How-to-close-the-plot-window-after-each/m-p/248424#M48752</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2020-02-20T01:54:46Z</dc:date>
    </item>
  </channel>
</rss>

