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" )} )
)
)
);