Choose Language Hide Translation Bar
Highlighted
ih
ih
Community Trekker

Profiler for ensemble models

Is there any way to use the profiler (under the graph menu) with a model consisting of multiple formula columns? 

 

A simple example using principal component regression is below.  Is there an easier way to do this on more complex predictions without having to build the 'one formula to rule them all'?

 

Names default to here( 1);

//Open sample data
dt = Open( "$Sample_data/iris.jmp" );

//Create Ensemble Model, or a model made from multiple columns
New Column(
	"Prin1", Numeric, "Continuous", Format( "Best", 12 ),
	Set Property( "Notes", "Principal Components Save Principal Components" ),
	Formula(
		-0.959279801658072 * :Sepal width + 0.367228033354166 * :Petal length + 0.834830316023339 * :Petal width
		+0.551555338573661
	)
);

New Column( "Prin2",
	Numeric, "Continuous", Format( "Best", 12 ),
	Formula(
		2.08030206250583 * :Sepal width + 0.144745989637573 * :Petal length + 0.440119489548904 * :Petal width + (
		-7.43198224262481)
	)
);

New Column( "Pred Formula Sepal length",
	Numeric, "Continuous", Format( "Best", 12 ),
	Formula( 5.84333333333333 + 0.422991631523829 * :Prin1 + 0.434788183838157 * :Prin2 ),
	Set Property( "Predicting", {:Sepal length, Creator( "Fit Least Squares" )} )
);

//Make one formula containing the entire model.
Eval( Eval Expr( 
	dt << New Column( "Profiler Prediction Formula",
		Numeric, "Continuous", Format( "Best", 12 ),
		Formula( Expr( Substitute( 
			Column( dt, "Pred Formula Sepal length" ) << Get Formula,
			Expr( :Prin1 ),
			Eval Expr( ( Expr( dt:Prin1 << Get Formula ) ) ),
			Expr( :Prin2 ),
			Eval Expr( ( Expr( dt:Prin2 << Get Formula ) ) )
		) ) )
	)
) );

//Compare profilers
New Window( "Profilers",
	Profiler(
		Y( :Pred Formula Sepal length ),
		Profiler(
			1,
			Term Value(
				Prin1( 0, Lock( 0 ), Show( 1 ) ),
				Prin2( 0, Lock( 0 ), Show( 1 ) )
			)
		),
		SendToReport(
			Dispatch( {}, "Profiler", OutlineBox, {Set Title( "What I get" )} )
		)
	),
	Profiler(
		Y( :Pred Formula ),
		Profiler(
			1,
			Term Value(
				Sepal width( 3.125, Lock( 0 ), Show( 1 ) ),
				Petal length( 3.75, Lock( 0 ), Show( 1 ) ),
				Petal width( 1.375, Lock( 0 ), Show( 1 ) )
			)
		),
		SendToReport(
			Dispatch( {}, "Profiler", OutlineBox, {Set Title( "What I want" )} )
		)
	)
);
0 Kudos
2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted

Re: Profiler for ensemble models

Use the option to Expand Intermediate Formulas.

Learn it once, use it forever!

View solution in original post

Highlighted

Re: Profiler for ensemble models

Are you wanting something like this?

 

 image.png

 

If so, in the Prediction Profiler dialog, there is a checkbox in the lower-left to "Expand Intermediate Formulas". Check that box.

 

image.png

Dan Obermiller

View solution in original post

5 REPLIES 5
Highlighted

Re: Profiler for ensemble models

Use the option to Expand Intermediate Formulas.

Learn it once, use it forever!

View solution in original post

Highlighted

Re: Profiler for ensemble models

Are you wanting something like this?

 

 image.png

 

If so, in the Prediction Profiler dialog, there is a checkbox in the lower-left to "Expand Intermediate Formulas". Check that box.

 

image.png

Dan Obermiller

View solution in original post

Highlighted
ih
ih
Community Trekker

Re: Profiler for ensemble models

Wow, I am ashamed of how many I've clicked through that dialog....

 

Thanks!

0 Kudos
Highlighted

Re: Profiler for ensemble models

Are you ulitmately looking for something like what is shown below?

Predictions for all 4 using PC as predictors in Fit Model.Predictions for all 4 using PC as predictors in Fit Model.

 

 

0 Kudos
Highlighted
ih
ih
Community Trekker

Re: Profiler for ensemble models

Not in this case, I was trying to trying to profile a prediction that boosted different types of models, where each model predicted the residuals of the previous as in a boosted tree.  The now-obvious checkbox works great!

0 Kudos