Model Screening
Example 1
Summary: Process of opening a data table, launching Model Screening with two-way splits for k-fold validation, and retrieving the session script.
Code:
dt = Open("data_table.jmp");
bp = Model Screening();
ss = Get Session Script();
Code Explanation:
- Open table.
- Launch Model Screening.
- Retrieve session script.
Example 2
Summary: Performs a model screening process using Naive Bayes and Partial Least Squares methods, with K-Fold cross-validation and two-way splits for reproducibility.
Code:
Open("data_table.jmp");
obj = Model Screening(
Y( :Y ),
X( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Naive Bayes( 1 ),
Partial Least Squares( 1 ),
Set Random Seed( 24680 ),
K Fold Crossvalidation( 1 ),
Use Two Way Splits for K Fold( 1 )
);
rpt = obj << report;
b method = {"Boosted Tree", "Bootstrap Forest", "Decision Tree", "Fit Least Squares", "Fit Stepwise", "Generalized Regression Lasso",
"K Nearest Neighbors", "Neural Boosted", "Partial Least Squares", "Support Vector Machines"};
b fold = [1, 5, 5, 1, 2, 2, 1, 4, 2, 1];
obj << Select Fit( Clear All );
obj << Select Fit( "Summary", Where( N Trials Folds >= 1 ) );
obj << Save Prediction Formulas( 1 );
Code Explanation:
- Open data table;
- Create model screening object.
- Define response variable.
- Define predictor variables.
- Enable Naive Bayes method.
- Enable Partial Least Squares method.
- Set random seed for reproducibility.
- Use K-Fold cross-validation.
- Use two-way splits for K-Fold.
- Save prediction formulas.
Example 3
Summary: Runs a Model Screening process to evaluate the performance of various machine learning algorithms, including Naive Bayes and Partial Least Squares, on a binary outcome variable with multiple predictor variables, utilizing K-Fold cross-validation with two-way splits.
Code:
dt = Open("data_table.jmp");
obj = Model Screening(
Y( :Y Binary ),
X( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Naive Bayes( 1 ),
Partial Least Squares( 1 ),
Set Random Seed( 24680 ),
K Fold Crossvalidation( 1 ),
Use Two Way Splits for K Fold( 1 )
);
rpt = obj << report;
b method = {"Boosted Tree", "Bootstrap Forest", "Decision Tree", "Fit Stepwise", "Generalized Regression Lasso", "K Nearest Neighbors",
"Naive Bayes", "Neural Boosted", "Nominal Logistic", "Support Vector Machines"};
b fold = [5, 5, 4, 5, 4, 1, 1, 5, 4, 1];
obj << Select Fit( Clear All );
obj << Select Fit( "Summary", Where( N Trials Folds >= 1 ) );
obj << Save Prediction Formulas( 1 );
Code Explanation:
- Open data table;
- Run Model Screening.
- Specify binary outcome variable.
- Define predictor variables.
- Use validation column.
- Enable Naive Bayes model.
- Enable Partial Least Squares model.
- Set random seed for reproducibility.
- Perform K-Fold cross-validation.
- Use two-way splits for K-Fold.
Example 4
Summary: Runs a comprehensive model screening process using the Model Screening platform in JMP, incorporating Naive Bayes and Partial Least Squares methods, K-Fold cross-validation, and two-way splits for enhanced predictive modeling.
Code:
dt = Open("data_table.jmp");
obj = Model Screening(
Y( :Y Ordinal ),
X( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Naive Bayes( 1 ),
Partial Least Squares( 1 ),
Set Random Seed( 24680 ),
K Fold Crossvalidation( 1 ),
Use Two Way Splits for K Fold( 1 )
);
rpt = obj << report;
b method = {"Bootstrap Forest", "Decision Tree", "Fit Stepwise", "Generalized Regression Lasso", "K Nearest Neighbors", "Naive Bayes",
"Neural Boosted", "Ordinal Logistic", "Support Vector Machines"};
obj << Select Fit( Clear All );
obj << Select Fit( "Summary", Where( N Trials Folds >= 1 ) );
Log Capture( obj << Save Prediction Formulas( 1 ) );
Code Explanation:
- Open data table;
- Launch Model Screening platform.
- Set response variable to Y Ordinal.
- Specify predictor variables.
- Use Validation column for validation.
- Enable Naive Bayes method.
- Enable Partial Least Squares method.
- Set random seed to 24680.
- Perform K-Fold cross-validation.
- Use two-way splits for K-Fold.
- Generate model report.
- Define best modeling methods.
- Clear previous selections.
- Select models with at least 1 trial fold.
- Capture log output.
- Save prediction formulas.
Example 5
Summary: Model screening and cross-validation for a data table, generating a report with summary statistics across folds.
Code:
Open("data_table.jmp");
obj1 = Model Screening(
Y( :Y ),
X( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
K Fold Crossvalidation( 1 ),
Nested Crossvalidation( 1 ),
K for Nested( 3 ),
L for Nested( 2 ),
Repeated K Fold( 2 ),
);
rpt1 = obj1 << report;
nfolds = rpt1["Summary across the folds"][Number Col Box( "N Trials Folds" )] << get as matrix;
s1 = Try( dt:Hidden Validation << get hidden, 0 );
obj1 << Plot Actual by Predicted( 1 );
Code Explanation:
- Open data table;
- Perform model screening.
- Set response variable Y.
- Include multiple predictor variables.
- Enable K Fold Crossvalidation.
- Enable Nested Crossvalidation.
- Set K for Nested.
- Set L for Nested.
- Enable Repeated K Fold.
- Retrieve summary report.
- Extract number of trials.
- Check for hidden validation.
- Plot actual vs. predicted.
Example 6
Summary: Model screening by opening a data table, setting response and predictor variables, and generating a report with random seed control.
Code:
dt = Open("data_table.jmp");
obj = Model Screening( Y( :sex ), X( :height ), Set Random Seed( 2374 ) );
rpt = obj << report;
Code Explanation:
- Open data table.
- Launch Model Screening platform.
- Set response variable to "sex".
- Set predictor variable to "height".
- Set random seed to 2374.
- Generate model screening report.
Example 7
Summary: Model screening by opening a data table, specifying response and predictor variables, and generating a report with titles from outline boxes.
Code:
dt = Open("data_table.jmp");
obj = dt << Model Screening( Y( :Y, :Y Binary ), X( :Age, :Gender, BMI ), Validation( :Validation ), );
rpt = obj << report;
rpt title1 = rpt[1][Outline Box( 1 )] << get title;
rpt title2 = rpt[2][Outline Box( 1 )] << get title;
Code Explanation:
- Open data table;
- Perform model screening.
- Specify response variables.
- Specify predictor variables.
- Use validation column.
- Retrieve report object.
- Get first outline box title.
- Get second outline box title.
Example 8
Summary: Runs a Model Screening process to identify the most relevant predictors for a binary response variable, utilizing Naive Bayes and Partial Least Squares methods with random seed set to 24680.
Code:
dt = Open("data_table.jmp");
obj = dt << Model Screening(
Y( :Y Binary ),
X( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Naive Bayes( 1 ),
Partial Least Squares( 1 ),
Set Random Seed( 24680 ),
Profiler( 1 )
);
rpt = obj << report;
Code Explanation:
- Open data table;
- Launch Model Screening.
- Set Y variable to binary.
- Specify X variables.
- Use validation column.
- Enable Naive Bayes method.
- Enable Partial Least Squares method.
- Set random seed to 24680.
- Enable Profiler option.
- Generate report.
Example 9
Summary: Performs a model screening process to identify the most relevant predictors for a response variable, utilizing Naive Bayes and Partial Least Squares methods, and generates a report.
Code:
dt = Open("data_table.jmp");
obj = dt << Model Screening(
Y( :Y Ordinal ),
X( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Naive Bayes( 1 ),
Partial Least Squares( 1 ),
Set Random Seed( 24680 ),
Profiler( 1 )
);
rpt = obj << report;
Code Explanation:
- Open data table;
- Launch Model Screening platform.
- Set response variable.
- Specify predictor variables.
- Enable validation column.
- Include Naive Bayes method.
- Include Partial Least Squares method.
- Set random seed for reproducibility.
- Enable Profiler option.
- Generate model report.
Example 10
Summary: Runs a Model Screening process to identify the most important predictor variables for a Naive Bayes and Partial Least Squares model, utilizing K-Fold Crossvalidation with a random seed for reproducibility.
Code:
dt = Open("data_table.jmp");
obj = Model Screening(
Y( :Y ),
X( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Naive Bayes( 1 ),
Partial Least Squares( 1 ),
Set Random Seed( 24680 ),
K Fold Crossvalidation( 1 ),
);
obj << Profiler( 1 );
Code Explanation:
- Open data table;
- Initiate Model Screening.
- Set response variable Y.
- Define predictor variables.
- Specify validation method.
- Enable Naive Bayes model.
- Enable Partial Least Squares model.
- Set random seed for reproducibility.
- Use K-Fold Crossvalidation.
- Launch Profiler.
Example 11
Summary: Performs a Model Screening analysis to evaluate multiple machine learning models for predicting Y Binary, utilizing various algorithms and validation techniques.
Code:
dt = Open("data_table.jmp");
obj = dt << Model Screening(
Y( :Y Binary ),
X( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Naive Bayes( 1 ),
Set Random Seed( 24680 )
);
rpt = obj << report;
(rpt["Details"]["Partition for Y Binary"] << get scriptable object) << Save Prediction Formula( 1 );
(rpt["Details"]["Bootstrap Forest for Y Binary"] << get scriptable object) << Save Prediction Formula( 1 );
(rpt["Details"]["Boosted Tree for Y Binary"] << get scriptable object) << Save Prediction Formula( 1 );
(rpt["Details"]["K Nearest Neighbors"]["Y Binary"] << get scriptable object) << Save Prediction Formula( 6 );
(rpt["Details"]["Naive Bayes"] << get scriptable object) << Save Probability Formula( 1 );
(rpt["Details"]["Neural"] << get scriptable object) << (Fit[1] << Save Formulas( 1 ));
(rpt["Details"]["Support Vector Machine"] << get scriptable object) << (Fit[1] << Save Probability Formula( 1 ));
(rpt["Details"]["Nominal Logistic Fit for Y Binary"] << get scriptable object) << Save Probability Formula( 1 );
(rpt["Details"]["Generalized Regression for Y Binary = High"] << get scriptable object) << (Fit[1] << Save Prediction Formula( 1 ));
b pred = (dt << get as matrix)[0, 13 :: 72];
obj << Select Fit( "Validation", Where( N > 1 ) );
obj << Save Prediction Formulas( 1 );
pred = (dt << get as matrix)[0, 73 :: 132];
Code Explanation:
- Open data table;
- Run Model Screening analysis.
- Set response variable.
- Define predictor variables.
- Use validation column.
- Apply Naive Bayes model.
- Set random seed.
- Extract report object.
- Save prediction formulas for multiple models.
- Save probability formula for Naive Bayes.
- Save neural network formulas.
- Save SVM probability formula.
- Save logistic fit probability formula.
- Save generalized regression prediction formula.
- Extract baseline predictions.
- Select fits based on validation.
- Save all prediction formulas.
- Extract final predictions.
Example 12
Summary: Performs a model screening process to evaluate the performance of various machine learning algorithms on an ordinal response variable, utilizing data from a JMP data table and generating reports for each algorithm.
Code:
dt = Open("data_table.jmp");
obj = dt << Model Screening(
Y( :Y Ordinal ),
X( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Naive Bayes( 1 ),
Partial Least Squares( 1 ),
Set Random Seed( 24680 ),
Profiler( 1 )
);
rpt = obj << report;
(rpt["Details"]["Partition for Y Ordinal"] << get scriptable object) << Save Prediction Formula( 1 );
(rpt["Details"]["Bootstrap Forest for Y Ordinal"] << get scriptable object) << Save Prediction Formula( 1 );
(rpt["Details"]["K Nearest Neighbors"]["Y Ordinal"] << get scriptable object) << Save Prediction Formula( 10 );
(rpt["Details"]["Naive Bayes"] << get scriptable object) << Save Probability Formula( 1 );
(rpt["Details"]["Neural"] << get scriptable object) << (Fit[1] << Save Formulas( 1 ));
(rpt["Details"]["Ordinal Logistic Fit for Y Ordinal"] << get scriptable object) << Save Probability Formula( 1 );
(rpt["Details"]["Generalized Regression for Y Ordinal"] << get scriptable object) << (Fit[1] << Save Prediction Formula( 1 ));
b pred = (dt << get as matrix)[0, 13 :: 76];
obj << Select Fit( "Validation", Where( N > 1 ) );
Log Capture( obj << Save Prediction Formulas( 1 ) );
pred = (dt << get as matrix)[0, 77 :: 140];
Code Explanation:
- Open data table;
- Launch Model Screening.
- Set Y variable.
- Specify X variables.
- Configure validation method.
- Enable Naive Bayes model.
- Enable Partial Least Squares model.
- Set random seed.
- Enable Profiler.
- Retrieve report object.
Example 13
Summary: Runs a Model Screening process to select the best-fit model for predicting continuous outcomes, utilizing Naive Bayes and Partial Least Squares methods with K-Fold cross-validation.
Code:
dt = Open("data_table.jmp");
obj = Model Screening(
Y( :Y ),
X( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Naive Bayes( 1 ),
Partial Least Squares( 1 ),
Set Random Seed( 24680 ),
K Fold Crossvalidation( 1 ),
);
obj << Select Fit( "Summary", Where( Sum Freq > 1 ) );
obj << Save Prediction Formulas( 1 );
Code Explanation:
- Open data table;
- Run Model Screening.
- Set response variable.
- Define predictor variables.
- Use validation column.
- Enable Naive Bayes method.
- Enable Partial Least Squares method.
- Set random seed.
- Perform K-Fold cross-validation.
- Save prediction formulas.
Example 14
Summary: Performs a Model Screening analysis to identify the best-fitting models for predicting Y, using multiple predictor variables and K-Fold Crossvalidation with two-way splits.
Code:
dt = Open("data_table.jmp");
obj = Model Screening(
Y( :Y ),
X( :Age, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
By( :Gender ),
Naive Bayes( 1 ),
Partial Least Squares( 1 ),
Set Random Seed( 24680 ),
K Fold Crossvalidation( 1 ),
);
obj << Select Fit( "Summary", Where( Sum Freq > 1 ) );
Log Capture( obj << Save Prediction Formulas( 1 ) );
Code Explanation:
- Open data table;
- Run Model Screening analysis.
- Set response variable as Y.
- Include multiple predictor variables.
- Use Validation column.
- Group by Gender.
- Enable Naive Bayes method.
- Enable Partial Least Squares method.
- Set random seed for reproducibility.
- Perform K-Fold Crossvalidation.
- Select models with summary fit.
- Save prediction formulas to log.
Model Screening using Set Modeling Type
Example 1
Summary: Performs a model screening process to identify the best-fitting models for predicting Y Ordinal, utilizing Naive Bayes and Partial Least Squares algorithms with K Fold Crossvalidation.
Code:
dt = Open("data_table.jmp");
dt:Y Ordinal << Set Modeling Type( "Nominal" );
obj = Model Screening(
Y( :Y Ordinal ),
X( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Naive Bayes( 1 ),
Partial Least Squares( 1 ),
Set Random Seed( 24680 ),
K Fold Crossvalidation( 1 ),
Use Two Way Splits for K Fold( 1 )
);
rpt = obj << report;
b method = {"Bootstrap Forest", "Decision Tree", "Generalized Regression Lasso", "K Nearest Neighbors", "Naive Bayes", "Neural Boosted",
"Nominal Logistic", "Support Vector Machines"};
obj << Select Fit( Clear All );
obj << Select Fit( "Summary", Where( N Trials Folds >= 1 ) );
Log Capture( obj << Save Prediction Formulas( 1 ) );
Code Explanation:
- Open data table;
- Set Y Ordinal as Nominal.
- Perform Model Screening.
- Specify Y and X variables.
- Use Validation column.
- Include Naive Bayes model.
- Include Partial Least Squares model.
- Set random seed for reproducibility.
- Enable K Fold Crossvalidation.
- Use Two Way Splits for K Fold.
Example 2
Summary: Performs a model screening process to identify the most relevant predictors for a nominal response variable, using Naive Bayes and Partial Least Squares methods, with Profiler report generation.
Code:
dt = Open("data_table.jmp");
dt:Y Ordinal << Set Modeling Type( "Nominal" );
obj = dt << Model Screening(
Y( :Y Ordinal ),
X( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Naive Bayes( 1 ),
Partial Least Squares( 1 ),
Set Random Seed( 24680 ),
Profiler( 1 )
);
rpt = obj << report;
Code Explanation:
- Open data table;
- Set Y Ordinal to Nominal.
- Launch Model Screening platform.
- Specify Y as Y Ordinal.
- Add multiple predictors.
- Use Validation column.
- Enable Naive Bayes method.
- Enable Partial Least Squares method.
- Set random seed to 24680.
- Generate Profiler report.
Example 3
Summary: Process of performing model screening and generating prediction formulas for a nominal response variable using Naive Bayes, Neural, Support Vector Machine, Nominal Logistic Fit, and Generalized Regression models.
Code:
dt = Open("data_table.jmp");
dt:Y Ordinal << Set Modeling Type( "Nominal" );
obj = dt << Model Screening(
Y( :Y Ordinal ),
X( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Naive Bayes( 1 ),
Set Random Seed( 24680 )
);
rpt = obj << report;
Log Capture(
(rpt["Details"]["Partition for Y Ordinal"] << get scriptable object) << Save Prediction Formula( 1 );
(rpt["Details"]["Bootstrap Forest for Y Ordinal"] << get scriptable object) << Save Prediction Formula( 1 );
(rpt["Details"]["K Nearest Neighbors"]["Y Ordinal"] << get scriptable object) << Save Prediction Formula( 6 );
(rpt["Details"]["Naive Bayes"] << get scriptable object) << Save Probability Formula( 1 );
(rpt["Details"]["Neural"] << get scriptable object) << (Fit[1] << Save Formulas( 1 ));
(rpt["Details"]["Support Vector Machine"] << get scriptable object) << (Fit[1] << Save Probability Formula( 1 ));
(rpt["Details"]["Nominal Logistic Fit for Y Ordinal"] << get scriptable object) << Save Probability Formula( 1 );
(rpt["Details"]["Generalized Regression for Y Ordinal"] << get scriptable object) << (Fit[1] << Save Prediction Formula( 1 ));
b pred = (dt << get as matrix)[0, 13 :: 72];
obj << Select Fit( "Validation", Where( N > 1 ) );
obj << Save Prediction Formulas( 1 );
pred = (dt << get as matrix)[0, 73 :: 132];
);
Code Explanation:
- Open data table;
- Set Y Ordinal as Nominal.
- Run Model Screening.
- Specify Y and X variables.
- Use Validation column.
- Enable Naive Bayes model.
- Set random seed.
- Retrieve model report.
- Log prediction and probability formulas.
- Save all model formulas.
Model Screening using If
Example 1
Summary: Model screening and cross-validation for a binary response variable, utilizing predictor variables from a data table.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj = Model Screening(
Y( :Y Binary ),
X( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
K Fold Crossvalidation( 1 ),
);
dt2 = obj << Save Results Table( 1 );
Close( dt, no save );
Close( dt2[1], no save );
Close( dt2[2], no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data table;
- Run Model Screening.
- Set response variable.
- Define predictor variables.
- Perform cross-validation.
- Save results table.
- Close original data table.
- Close first result table.
- Close second result table.
Example 2
Summary: Model screening in JMP Pro by selecting rows, excluding others, and running a Model Screening process with specified variables.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
selected = dt << Select Where( :Validation == 2 );
selected << Exclude;
Log Capture(
Model Screening(
Y( :Y Binary ),
X( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation )
)
);
Close( dt, no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data table;
- Select rows where Validation=2.
- Exclude selected rows.
- Start logging.
- Run Model Screening.
- Set response variable: Y Binary.
- Set predictor variables.
- Use Validation column.
- Close dataset without saving.
Example 3
Summary: Executes Model Screening analysis with optional binary Y variable, and extracts report titles from outline boxes.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt = Open("data_table.jmp");
obj = dt << Model Screening( Y( :Y ), X( :Age, :Gender, BMI ), Validation( :Validation ), );
rpt = obj << report;
rpt title = rpt[Outline Box( 1 )] << get title;
Close( dt, no save );
dt = Open("data_table.jmp");
obj = dt << Model Screening( Y( :Y, :Y Binary ), X( :Age, :Gender, BMI ), Validation( :Validation ), );
rpt = obj << report;
rpt title1 = rpt[1][Outline Box( 1 )] << get title;
rpt title2 = rpt[2][Outline Box( 1 )] << get title;
Close( dt, no save );
,
dt = Open("data_table.jmp");
Log Capture( obj = dt << Model Screening( Y( :Y ), X( :Age, :Gender, BMI ) ) );
rpt = Current Report();
Try();
Close( dt, no save );
);
Code Explanation:
- Check for JMP Pro version.
- Open data table;
- Run Model Screening analysis.
- Extract report.
- Get first outline box title.
- Close dataset without saving.
- Reopen data_table dataset
- Run Model Screening with binary Y.
- Extract report again.
- Get titles from both outline boxes.
- Close dataset without saving.
- If not JMP Pro, open data_table dataset.
- Run Model Screening analysis.
- Capture log output.
- Extract current report.
- Attempt to close dataset without saving.
Model Screening using New Column
Example 1
Summary: Fits a standard least squares model with multiple effects and generating a ROC curve for predictive modeling, utilizing Model Screening in JMP.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Y Nominal", character, nominal, formula( :Y Ordinal ) );
dt:Y Nominal << Set Property( "Target Level", "Low" );
obj = Model Screening(
Y( :Y Nominal ),
X( :Gender, :BMI, :BP, :Total Cholesterol ),
Validation( :Validation ),
Set Random Seed( 123 ),
ROC Curve( 1 )
);
rpt = obj << report;
check1 = rpt[Outline Box( 73 )] << get title;
If( check1 == "ROC Curve",
roc1 = rpt[Outline Box( 73 )][Table Box( 1 )] << get as matrix,
Show( "OutlineBox index for ROC Curve needs to be updated." )
);
Code Explanation:
- Open data table;
- Create new column "Y Nominal".
- Convert "Y Ordinal" to "Y Nominal".
- Set target level to "Low".
- Run Model Screening.
- Specify predictors: Gender, BMI, BP, Total Cholesterol.
- Use Validation column.
- Set random seed to 123.
- Generate ROC Curve.
- Extract ROC curve data.
Example 2
Summary: Fits a standard least squares model with multiple effects and generating a ROC curve, utilizing Model Screening to analyze the relationship between Y Nominal and specified X variables.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Y Nominal", character, nominal, formula( :Y Ordinal ) );
dt:Y Nominal << Set Property( "Target Level", "Medium" );
obj = Model Screening(
Y( :Y Nominal ),
X( :Gender, :BMI, :BP, :Total Cholesterol ),
Validation( :Validation ),
Set Random Seed( 123 ),
ROC Curve( 1 )
);
rpt = obj << report;
check1 = rpt[Outline Box( 73 )] << get title;
If( check1 == "ROC Curve",
roc2 = rpt[Outline Box( 73 )][Table Box( 1 )] << get as matrix,
Show( "OutlineBox index for ROC Curve needs to be updated." )
);
Code Explanation:
- Open data table;
- Create new column "Y Nominal".
- Convert "Y Ordinal" to "Y Nominal".
- Set target level to "Medium".
- Run Model Screening.
- Include specified variables.
- Use validation column.
- Set random seed to 123.
- Generate ROC curve.
- Extract ROC curve data.
Example 3
Summary: Fits a standard least squares model with multiple effects and generating a ROC Curve report, utilizing Model Screening analysis to identify the best predictors.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Y Nominal", character, nominal, formula( :Y Ordinal ) );
dt:Y Nominal << Set Property( "Target Level", "High" );
obj = Model Screening(
Y( :Y Nominal ),
X( :Gender, :BMI, :BP, :Total Cholesterol ),
Validation( :Validation ),
Set Random Seed( 123 ),
ROC Curve( 1 )
);
rpt = obj << report;
check1 = rpt[Outline Box( 73 )] << get title;
If( check1 == "ROC Curve",
roc3 = rpt[Outline Box( 73 )][Table Box( 1 )] << get as matrix,
Show( "OutlineBox index for ROC Curve needs to be updated." )
);
Code Explanation:
- Open data table;
- Create new nominal column.
- Set target level to "High".
- Run Model Screening analysis.
- Specify response and predictors.
- Use validation column.
- Set random seed for reproducibility.
- Enable ROC Curve option.
- Retrieve model screening report.
- Check for ROC Curve outline box.
Example 4
Summary: Fits a standard least squares model with multiple effects and generates a profiler plot for data analysis, utilizing Model Screening and specifying response variable Y Nominal Num.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Y Nominal Num", numeric, nominal, formula( If( :Y > 200, 10, :Y > 150 & :Y <= 200, 50, :Y <= 150, 100 ) ) );
obj = dt << Model Screening(
Y( :Y Nominal Num ),
X( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Naive Bayes( 1 ),
Partial Least Squares( 1 ),
Set Random Seed( 24680 ),
Profiler( 1 )
);
rpt = obj << report;
Code Explanation:
- Open data table;
- Create new column "Y Nominal Num".
- Define formula for "Y Nominal Num".
- Initiate Model Screening.
- Specify response variable "Y Nominal Num".
- Include multiple predictor variables.
- Use validation column.
- Enable Naive Bayes method.
- Enable Partial Least Squares method.
- Set random seed to 24680.
- Generate Profiler report.
Example 5
Summary: Fits a standard least squares model with multiple effects and generates a profiler plot using JMP's Model Screening platform.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Y Ordinal Num", numeric, ordinal, formula( If( :Y > 200, 10, :Y > 150 & :Y <= 200, 50, :Y <= 150, 100 ) ) );
obj = dt << Model Screening(
Y( :Y Ordinal Num ),
X( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Naive Bayes( 1 ),
Partial Least Squares( 1 ),
Set Random Seed( 24680 ),
Profiler( 1 )
);
rpt = obj << report;
Code Explanation:
- Open data table;
- Create new column "Y Ordinal Num".
- Define ordinal formula for new column.
- Launch Model Screening platform.
- Specify "Y Ordinal Num" as response.
- Include multiple predictors.
- Use validation method.
- Enable Naive Bayes modeling.
- Enable Partial Least Squares modeling.
- Set random seed for reproducibility.
Example 6
Summary: Fits multiple models to a data table, including Naive Bayes, Bootstrap Forest, Boosted Tree, K Nearest Neighbors, and Generalized Regression, and generates reports with prediction formulas.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Y Binary Num", numeric, nominal, formula( If( :Y > 200, 10000, :Y <= 200, 10 ) ) );
obj = dt << Model Screening(
Y( :Y Binary Num ),
X( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Naive Bayes( 1 ),
Set Random Seed( 24680 )
);
rpt = obj << report;
(rpt["Details"]["Partition for Y Binary Num"] << get scriptable object) << Save Prediction Formula( 1 );
(rpt["Details"]["Bootstrap Forest for Y Binary Num"] << get scriptable object) << Save Prediction Formula( 1 );
(rpt["Details"]["Boosted Tree for Y Binary Num"] << get scriptable object) << Save Prediction Formula( 1 );
(rpt["Details"]["K Nearest Neighbors"]["Y Binary Num"] << get scriptable object) << Save Prediction Formula( 6 );
(rpt["Details"]["Naive Bayes"] << get scriptable object) << Save Probability Formula( 1 );
(rpt["Details"]["Neural"] << get scriptable object) << (Fit[1] << Save Formulas( 1 ));
(rpt["Details"]["Support Vector Machine"] << get scriptable object) << (Fit[1] << Save Probability Formula( 1 ));
(rpt["Details"]["Nominal Logistic Fit for Y Binary Num"] << get scriptable object) << Save Probability Formula( 1 );
(rpt["Details"]["Generalized Regression for Y Binary Num = 10000"] << get scriptable object) << (Fit[1] << Save Prediction Formula( 1 ));
b pred = (dt << get as matrix)[0, 14 :: 83];
obj << Select Fit( "Validation", Where( N > 1 ) );
obj << Save Prediction Formulas( 1 );
pred = (dt << get as matrix)[0, 84 :: 153];
Code Explanation:
- Open data table;
- Create new binary column.
- Run Model Screening.
- Set model parameters.
- Generate report.
- Save Naive Bayes prediction formula.
- Save Bootstrap Forest prediction formula.
- Save Boosted Tree prediction formula.
- Save K Nearest Neighbors prediction formula.
- Save Naive Bayes probability formula.
- Save Neural network formulas.
- Save SVM probability formula.
- Save Nominal Logistic Fit probability formula.
- Save Generalized Regression prediction formula.
- Extract base predictions.
- Select validation fits.
- Save overall prediction formulas.
- Extract final predictions.
Example 7
Summary: Fits a standard least squares model with multiple effects and generating a profiler plot, utilizing Model Screening and Naive Bayes algorithms.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Y Nominal Num", numeric, nominal, formula( If( :Y > 200, 100, :Y > 150 & :Y <= 200, 50, :Y <= 150, 10 ) ) );
obj = dt << Model Screening(
Y( :Y Nominal Num ),
X( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Naive Bayes( 1 ),
Set Random Seed( 24680 )
);
rpt = obj << report;
Log Capture(
(rpt["Details"]["Partition for Y Nominal Num"] << get scriptable object) << Save Prediction Formula( 1 );
(rpt["Details"]["Bootstrap Forest for Y Nominal Num"] << get scriptable object) << Save Prediction Formula( 1 );
(rpt["Details"]["K Nearest Neighbors"]["Y Nominal Num"] << get scriptable object) << Save Prediction Formula( 10 );
(rpt["Details"]["Naive Bayes"] << get scriptable object) << Save Probability Formula( 1 );
(rpt["Details"]["Neural"] << get scriptable object) << (Fit[1] << Save Formulas( 1 ));
(rpt["Details"]["Support Vector Machine"] << get scriptable object) << (Fit[1] << Save Probability Formula( 1 ));
(rpt["Details"]["Nominal Logistic Fit for Y Nominal Num"] << get scriptable object) << Save Probability Formula( 1 );
(rpt["Details"]["Generalized Regression for Y Nominal Num"] << get scriptable object) << (Fit[1] << Save Prediction Formula( 1 ));
b pred = (dt << get as matrix)[0, 14 :: 80];
obj << Select Fit( "Validation", Where( N > 1 ) );
obj << Save Prediction Formulas( 1 );
pred = (dt << get as matrix)[0, 81 :: 147];
);
Code Explanation:
- Open data table;
- Create new column "Y Nominal Num".
- Run Model Screening.
- Specify Y and X variables.
- Use Validation column.
- Enable Naive Bayes.
- Set random seed.
- Get model report.
- Save prediction formulas.
- Save probability formulas.
Example 8
Summary: Fits a standard least squares model with multiple effects and generating a profiler plot, utilizing Model Screening and various algorithms to analyze data.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Y Ordinal Num", numeric, ordinal, formula( If( :Y > 200, 100, :Y > 150 & :Y <= 200, 50, :Y <= 150, 10 ) ) );
obj = dt << Model Screening(
Y( :Y Ordinal Num ),
X( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Naive Bayes( 1 ),
Partial Least Squares( 1 ),
Set Random Seed( 24680 ),
Profiler( 1 )
);
rpt = obj << report;
(rpt["Details"]["Partition for Y Ordinal Num"] << get scriptable object) << Save Prediction Formula( 1 );
(rpt["Details"]["Bootstrap Forest for Y Ordinal Num"] << get scriptable object) << Save Prediction Formula( 1 );
(rpt["Details"]["K Nearest Neighbors"]["Y Ordinal Num"] << get scriptable object) << Save Prediction Formula( 10 );
(rpt["Details"]["Naive Bayes"] << get scriptable object) << Save Probability Formula( 1 );
(rpt["Details"]["Neural"] << get scriptable object) << (Fit[1] << Save Formulas( 1 ));
(rpt["Details"]["Ordinal Logistic Fit for Y Ordinal Num"] << get scriptable object) << Save Probability Formula( 1 );
(rpt["Details"]["Generalized Regression for Y Ordinal Num"] << get scriptable object) << (Fit[1] << Save Prediction Formula( 1 ));
b pred = (dt << get as matrix)[0, 14 :: 84];
obj << Select Fit( "Validation", Where( N > 1 ) );
Log Capture( obj << Save Prediction Formulas( 1 ) );
pred = (dt << get as matrix)[0, 85 :: 155];
Code Explanation:
- Open data table;
- Create new column "Y Ordinal Num".
- Run Model Screening.
- Specify response and predictors.
- Set validation method.
- Enable Naive Bayes, PLS.
- Set random seed.
- Enable Profiler.
- Get model report.
- Save prediction formulas for various models.
- Extract baseline predictions.
- Select fits based on validation.
- Capture log for saving prediction formulas.
- Extract final predictions.