Model Comparison
Example 1
Summary: Fits a model with the prediction profiler, utilizing desirability functions to compare multiple models for predicting body fat. The script opens a data table, specifies response variables, and filters observations by validation type.
Code:
// Model Comparison
// Open data table
dt = Open("data_table.jmp");
// Model Comparison
Model Comparison(
Y(
:
"Pred Body Fat - 2nd Order Stepwise"n,
:
"Pred Body Fat - Variable Reduction PCA"n,
:"Pred Body Fat - Stepwise"n,
:"Pred Body Fat - Partition"n,
:"Pred Body Fat - PLS"n,
:
"Pred Body Fat - Bootstrap Forest"n,
:"Pred Body Fat - Boosted Tree"n,
:
"Pred Body Fat - Neural (3,0,0)"n,
:
"Pred Body Fat - Neural (4,0,0),(8,0,0)"n,
:
"Pred Body Fat - Boosted Neural"n,
:
"Pred Body Fat - Ensemble Model"n
),
Where(
Format( :Validation ) ==
"Validation"
)
);
Code Explanation:
- Open data table.
- Launch Model Comparison.
- Specify response variables.
- Filter observations by validation type.
Example 2
Summary: Compares multiple models for predicting body fat using a model comparison object, filtering data by validation condition.
Code:
dt under test = Open("data_table.jmp");
obj = Model Comparison(
Y(
:Name( "Pred Body Fat - 2nd Order Stepwise" ), :Name( "Pred Body Fat - Variable Reduction PCA" ),
:Name( "Pred Body Fat - Stepwise" ), :Name( "Pred Body Fat - Partition" ), :Name( "Pred Body Fat - PLS" ),
:Name( "Pred Body Fat - Bootstrap Forest" ), :Name( "Pred Body Fat - Boosted Tree" ), :Name( "Pred Body Fat - Neural (3,0,0)" ),
:Name( "Pred Body Fat - Neural (4,0,0),(8,0,0)" ), :Name( "Pred Body Fat - Boosted Neural" ),
:Name( "Pred Body Fat - Ensemble Model" )
),
Where( Format( :Validation ) == "Validation" )
);
Code Explanation:
- Open table "data_table".
- Create model comparison object.
- Set response variables.
- Filter data by validation condition.
Example 3
Summary: Compares multiple models for predicting body fat percentage, including stepwise regression, principal component analysis, and neural networks, with visualizations for actual vs. predicted values and residual plots.
Code:
dt under test = Open("data_table.jmp");
obj = Model Comparison(
Y(
:Name( "Pred Body Fat - 2nd Order Stepwise" ), :Name( "Pred Body Fat - Variable Reduction PCA" ),
:Name( "Pred Body Fat - Stepwise" ), :Name( "Pred Body Fat - Partition" ), :Name( "Pred Body Fat - PLS" ),
:Name( "Pred Body Fat - Bootstrap Forest" ), :Name( "Pred Body Fat - Boosted Tree" ), :Name( "Pred Body Fat - Neural (3,0,0)" ),
:Name( "Pred Body Fat - Neural (4,0,0),(8,0,0)" ), :Name( "Pred Body Fat - Boosted Neural" ),
:Name( "Pred Body Fat - Ensemble Model" )
),
Plot Actual by Predicted( 1 ),
Plot Residual by Row( 1 ),
Profiler( 1 ),
Where( Format( :Validation ) == "Validation" ),
SendToReport(
Dispatch( {}, "Model Comparison", OutlineBox, {Set Title( "Plot Actual by Predicted, Plot Residual by Row, Profiler" )} ),
Dispatch( {"Model Comparison"}, "Measures of Fit for Percent body fat", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Create Model Comparison object.
- Set response variables.
- Enable Plot Actual by Predicted.
- Enable Plot Residual by Row.
- Enable Profiler.
- Filter rows where Validation is "Validation".
- Send report to window.
- Set title for plots.
- Close Measures of Fit for Percent body fat.