cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
Marco_
Level III

JSL: Profiler Remember Settings

Hi everyone,

 

I have a model in the profiler and would like to save a bunch of different settings. Usually, I use the Remember Parameter Setting in the Profiler to do this. However, in this particular case I want to save all combinations for the parameters X1 to X4 from -1 to +1 in 0.1 steps.

I need some help with the following JSL Code to do this:

Profiler(
	Y( :Y ),
	Profiler(
		1,
		Confidence Intervals( 1 ),
		Term Value(
			:"X1"n( 0, Lock( 0 ), Show( 1 ) ),
			:"X2"n( 0, Lock( 0 ), Show( 1 ) ),
			:"X3"n( 0, Lock( 0 ), Show( 1 ) ),
			:"X4"n( 0, Lock( 0 ), Show( 1 ) )
		),
		Remember Settings( "Setting 1", Differences Report( 1 ) ),
		Term Value(
			:"X1"n( 0, Lock( 0 ), Show( 1 ) ),
			:"X2"n( 0, Lock( 0 ), Show( 1 ) ),
			:"X3"n( 0, Lock( 0 ), Show( 1 ) ),
			:"X4"n( 0, Lock( 0 ), Show( 1 ) )
		)
			)
		);

It would be awesome if someone could tweak the existing code.

 

Thanks in advance!

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: JSL: Profiler Remember Settings

You should be able to use Full Factorial Design to create all possible combinations.

 

I would suggest NOT running this with the all possible combinations

Names Default To Here(1);
Clear Log();

// Calculate combinations - START
doe_platform = DOE(
	Full Factorial Design,
	{Add Response(Maximize, "Y", ., ., .), Add Factor(
		Continuous,
		{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21},
		"X1",
		0
	), Add Factor(
		Continuous,
		{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21},
		"X2",
		0
	), Add Factor(
		Continuous,
		{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21},
		"X3",
		0
	), Add Factor(
		Continuous,
		{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21},
		"X4",
		0
	), Set Random Seed(6613116), Make Design, Simulate Responses(0),
	Set Run Order(Sort Left to Right)},
	Invisible
);

dt = doe_platform << Make Table(Invisible);
doe_platform << Close Window;

m = dt[0, 2::5];
Close(dt, no save);
Show(N Items(m), Dim(m), N Row(m) == 21^4); // N Items(m) = 777924; Dim(m) = [194481 4]; N Row(m) == 21 ^ 4 = 1;

settings = As List((m - 11) / 10);

m = Empty();
// Calculate combinations - END


dt = Open("$SAMPLE_DATA/Tiretread.jmp", Invisible);
dt << New Column("A", Numeric, Continuous, Formula(
	:SILICA * :SILANE * :SULFUR * :ELONG
));

obj = dt << Contour Profiler(
	Y(A),
	Invisible
);

dt << Add Rows(1);
max_row = N Rows(dt);
For Each({setting}, settings[1::100],
	dt[max_row, {"SILICA", "SILANE", "SULFUR", "ELONG"}] = setting;
	obj << Set to Data in Row(max_row);
	obj << Remember Settings;
);
dt << Delete Rows(max_row);

obj << show window;
Write();
-Jarmo

View solution in original post

5 REPLIES 5
jthi
Super User

Re: JSL: Profiler Remember Settings

I'm not sure how happy JMP would be about adding that many different options to the profiler (20*20*20*20 or am I missing something?).

 

But you could add new row to your table which you update with your values with and then loop as many times as you have different settings while updating that and using << Set to Data in Row

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Tiretread.jmp", Invisible);

obj = dt << Contour Profiler(
	Y(
		:Pred Formula ABRASION, :Pred Formula MODULUS,
		:Pred Formula ELONG, :Pred Formula HARDNESS
	),
	Invisible
);


settings = As List(Repeat(-1::1::0.1, 3)`);

dt << Add Rows(1);
max_row = N Rows(dt);
For Each({setting}, settings,
	dt[max_row, {"SILICA", "SILANE", "SULFUR"}] = setting;
	obj << Set to Data in Row(max_row);
	obj << Remember Settings;
);
dt << Delete Rows(max_row);

obj << show window;

 

-Jarmo
Marco_
Level III

Re: JSL: Profiler Remember Settings

@jthi 

Thanks a lot for providing the code. The code provides me 21 remembered settings from -1 to +1 in 0.1 steps for all factors but no combinations between them. This is actually almost what I want. I thought that it might be taff for JMP to have 21*21*21*21 options, but I would really like to give it a try. Could you tweak the code for me to make that possible?

jthi
Super User

Re: JSL: Profiler Remember Settings

You should be able to use Full Factorial Design to create all possible combinations.

 

I would suggest NOT running this with the all possible combinations

Names Default To Here(1);
Clear Log();

// Calculate combinations - START
doe_platform = DOE(
	Full Factorial Design,
	{Add Response(Maximize, "Y", ., ., .), Add Factor(
		Continuous,
		{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21},
		"X1",
		0
	), Add Factor(
		Continuous,
		{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21},
		"X2",
		0
	), Add Factor(
		Continuous,
		{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21},
		"X3",
		0
	), Add Factor(
		Continuous,
		{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21},
		"X4",
		0
	), Set Random Seed(6613116), Make Design, Simulate Responses(0),
	Set Run Order(Sort Left to Right)},
	Invisible
);

dt = doe_platform << Make Table(Invisible);
doe_platform << Close Window;

m = dt[0, 2::5];
Close(dt, no save);
Show(N Items(m), Dim(m), N Row(m) == 21^4); // N Items(m) = 777924; Dim(m) = [194481 4]; N Row(m) == 21 ^ 4 = 1;

settings = As List((m - 11) / 10);

m = Empty();
// Calculate combinations - END


dt = Open("$SAMPLE_DATA/Tiretread.jmp", Invisible);
dt << New Column("A", Numeric, Continuous, Formula(
	:SILICA * :SILANE * :SULFUR * :ELONG
));

obj = dt << Contour Profiler(
	Y(A),
	Invisible
);

dt << Add Rows(1);
max_row = N Rows(dt);
For Each({setting}, settings[1::100],
	dt[max_row, {"SILICA", "SILANE", "SULFUR", "ELONG"}] = setting;
	obj << Set to Data in Row(max_row);
	obj << Remember Settings;
);
dt << Delete Rows(max_row);

obj << show window;
Write();
-Jarmo
Marco_
Level III

Re: JSL: Profiler Remember Settings

Thanks a lot! I tested the script and had no issues until 3000 combinations. That was the point where I hadn't had enough pacient

This is really a big help for me!

Just in case I want to reduce the number of steps from 21 to 5. What do I need to adapt in the code?

I guess the sequence from 1 to 21 in the Add Factor function would be reduced to 1 to 5 and NRow from 21^4 to 5^4. Any other adaptions?

jthi
Super User

Re: JSL: Profiler Remember Settings

You will have to modify the DOE platform part and then the calculation which creates the steps

settings = As List((m - 11) / 10);
-Jarmo