Neural
Example 1
Summary: Opens a data table, defines a neural network model with a binary response variable and multiple predictor variables, specifies validation and missing value handling, sets a random seed, and fits the model using NTanH activation function.
Code:
// Neural of Y Binary
// Open data table
dt = Open("data_table.jmp");
// Neural of Y Binary
Neural(
Y( :Y Binary ),
X(
:Age, :Gender, :BMI, :BP,
:Total Cholesterol, :LDL, :HDL,
:TCH, :LTG, :Glucose
),
Validation( :Validation ),
Informative Missing( 0 ),
Set Random Seed( 1234 ),
Fit( NTanH( 3 ) )
);
Code Explanation:
- Open data table.
- Define neural network model.
- Specify binary response variable.
- List predictor variables.
- Use validation column.
- Handle missing values.
- Set random seed.
- Fit neural network.
- Use NTanH activation function.
- Specify 3 hidden layers.
Example 2
Summary: Generates a neural network analysis to predict HARDNESS based on ABRASION, MODULUS, ELONG, and SILICA, SILANE, SULFUR predictor variables in the data table.
Code:
// Neural
// Open data table
dt = Open("data_table.jmp");
// Neural
Neural(
Y(
:ABRASION, :MODULUS, :ELONG,
:HARDNESS
),
X( :SILICA, :SILANE, :SULFUR ),
Informative Missing( 0 ),
Validation Method(
"Holdback", 0.3333
),
Go,
Profiler( 1 )
);
Code Explanation:
- Open data table.
- Define response variables.
- Define predictor variables.
- Set missing data handling.
- Specify validation method.
- Run neural network analysis.
- Generate profiler.
Example 3
Summary: Generates a neural network analysis to predict ABRASION, MODULUS, ELONG, and HARDNESS using SILICA, SILANE, and SULFUR as predictor variables, with Holdback validation method and NTanH(3) fit.
Code:
Open("data_table.jmp");
Neural(
Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ),
X( :SILICA, :SILANE, :SULFUR ),
Validation Method( "Holdback", 0.3333 ),
Fit(
NTanH( 3 ),
Profiler(
1,
ABRASION << Response Limits(
{Lower( 100, 0.066 ), Middle( 150, 0.5 ), Upper( 200, 0.9819 ), Goal( "Maximize" ), Importance( 0.25 )}
),
MODULUS << Response Limits(
{Lower( 1000, 0.066 ), Middle( 1500, 0.5 ), Upper( 2000, 0.9819 ), Goal( "Maximize" ), Importance( 0.25 )}
),
ELONG << Response Limits(
{Lower( 450, 0.0183 ), Middle( 500, 1 ), Upper( 550, 0.0183 ), Goal( "Match Target" ), Importance( 0.25 )}
),
HARDNESS << Response Limits(
{Lower( 65, 0.0183 ), Middle( 67.5, 1 ), Upper( 70, 0.0183 ), Goal( "Match Target" ), Importance( 0.25 )}
),
Term Value( SILICA( 1.2, Lock( 0 ), Show( 1 ) ), SILANE( 50, Lock( 0 ), Show( 1 ) ), SULFUR( 2.3, Lock( 0 ), Show( 1 ) ) )
),
Plot Actual by Predicted( 1 )
),
SendToReport(
Dispatch( {"Model NTanH(3)"}, "Training", OutlineBox, {Close( 1 )} ),
Dispatch( {"Model NTanH(3)"}, "Validation", OutlineBox, {Close( 1 )} ),
Dispatch( {"Model NTanH(3)", "Actual by Predicted Plot"}, "Neural Model Report", FrameBox,
{Add Pin Annotation(
Seg( Marker Seg( 1 ) ),
Index( 0 ),
Index Row( 9 ),
UniqueID( 1121111184 ),
FoundPt( {350, 308} ),
Origin( {166.292134831461, 152} ),
Offset( {-1, 62} ),
Tag Line( 1 )
)}
)
)
);
Code Explanation:
- Open data table;
- Run Neural network analysis.
- Set response variables.
- Define predictor variables.
- Use Holdback validation method.
- Fit model with NTanH(3).
- Configure Profiler settings.
- Set response limits for ABRASION.
- Set response limits for MODULUS.
- Set response limits for ELONG.
- Set response limits for HARDNESS.
- Set initial term values.
- Generate Actual by Predicted plot.
- Close Training report.
- Close Validation report.
- Add pin annotation to Actual by Predicted plot.
Example 4
Summary: Generates a neural network analysis to predict body fat percentage using demographic and anthropometric variables, with profiler settings for confidence intervals and term locking.
Code:
dt under test = Open("data_table.jmp");
obj = Neural(
Y( :Percent body fat ),
X(
:Name( "Age (years)" ), :Name( "Weight (lbs)" ), :Name( "Height (inches)" ), :Name( "Neck circumference (cm)" ),
:Name( "Chest circumference (cm)" ), :Name( "Abdomen circumference (cm)" ), :Name( "Hip circumference (cm)" ),
:Name( "Thigh circumference (cm)" ), :Name( "Knee circumference (cm)" ), :Name( "Ankle circumference (cm)" ),
:Name( "Biceps (extended) circumference (cm)" ), :Name( "Forearm circumference (cm)" ), :Name( "Wrist circumference (cm)" )
),
set random seed( 47 ),
Validation( :Validation ),
Missing Value Coding( 1 ),
Transform Covariates( 1 ),
Fit(
NTanH( 4 ),
NTanH2( 8 ),
Transform Covariates( 1 ),
Robust Fit( 1 ),
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
Name( "Age (years)" )(44.885, Lock( 0 ), Show( 1 )),
Name( "Weight (lbs)" )(178.92, Lock( 0 ), Show( 1 )),
Name( "Height (inches)" )(70.149, Lock( 0 ), Show( 1 )),
Name( "Neck circumference (cm)" )(37.992, Lock( 0 ), Show( 1 )),
Name( "Chest circumference (cm)" )(100.824, Lock( 0 ), Show( 1 )),
Name( "Abdomen circumference (cm)" )(92.556, Lock( 0 ), Show( 1 )),
Name( "Hip circumference (cm)" )(99.905, Lock( 0 ), Show( 1 )),
Name( "Thigh circumference (cm)" )(59.406, Lock( 0 ), Show( 1 )),
Name( "Knee circumference (cm)" )(38.59, Lock( 0 ), Show( 1 )),
Name( "Ankle circumference (cm)" )(23.102, Lock( 0 ), Show( 1 )),
Name( "Biceps (extended) circumference (cm)" )(32.273, Lock( 0 ), Show( 1 )),
Name( "Forearm circumference (cm)" )(28.664, Lock( 0 ), Show( 1 )),
Name( "Wrist circumference (cm)" )(18.2298, Lock( 0 ), Show( 1 ))
)
),
Plot Actual by Predicted( 1 )
),
SendToReport( Dispatch( {}, "Neural", OutlineBox, {Set Title( "Model NTanH(4)NTanH2(8): Profiler, Plot Actual by Predicted" )} ) )
);
Code Explanation:
- Open data table.
- Define neural network model.
- Set response variable.
- Define predictor variables.
- Set random seed.
- Specify validation column.
- Enable missing value coding.
- Transform covariates.
- Fit neural network model.
- Configure profiler settings.
Example 5
Summary: Creates a neural network model to predict percent body fat using multiple predictor variables, including demographics and anthropometric measurements, with validation, missing value handling, and robust fitting.
Code:
dt under test = Open("data_table.jmp");
obj = Neural(
Y( :Percent body fat ),
X(
:Name( "Age (years)" ), :Name( "Weight (lbs)" ), :Name( "Height (inches)" ), :Name( "Neck circumference (cm)" ),
:Name( "Chest circumference (cm)" ), :Name( "Abdomen circumference (cm)" ), :Name( "Hip circumference (cm)" ),
:Name( "Thigh circumference (cm)" ), :Name( "Knee circumference (cm)" ), :Name( "Ankle circumference (cm)" ),
:Name( "Biceps (extended) circumference (cm)" ), :Name( "Forearm circumference (cm)" ), :Name( "Wrist circumference (cm)" )
),
Validation( :Validation ),
Missing Value Coding( 1 ),
Transform Covariates( 1 ),
Fit(
NTanH( 4 ),
NTanH2( 8 ),
Transform Covariates( 1 ),
Robust Fit( 1 ),
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
Name( "Age (years)" )(44.885, Lock( 0 ), Show( 1 )),
Name( "Weight (lbs)" )(178.92, Lock( 0 ), Show( 1 )),
Name( "Height (inches)" )(70.149, Lock( 0 ), Show( 1 )),
Name( "Neck circumference (cm)" )(37.992, Lock( 0 ), Show( 1 )),
Name( "Chest circumference (cm)" )(100.824, Lock( 0 ), Show( 1 )),
Name( "Abdomen circumference (cm)" )(92.556, Lock( 0 ), Show( 1 )),
Name( "Hip circumference (cm)" )(99.905, Lock( 0 ), Show( 1 )),
Name( "Thigh circumference (cm)" )(59.406, Lock( 0 ), Show( 1 )),
Name( "Knee circumference (cm)" )(38.59, Lock( 0 ), Show( 1 )),
Name( "Ankle circumference (cm)" )(23.102, Lock( 0 ), Show( 1 )),
Name( "Biceps (extended) circumference (cm)" )(32.273, Lock( 0 ), Show( 1 )),
Name( "Forearm circumference (cm)" )(28.664, Lock( 0 ), Show( 1 )),
Name( "Wrist circumference (cm)" )(18.2298, Lock( 0 ), Show( 1 ))
)
),
Plot Actual by Predicted( 1 )
),
SendToReport( Dispatch( {}, "Neural", OutlineBox, {Set Title( "Model NTanH(4)NTanH2(8): Profiler, Plot Actual by Predicted" )} ) )
);
Code Explanation:
- Open table.
- Define neural network model.
- Set response variable.
- Specify predictor variables.
- Use validation column.
- Handle missing values.
- Transform covariates.
- Fit neural network.
- Configure NTanH activation.
- Configure NTanH2 activation.
- Transform covariates again.
- Enable robust fitting.
- Create profiler.
- Display confidence intervals.
- Set term values.
- Plot actual vs. predicted.
- Rename report title.
Example 6
Summary: Creates and configures a neural network model to predict height based on sex, utilizing holdback validation method and NTanH activation function.
Code:
dt = Open("data_table.jmp");
obj = Neural(
Y( :height ),
X( :sex ),
Informative Missing( 0 ),
Validation Method( "Holdback", 0.3333 ),
Fit( NTanH( 3 ) ),
Set Random Seed( 1 )
);
obj << save formulas;
mp1 = obj << Publish Prediction Formula;
mp1 << Copy Formula as function;
code = Get Clipboard();
Code Explanation:
- Open data table.
- Create neural network model.
- Set response variable.
- Add predictor variable.
- Disable informative missing handling.
- Use holdback validation method.
- Specify NTanH activation function.
- Set random seed for reproducibility.
- Save prediction formulas.
- Publish prediction formula.
Example 7
Summary: Generates a neural network analysis to identify significant factors affecting log life in the Weld-Repaired Castings dataset, generating reports and visualizing results through contour and surface profilers.
Code:
dt = Open("data_table.jmp");
nn = Neural( Y( :ABRASION ), X( :SILICA ) );
rpt = Report( nn );
rpt[Button Box( 1 )] << Click;
spex = Try(
rpt["Response Grid Slider"];
1;
,
0
);
nn << Contour Profiler;
nn << Surface Profiler;
spex = Try(
rpt["Response Grid Slider"];
1;
,
0
);
nn << close window;
Delete Symbols( rpt, cpex, spex, nn );
nn = Neural( Y( :ABRASION ), X( :SILICA, :SILANE ) );
rpt = Report( nn );
rpt[Button Box( 1 )] << Click;
spex = Try(
rpt["Response Grid Slider"];
1;
,
0
);
nn << Contour Profiler;
nn << Surface Profiler;
spex = Try(
rpt["Response Grid Slider"];
1;
,
0
);
nn << close window;
Delete Symbols( rpt, cpex, spex, nn );
nn = Neural( Y( :ABRASION ), X( :SILICA, :SILANE, :SULFUR ) );
rpt = Report( nn );
rpt[Button Box( 1 )] << Click;
spex = Try(
rpt["Response Grid Slider"];
1;
,
0
);
nn << Contour Profiler;
nn << Surface Profiler;
spex = Try(
rpt["Response Grid Slider"];
1;
,
0
);
nn << close window;
Delete Symbols( rpt, cpex, spex, nn );
Code Explanation:
- Open data table;
- Create neural network model.
- Generate report.
- Click first button box.
- Check for response grid slider.
- Open contour profiler.
- Open surface profiler.
- Check for response grid slider again.
- Close neural network window.
- Delete symbols.
- Repeat steps 2-10 with additional predictors.
Example 8
Summary: Creates and configures a neural network model to predict sex based on height and weight, with interactive profiling capabilities.
Code:
dt = Open("data_table.jmp");
nn = Neural(
Y( :sex ),
X( :height, :weight ),
Missing Value Coding( 0 ),
Fit( NTanH( 3 ), Profiler( 1, Set to Data in Row( 1 ) ) ),
set random seed( 123456789 )
);
rpt = Report( nn );
expval = (dt:height << Get Values)[1] || (dt:weight << Get Values)[1];
actval = rpt[Outline Box( "Prediction Profiler" )][Number Edit Box( 1 )] << Get;
actval ||= rpt[Outline Box( "Prediction Profiler" )][Number Edit Box( 2 )] << Get;
expval = (dt:height << Get Values)[20] || (dt:weight << Get Values)[20];
actval = rpt[Outline Box( "Prediction Profiler" )][Number Edit Box( 1 )] << Get;
actval ||= rpt[Outline Box( "Prediction Profiler" )][Number Edit Box( 2 )] << Get;
expval = [50.25 165];
rpt[Outline Box( "Prediction Profiler" )][Number Edit Box( 1 )] << Set( expval[1] );
rpt[Outline Box( "Prediction Profiler" )][Number Edit Box( 2 )] << Set( expval[2] );
actval = rpt[Outline Box( "Prediction Profiler" )][Number Edit Box( 1 )] << Get;
actval ||= rpt[Outline Box( "Prediction Profiler" )][Number Edit Box( 2 )] << Get;
Code Explanation:
- Open data table;
- Create neural network model.
- Set response variable to sex.
- Include height and weight as predictors.
- Use tanh activation function with 3 neurons.
- Enable profiler and set initial values from row 1.
- Set random seed for reproducibility.
- Generate report from model.
- Retrieve first data point's height and weight.
- Get predicted value from profiler for first data point.
- Retrieve 20th data point's height and weight.
- Get predicted value from profiler for 20th data point.
- Set custom input values (50.25, 165).
- Update profiler with new input values.
- Get predicted value from profiler for custom input.
Example 9
Summary: Fits a neural network model to predict log life in weld-repaired castings, generating reports for validation and training, and extracting key metrics such as Generalized R* and -LogLikelihood.
Code:
dt = Open("data_table.jmp");
nn = Neural( Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ), X( :SILICA, :SILANE, :SULFUR ), Missing Value Coding( 0 ), Fit( NTanH( 3 ) ) );
befAA = Associative Array( Window() << get window title );
nn << Make SAS Data Step;
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
Window( (aftlst = aftAA << get keys)[1] ) << close window( 1 );
rpt = Report( nn );
ls1 = rpt[Outline Box( "Validation" )][String Col Box( 2 )] << Get;
ls2 = rpt[Outline Box( "Training" )][String Col Box( 4 )] << Get;
grs = Try( preorder2( rpt, {"Generalized R*"} )[1], [] );
nll = Try( preorder2( rpt, {"-LogLikelihood"} )[1], [] );
isPro = 1;
If( isPro,
dt << New Column( "val", Numeric, Continuous, Set Values( J( N Rows( dt ), 1, Random Integer( 1, 3 ) ) ) );
n2 = Neural( Y( :ABRASION, :MODULUS ), X( :SILICA, :SILANE, :SULFUR ), Fit( NTanh( 5 ) ), Validation( :val ) );
rpt = Report( n2 );
grs = Try( preorder2( rpt, {"Generalized R*"} )[1], [] );
nll = Try( preorder2( rpt, {"-LogLikelihood"} )[1], [] );
);
Code Explanation:
- Open data table;
- Fit neural network model.
- Store initial window titles.
- Generate SAS data step.
- Store updated window titles.
- Close unnecessary windows.
- Extract validation report.
- Extract training report.
- Try extracting Generalized R*.
- Try extracting -LogLikelihood.
Example 10
Summary: Create and evaluate a neural network model to predict species based on sepal length, sepal width, petal length, and petal width, utilizing Missing Value Coding and NTanH activation function.
Code:
dt = Open("data_table.jmp");
obj = Neural( Y( :Species ), X( :Sepal length, :Sepal width, :Petal length, :Petal width ), Missing Value Coding( 0 ), Fit( NTanH( 3 ) ) );
rpt = Report( obj );
trn = Contains( rpt[Outline Box( "Training" )][String Col Box( 1 )] << get, "-LogLikelihood" ) > 0;
val = Contains( rpt[Outline Box( "Validation" )][String Col Box( 1 )] << get, "-LogLikelihood" ) > 0;
obj << Local Data Filter;
Code Explanation:
- Open data table;
- Create neural network model.
- Set response variable.
- Specify predictor variables.
- Handle missing values.
- Choose activation function.
- Generate model report.
- Check training log-likelihood.
- Check validation log-likelihood.
- Add local data filter.
Example 11
Summary: Fits a neural network model to predict weight based on height and age, with profiler report generation.
Code:
dt = Open("data_table.jmp");
o2 = dt << Neural( Y( :weight ), X( :height, :age ), Fit( NTanH( 1 ), Go ) );
o2 << (Fit[1] << Profiler( 1, Independent Uniform Inputs( 1 ), Independent Resampled Inputs( 1 ), Dependent Resampled Inputs( 1 ) ));
Code Explanation:
- Open data table;
- Fit neural network model.
- Set response variable: weight.
- Include predictors: height, age.
- Use NTanH activation function.
- Start fitting process.
- Access first fit object.
- Generate profiler report.
- Enable independent uniform inputs.
- Enable independent resampled inputs.
- Enable dependent resampled inputs.
Example 12
Summary: Generates a neural network analysis to predict weight based on height and sex, utilizing holdback validation and profile formulas.
Code:
dt = Open("data_table.jmp");
(dt:sex)[1] = "";
obj1 = dt << Neural(
Y( :weight ),
X( :height, :sex ),
Missing Value Coding( 1 ),
Validation Method( "Holdback", 0.3333 ),
Fit( NTanH( 1 ), Profiler( 1 ) ),
);
col1 = obj1 << Save Profile Formulas;
obj1 << (Fit[1] << Profiler( Dependent Resampled Inputs( 1 ) ));
col2 = obj1 << Save Profile Formulas;
Code Explanation:
- Open data table.
- Modify first sex value.
- Launch Neural platform.
- Set weight as response.
- Include height and sex as predictors.
- Use missing value coding.
- Apply holdback validation method.
- Fit neural network model.
- Save profile formulas.
- Enable profiler for fit.
- Save updated profile formulas.
Example 13
Summary: Creates and fits a neural network model using KFold validation to predict ABRASION, MODULUS, ELONG, and HARDNESS based on SILICA, SILANE, and SULFUR.
Code:
dt = Open("data_table.jmp");
obj = Neural( Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ), X( :SILICA, :SILANE, :SULFUR ), Validation Method( "KFold", 7 ), Go );
s = dt << Select All Rows;
s << Delete Rows;
obj << (Fit[1] << Save Valiation( 1 ));
Code Explanation:
- Open data table;
- Create neural network model.
- Set predictors: SILICA, SILANE, SULFUR.
- Set responses: ABRASION, MODULUS, ELONG, HARDNESS.
- Use KFold validation with 7 folds.
- Fit the neural network model.
- Select all rows in dataset.
- Delete all selected rows.
- Save validation results for first fit.
- Close script.
Example 14
Summary: Generates a neural network model to predict ABRASION, MODULUS, ELONG, and HARDNESS using SILICA, SILANE, and SULFUR as predictor variables, with KFold validation and profile formula saving.
Code:
dt = Open("data_table.jmp");
obj = Neural( Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ), X( :SILICA, :SILANE, :SULFUR ), Validation Method( "KFold", 7 ), Go );
s = dt << Select All Rows;
s << Delete Rows;
obj << (Fit[1] << Save Profile Formulas( 1 ));
Code Explanation:
- Open data table;
- Create neural network model.
- Set response variables.
- Set predictor variables.
- Use KFold validation with 7 folds.
- Run the model.
- Select all rows in dataset.
- Delete all rows from dataset.
- Save profile formulas for first fit.
- Close script.
Example 15
Summary: Create and train a neural network model using the Weld-Repaired Castings dataset, with KFold validation and fast formula saving.
Code:
dt = Open("data_table.jmp");
obj = Neural( Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ), X( :SILICA, :SILANE, :SULFUR ), Validation Method( "KFold", 7 ), Go );
s = dt << Select All Rows;
s << Delete Rows;
obj << (Fit[1] << Save Fast Formulas( 1 ));
Code Explanation:
- Open data table;
- Create neural network model.
- Set response variables.
- Set predictor variables.
- Use KFold validation with 7 folds.
- Run the model.
- Select all rows in dataset.
- Delete all rows from dataset.
- Save fast formulas for first fit.
- Save formulas to dataset.
Example 16
Summary: Generates a neural network analysis to identify significant factors affecting log life in the Weld-Repaired Castings dataset, utilizing KFold validation and transforming covariates.
Code:
dt = Open("data_table.jmp");
obj = Neural(
Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ),
X( :SILICA, :SILANE, :SULFUR ),
Validation Method( "KFold", 7 ),
Transform Covariates( 1 )
);
s = dt << Select All Rows;
s << Delete Rows;
Log Capture( obj << Go );
Code Explanation:
- Open data table;
- Define neural network model.
- Set response variables.
- Set predictor variables.
- Use KFold validation with 7 folds.
- Transform covariates.
- Select all rows in dataset.
- Delete selected rows.
- Capture log output.
- Run neural network model.
Example 17
Summary: Create and execute a neural network model to predict log life in weld-repaired castings, utilizing KFold validation and robust fitting.
Code:
dt = Open("data_table.jmp");
obj = Neural(
Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ),
X( :SILICA, :SILANE, :SULFUR ),
Validation Method( "KFold", 7 ),
Robust Fit( 1 )
);
s = dt << Select All Rows;
s << Delete Rows;
Log Capture( obj << Go );
Code Explanation:
- Open data table;
- Create neural network model.
- Set response variables.
- Set predictor variables.
- Use KFold validation.
- Enable robust fitting.
- Select all rows in data table.
- Delete selected rows.
- Capture log output.
- Run neural network model.
Example 18
Summary: Generates a neural network analysis to predict response variables using specified predictor variables, with validation through k-fold cross-validation.
Code:
dt = Open("data_table.jmp");
obj = dt << Neural( Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ), X( :SILICA, :SILANE, :SULFUR ), Validation Method( "KFold", 7 ) );
dt << Delete Column( :ABRASION );
obj << Go;
Code Explanation:
- Open data table.
- Create neural network model.
- Specify response variables.
- Specify predictor variables.
- Set validation method.
- Remove abrasion column.
- Run neural network.
Example 19
Summary: Creates a neural network model to predict hardness, using KFold validation and deleting the ABRASION column, with the option to generate a SAS data step.
Code:
dt = Open("data_table.jmp");
obj = dt << Neural( Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ), X( :SILICA, :SILANE, :SULFUR ), Validation Method( "KFold", 7 ), Go );
dt << Delete Column( :ABRASION );
obj << (Fit[1] << Make SAS Data Step( 1 ));
Code Explanation:
- Open data table;
- Create neural network model.
- Set response variables.
- Set predictor variables.
- Use KFold validation.
- Perform model fitting.
- Delete ABRASION column.
- Generate SAS data step.
- Select first fit.
- Save SAS data step.
Example 20
Summary: Creates a neural network model to predict ABRASION, utilizing SILICA, SILANE, and SULFUR as predictors, with holdback validation and desirability formula generation.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Neural(
Y( :ABRASION ),
X( :SILICA, :SILANE, :SULFUR ),
Informative Missing( 0 ),
Validation Method( "Holdback", 0.3333 ),
Set Random Seed( 123 ),
Fit( NTanH( 3 ) )
);
obj1 << (Fit[1] << Save Fast Formulas( 1 ));
obj1 << (Fit[1] << Profiler( 1, Save Desirability Formula ));
obj2 = Profiler( Y( :Predicted ABRASION ), Save Desirability Formula );
val1 = dt:Desirability << get values;
val2 = dt:Desirability 2 << get values;
Code Explanation:
- Open data table;
- Create neural network model.
- Set response variable to ABRASION.
- Use SILICA, SILANE, SULFUR as predictors.
- Disable informative missing handling.
- Use holdback validation with 33% test set.
- Set random seed to 123 for reproducibility.
- Fit neural network with 3 hidden nodes.
- Save fast formulas for predictions.
- Generate profiler with desirability formula.
Example 21
Summary: Fits a neural network model to predict log life in Weld-Repaired Castings dataset, utilizing bagged predictions and profiling for model evaluation.
Code:
dt = Open("data_table.jmp");
obj = Neural( Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ), X( :SILICA, :SILANE, :SULFUR ), Crossvalidation( No Crossvalidation ), Go );
obj << Profiler( Save Bagged Predictions( 2, Random Seed( 12345 ) ) );
latest = Column( 29 ) << getasmatrix;
Close( dt, nosave );
previous = [61.1503772921641, 64.6523126221598, 58.5239257946674, 67.403833238585, 57.2732346053832, 59.7746169839516, 65.2776582168019,
59.1492713893095, 63.2765523139472, 62.6512067193051, 57.6484419621685, 61.5255846489494, 62.4010684814483, 61.1503772921641,
59.1492713893095, 59.3994096271663, 60.6501008164505, 67.0286258817998, 59.7746169839516, 59.89968610288, 60.9002390543073,
61.6506537678778, 64.1520361464462, 60.7751699353789, 63.2765523139472, 61.6506537678778, 63.4016214328756, 60.7751699353789,
63.2765523139472, 65.2776582168019, 63.1514831950188, 62.4010684814483, 62.2759993625199, 62.5261376003767, 63.2765523139472,
63.6517596707325, 65.2776582168019, 63.7768287896609, 66.0280729303724, 70.7806994496522];
Code Explanation:
- Open data table;
- Fit neural network model.
- Enable Profiler with bagged predictions.
- Retrieve latest predictions.
- Close dataset without saving.
- Define previous predictions list.
Example 22
Summary: Fits a neural network model to predict log life in weld-repaired castings, generating profiler output and saving bagged predictions.
Code:
dt = Open("data_table.jmp");
obj = Neural( Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ), X( :SILICA, :SILANE, :SULFUR ), Crossvalidation( No Crossvalidation ), Go );
obj << Profiler( Save Bagged Predictions( 2, Random Seed( 12345 ) ) );
latest = Column( 29 ) << getasmatrix;
Code Explanation:
- Open data table;
- Fit neural network model.
- Configure no cross-validation.
- Run the model.
- Generate profiler output.
- Save bagged predictions.
- Set random seed.
- Retrieve latest column.
- Convert column to matrix.
- Store matrix in variable.
Example 23
Summary: Generates a neural network model to predict Single Status based on various demographic and job satisfaction factors, utilizing missing value coding and holdback validation method.
Code:
dt = Open("data_table.jmp");
obj = dt << Neural(
Y( :Single Status ),
X(
:Age in Years, :Age Group, :Years at Current Employer, :Employee Tenure, :Years in Current Position, :Position Tenure, :Salary,
:Salary Group, :Job Satisfaction
),
Missing Value Coding( 0 ),
Validation Method( Holdback, 0.3333 ),
Fit( NTanH( 3 ), Profiler( 1, Confidence Intervals( 1 ) ) )
);
rpt = obj << report;
predProfScptObj = rpt[Outline Box( "Prediction Profiler" )] << get scriptable object;
Match( Random Integer( 1, 3 ),
1, predProfScptObj << Independent Uniform Inputs( 1 ),
2, predProfScptObj << Independent Resampled Inputs( 1 ),
3, predProfScptObj << Dependent Resampled Inputs( 1 )
);
Code Explanation:
- Open data table.
- Run neural network model.
- Specify response variable.
- Define predictor variables.
- Set missing value coding.
- Choose validation method.
- Fit model with tanh activation.
- Enable profiler with confidence intervals.
- Extract prediction profiler report.
- Randomly select input type for profiler.
Neural using Set Name
Summary: Define and apply neural model presets for data analysis, utilizing JMP's Neural platform to fit models and generate reports.
Code:
plat_samples = ["Neural" => {"Default Model with Profiler"}, => {}];
dt = Open("data_table.jmp");
:Y << Set Name( "Y Var" );
For Each( {sample}, plat_samples["Neural"],
obj = Neural( Y( :Y Var ), X( :Age, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ), Go );
Eval( Eval Expr( obj << Apply Preset( "Sample Presets", Expr( sample ) ) ) );
obj << Set Report Title( sample );
);
Code Explanation:
- Define presets for neural models.
- Open data table;
- Rename Y column.
- Iterate over neural samples.
- Fit neural network model.
- Apply preset configuration.
- Set report title.
Neural using Set Values
Summary: Generates a neural network analysis with missing value coding and validation, generating two reports with journals for comparison.
Code:
dt = Open("data_table.jmp");
:ABRASION << Set Values( [999] );
obj = Neural(
Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ),
X( :SILICA, :SILANE, :SULFUR ),
Missing Value Coding( 0 ),
Validation Method( Holdback, 0.3333 ),
Fit( NTanH( 3 ), Plot Actual by Predicted( 1 ) )
);
rpt1 = obj << Report;
expr1 = rpt1 << Get Journal;
:ABRASION << Set Property( "Missing Value Codes", 999 );
obj2 = obj << Redo Analysis;
rpt2 = obj2 << Report;
expr2 = obj2 << get Journal;
actN = Equal( expr1, expr2 );
Code Explanation:
- Open data table;
- Set ABRASION missing value to 999.
- Perform neural network analysis.
- Save first report object.
- Extract first journal from report.
- Set ABRASION missing value property to 999.
- Redo analysis with updated settings.
- Save second report object.
- Extract second journal from report.
- Compare two journals for equality.
Neural using If
Example 1
Summary: Runs a data analysis workflow in JMP Pro, performing Lasso regression and neural network modeling to extract model summaries and predicting properties.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt = Open("data_table.jmp");
obj1 = dt << Run Script( "Lasso" );
obj1 << (Fit[1] << Save Prediction Formula);
rpt1 = obj1 << report;
s1 = (rpt1["Model Summary"][Table Box( 2 )] << get as matrix)[8, 1];
prop1 = dt:Y Prediction Formula << Get Property( "Predicting" );
obj2 = dt << Neural(
Y( :Y ),
X( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Informative Missing( 0 ),
Set Random Seed( 1234 ),
Fit( NTanH( 3 ) )
);
obj2 << (Fit[1] << Save Fast Formulas);
rpt2 = obj2 << report;
s2 = (rpt2["Training"][Table Box( 1 )] << get as matrix)[2, 1];
prop2 = dt:Predicted Y << Get Property( "Predicting" );
Close( dt, no save );
);
Code Explanation:
- Check if JMP Pro is installed.
- Open data table;
- Run Lasso script on dataset.
- Save prediction formula from Lasso.
- Extract model summary from Lasso report.
- Get predicting property from Lasso formula.
- Perform neural network analysis on dataset.
- Save fast formulas from neural network.
- Extract training report from neural network.
- Get predicting property from neural network formula.
Example 2
Summary: Generates a neural network analysis to predict survival outcomes in the Titanic dataset, utilizing JMP Pro's predictive modeling capabilities.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
n1 = N Items( dt << get column names( string ) );
obj = dt << Neural(
Y( :Survived ),
X( :Passenger Class, :Sex, :Age, :Siblings and Spouses, :Parents and Children, :Fare, :Port, :Lifeboat ),
Informative Missing( 1 ),
Fit
);
obj << Save Formulas( 1 );
prob1 = (dt:Name( "Probability(Survived=No)" ) << get values) || (dt:Name( "Probability(Survived=Yes)" ) << get values);
pred1 = dt:Most Likely Survived << get values( 1 );
dt << Delete Columns( n1 + 1 :: N Cols( dt ) );
depot1 = obj << Publish Prediction Formula( 1 );
depot1 << Run Script( 1 );
prob2 = (dt:Name( "Probability(Survived=No)" ) << get values) || (dt:Name( "Probability(Survived=Yes)" ) << get values);
pred2 = dt:Most Likely Survived << get values( 1 );
Close( dt, no save );
Window( "Formula Depot" ) << close window( 1 );
);
Code Explanation:
- Check if JMP Pro is installed.
- Open data table;
- Count initial columns.
- Fit neural network model.
- Save prediction formulas.
- Retrieve survival probabilities.
- Retrieve predicted survival outcomes.
- Remove new columns.
- Publish prediction formula.
- Execute published script.
- Retrieve updated probabilities.
- Retrieve updated predictions.
- Close dataset without saving.
- Close Formula Depot window.
Example 3
Summary: Generates a neural network analysis on the data_table.jmp dataset, generating estimates and visualizing results.
Code:
isPro = 1;
If( isPro,
dt = Open("data_table.jmp");
nn = Neural(
Y( :BAD, :LOAN, :JOB ),
X( :MORTDUE, :VALUE, :REASON, :YOJ, :DEROG, :DELINQ, :CLAGE, :NINQ, :CLNO, :DEBTINC ),
Missing Value Coding( 1 ),
Transform Covariates( 1 ),
Fit(
NLinear( 2 ),
NTanH2( 2 ),
Robust Fit( 1 ),
Penalty Method( "Weight Decay" ),
N Boost( 3 ),
Learning Rate( 0.3 ),
Show Estimates( 1 )
)
);
rpt = Report( nn );
st = rpt[Outline Box( "Estimates" )][String Col Box( 1 )] << get;
np = N Items( st );
ne = N Rows( rpt[Outline Box( "Estimates" )][Number Col Box( 1 )] << Get as Matrix );
Close( dt, No Save );
);
Code Explanation:
- Check if Pro version.
- Open data_table data
- Run Neural Network model.
- Set response variables.
- Set predictor variables.
- Configure missing value coding.
- Transform covariates.
- Define fitting methods.
- Retrieve report estimates.
- Close data without saving.
Example 4
Summary: Generates a neural network analysis on the 'Country' column using JMP Pro, utilizing Type, Weight, Turning Circle, Displacement, and Horsepower as predictors.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
Column( dt, "Country" )[1 :: 5] = "";
obj = dt << Neural(
Y( :Country ),
X( :Type, :Weight, :Turning Circle, :Displacement, :Horsepower ),
Missing Value Coding( 0 ),
Validation Method( Holdback, 0.3333 ),
Go
);
obj << (Fit[1] << Save Validation);
vcol = dt:Validation << get values;
Close( dt, no save );
);
Code Explanation:
- Check if JMP Pro.
- Open data_table data
- Clear first 5 Country entries.
- Run Neural model on Country.
- Use Type, Weight, Turning Circle, Displacement, Horsepower as predictors.
- Set missing value coding to 0.
- Use holdback validation method with 33% data.
- Execute the neural network.
- Save validation results.
- Retrieve validation column values.
- Close the dataset without saving.
Example 5
Summary: Creates and analyzes a neural network model in JMP Pro, selecting setosa species from a data table and generating predicted formulas.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
dt << Select Where( :Species == "setosa" );
dt << Exclude;
dt << Clear Select;
nn1 = dt << Neural( Y( :Sepal length ), X( :Species ), Fit( NTanH( 3 ) ), Set Random Seed( 1000 ) );
nn1 << (Fit[1] << Show Estimates);
nn1 << (Fit[1] << Save Fast Formulas);
formula1 = Char( dt:Predicted Sepal length << Get Formula );
Close( dt, no save );
);
Code Explanation:
- Check if JMP Pro.
- Open data table;
- Select setosa species.
- Exclude selected rows.
- Clear row selection.
- Create neural network model.
- Show fit estimates.
- Save fast formulas.
- Get predicted formula.
- Close dataset without saving.
Example 6
Summary: Generates a neural network model to predict outcomes based on input variables, utilizing the JMP Pro platform and generating a report with confusion matrix.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
dt:DEROG << Set Modeling Type( "Nominal" );
obj = Neural(
Y( :DEROG ),
X( :BAD, :LOAN, :MORTDUE, :VALUE ),
Validation( :Validation ),
Informative Missing( 1 ),
Fit( Confusion Matrix( 1 ) )
);
rpt = obj << report;
nobs = (rpt[Outline Box( "Training" )][Number Col Box( "Value" )] << get as matrix)[7] + (rpt[Outline Box( "Validation" )][
Number Col Box( "Value" )] << get as matrix)[7] + (rpt[Outline Box( "Test" )][Number Col Box( "Value" )] << get as matrix)[7];
Close( dt, no save );
);
Code Explanation:
- Check if JMP Pro.
- Open data_table data
- Set DEROG as Nominal.
- Run Neural network model.
- Specify Y and X variables.
- Use Validation column.
- Enable Informative Missing.
- Generate Confusion Matrix.
- Retrieve report object.
- Calculate total observations.
- Close data table without saving.
Example 7
Summary: Runs the creation and validation of a neural network model using JMP Pro, with actual vs. predicted plots and customizable legend.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj1 = Neural(
Y( :Sepal length ),
X( :Sepal width, :Petal length, :Petal width ),
Informative Missing( 0 ),
Validation Method( "Holdback", 0.3333 ),
Fit( NTanH( 3 ), Plot Actual by Predicted( 1 ) ),
SendToReport(
Dispatch( {"Model NTanH(3)", "Actual by Predicted Plot"}, "Neural Model Report", FrameBox( 1 ),
{Row Legend(
Species,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
);
Close( dt, no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data table;
- Create neural network model.
- Set response variable.
- Define predictor variables.
- Handle missing values.
- Use holdback validation.
- Fit NTanH activation function.
- Plot actual vs. predicted.
- Customize plot legend.
Example 8
Summary: Executes a neural network analysis on a filtered data table, extracting model reports and matrices, and then re-running the analysis with inverted row selection.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj1 = dt << Neural(
Y( :Y ),
X( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Informative Missing( 0 ),
Set Random Seed( 1234 ),
Fit( NTanH( 3 ) ),
Local Data Filter(
Mode( Show( 0 ) ),
Add Filter( columns( :Y, :Gender ), Where( :Y >= 72.77 & :Y <= 346 ), Where( :Gender == 1 ) )
)
);
rpt1 = obj1 << report;
stat1 = rpt1["Model NTanH(3)"][Table Box( 1 )] << get as matrix;
stat2 = rpt1["Model NTanH(3)"][Table Box( 2 )] << get as matrix;
dt << Select Where( :Y >= 72.77 & :Y <= 346 & :Gender == 1 );
dt << Invert Row Selection;
dt << Exclude;
obj2 = dt << Neural(
Y( :Y ),
X( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Informative Missing( 0 ),
Set Random Seed( 1234 ),
Fit( NTanH( 3 ) )
);
rpt2 = obj2 << report;
stat3 = rpt2["Model NTanH(3)"][Table Box( 1 )] << get as matrix;
stat4 = rpt2["Model NTanH(3)"][Table Box( 2 )] << get as matrix;
Close( dt, no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data table;
- Run Neural Network analysis.
- Extract model report.
- Convert tables to matrices.
- Select specific rows.
- Invert row selection.
- Exclude selected rows.
- Run Neural Network again.
- Extract second model report.
Neural using Set Modeling Type
Summary: Creates a neural network model to predict ordinal responses, utilizing holdback validation and specifying informative missing values.
Code:
dt = Open("data_table.jmp");
dt:Y Ordinal << Set Modeling Type( "Nominal" );
obj = dt << Neural(
Y( :Y Ordinal ),
X( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Informative Missing( 0 ),
Validation Method( "Holdback", 0.35 ),
Set Random Seed( 1234 ),
Fit( NTanH( 3 ) )
);
obj << (Fit[1] << Decision Threshold( 1 ));
rpt = obj << report;
test1 = Try( rpt["Decision Tresholds"] << get title, 1 );
Code Explanation:
- Open data table;
- Set Y as nominal.
- Create neural network model.
- Specify predictors.
- Use holdback validation.
- Set random seed.
- Fit model with 3 hidden layers.
- Set decision threshold to 1.
- Generate model report.
- Attempt to get decision threshold title.
Neural using New Column
Example 1
Summary: Fits a neural network model with multiple effects and generates a report, utilizing Holdback validation method and setting decision threshold to 1.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Validation 2", formula( Match( :Y Ordinal, "Low", 0, "Medium", 1, "High", Random Integer( 0, 1 ) ) ) );
dt:Y Ordinal << Set Modeling Type( "Nominal" );
obj = dt << Neural(
Y( :Y Ordinal ),
X( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Informative Missing( 0 ),
Validation Method( "Holdback", 0.35 ),
Set Random Seed( 1234 ),
Fit( NTanH( 3 ) )
);
obj << (Fit[1] << Decision Threshold( 1 ));
rpt = obj << report;
test1 = Try( rpt["Decision Tresholds"] << get title, 1 );
Code Explanation:
- Open data table;
- Create "Validation 2" column.
- Set "Y Ordinal" modeling type to Nominal.
- Run Neural network model.
- Specify "Y Ordinal" as response variable.
- Include multiple predictors in model.
- Use Holdback validation method (35%).
- Set random seed for reproducibility.
- Fit neural network with NTanH activation function.
- Set decision threshold to 1.
- Generate model report.
- Attempt to retrieve "Decision Tresholds" title.
Example 2
Summary: Fits a neural network model to a data table, capturing error messages, and re-running the model with missing values.
Code:
dt = Open("data_table.jmp");
dt << New Column( "missing", character, nominal );
nn = neural( Y( :missing, :country ), X( :sex, :marital status, :age, :size, :type ) );
errmsg = Log Capture( nn << Go );
nn << close window;
cnbef = dt << Get Column Names;
Column( dt, "age" )[3] = .;
lc = Log Capture(
obj = dt << Neural(
Y( :country ),
X( :sex, :marital status, :age, :size, :type ),
Missing Value Coding( 0 ),
Fit( NTanH( 3 ), Save Formulas( 1 ) )
)
);
cnaft = dt << Get Column Names;
Code Explanation:
- Open data table;
- Create new "missing" column.
- Initialize neural network model.
- Execute neural network model.
- Capture error messages.
- Close neural network window.
- Get initial column names.
- Set age value to missing.
- Re-run neural network with missing values.
- Capture log output.
Example 3
Summary: Fits a neural network model with TanH activation to predict sex based on height and weight, utilizing validation and missing value coding.
Code:
bh = Open("data_table.jmp");
bh:sex[1] = "";
bh << New Column( "V", Set Values( Repeat( [1, 0], 20 ) ) );
nnet = bh << Neural( Y( :sex ), X( :height, :weight ), Validation( :V ), Missing Value Coding( 1 ), Fit( NTanH( 3 ), Profiler( 1 ) ) );
rep = Report( nnet )["Validation"]["sex"];
n = (rep[Number Col Box( "Value" )] << get as matrix)[7];
confmatrix = rep[Table Box( 2 )] << get as matrix;
Code Explanation:
- Open data table;
- Clear first sex value.
- Add new column "V".
- Fill "V" with alternating 1s and 0s.
- Run neural network model.
- Specify sex as output.
- Use height and weight as inputs.
- Set validation using column "V".
- Configure missing value coding.
- Fit model with TanH activation.
Neural using Lock Data Table
Summary: Creates and fits a neural network model to predict weight based on height, age, and sex in a data table.
Code:
dt = Open("data_table.jmp");
dt << Lock Data Table( 1 );
obj = dt << Neural( Y( :weight ), X( :height, :age, :sex ), Fit( NTanH( 1 ), Go ) );
obj << (Fit[1] << Save Formulas);
Code Explanation:
- Open data table.
- Lock data table.
- Create neural network model.
- Set response variable to weight.
- Include height, age, sex as predictors.
- Use NTanH activation function.
- Fit the model.
- Save prediction formulas.
Neural using Log Capture
Example 1
Summary: Create and execute a neural network model to predict ABRASION, MODULUS, ELONG, and HARDNESS based on SILICA, SILANE, and SULFUR variables, utilizing KFold validation with 7 folds.
Code:
dt = Open("data_table.jmp");
Log Capture(
obj = Neural(
Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ),
X( :SILICA, :SILANE, :SULFUR ),
Validation Method( "KFold", 7 ),
Transform Covariates( 1 ),
Go
)
);
s = dt << Select All Rows;
s << Delete Rows;
obj << (Fit[1] << Save Formulas( 1 ));
Code Explanation:
- Open data table;
- Log capture begins.
- Create neural network model.
- Set response variables: ABRASION, MODULUS, ELONG, HARDNESS.
- Set predictor variables: SILICA, SILANE, SULFUR.
- Use KFold validation with 7 folds.
- Transform covariates.
- Execute the model.
- Select all rows in table.
- Delete selected rows.
- Save formulas for first fit.
Example 2
Summary: Runs the creation and validation of a neural network model using JMP's Neural platform, generating training and validation matrices for three different models.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture(
obj1 = Neural(
Y( :Y ),
X( :Y, :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Set Random Seed( 123 ),
Fit( NTanH( 3 ) ),
Set Random Seed( 123 ),
Fit( NTanH( 1 ) ),
Set Random Seed( 123 ),
Fit( NTanH( 1 ), NLinear( 1 ), NGaussian( 1 ) )
)
);
rpt1 = obj1 << report;
t1 = rpt1["Model NTanH(3)"]["Training"][Table Box( 1 )] << get as matrix;
v1 = rpt1["Model NTanH(3)"]["Validation"][Table Box( 1 )] << get as matrix;
t2 = rpt1["Model NTanH(1)"]["Training"][Table Box( 1 )] << get as matrix;
v2 = rpt1["Model NTanH(1)"]["Validation"][Table Box( 1 )] << get as matrix;
t3 = rpt1["Model NTanH(1)NLinear(1)NGaussian(1)"]["Training"][Table Box( 1 )] << get as matrix;
v3 = rpt1["Model NTanH(1)NLinear(1)NGaussian(1)"]["Validation"][Table Box( 1 )] << get as matrix;
Close( dt, no save );
b log1 =
"Columns used both in X and Y: A_Feed_S1 D_Feed_S2 E_Feed_S3 Total_Feed_S4 Reactor_Feed_Rate_S6 D_Feed_Flow_Stream_2 E_Feed_Flow_Stream_3 A_Feed_Flow_Stream_1 Total_Feed_Flow_Stream_4";
If( Host is( Windows ),
b fit = [1 -7614.5291091107, 1 -1891.41694794659],
b fit = [1 -6458.20104328074, 1 -1601.56457431546]
);
Code Explanation:
- Open data table;
- Start log capture.
- Create neural network model.
- Set response variable.
- Set predictor variables.
- Specify validation column.
- Set random seed.
- Fit model with NTanH(3).
- Set random seed.
- Fit model with NTanH(1).
Example 3
Summary: Generates a neural network analysis to predict Infant Mortality Rate based on Life Expectancy Ranking, while handling missing values and applying holdback validation.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture(
obj = dt << Neural(
Y( :Infant Mortality Rate ),
X( :Life Expectancy Ranking ),
Informative Missing( 0 ),
Validation Method( "Holdback", 0.3333 ),
Where( Is Missing( :Life Expectancy Ranking ) ),
Go
)
);
Code Explanation:
- Open data table;
- Initialize log capture.
- Start neural network analysis.
- Set Infant Mortality Rate as output.
- Use Life Expectancy Ranking as input.
- Handle missing values.
- Apply holdback validation method.
- Exclude rows with missing Life Expectancy Ranking.
- Run the neural network model.
- Capture the analysis results.
Example 4
Summary: Create and execute a neural network model to predict Infant Mortality Rate based on Life Expectancy Ranking, handling missing data and validating with KFold cross-validation.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture(
obj = dt << Neural(
Y( :Infant Mortality Rate ),
X( :Life Expectancy Ranking ),
Informative Missing( 0 ),
Validation Method( "KFold", 6 ),
Where( Is Missing( :Life Expectancy Ranking ) ),
Go
)
);
Code Explanation:
- Open data table;
- Capture log output.
- Create neural network model.
- Set response variable.
- Set predictor variable.
- Handle missing data.
- Use KFold validation.
- Filter missing data rows.
- Execute model fitting.
- Store model results.
Example 5
Summary: Create and evaluate neural network models using JMP's Neural platform, capturing log data and generating matrices for training and validation sets.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture(
obj1 = Neural(
Y( :Y ),
X( :Y, :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Set Random Seed( 123 ),
Fit( NTanH( 3 ) ),
Set Random Seed( 123 ),
Fit( NTanH( 1 ) ),
Set Random Seed( 123 ),
Fit( NTanH( 1 ), NLinear( 1 ), NGaussian( 1 ) )
)
);
rpt1 = obj1 << report;
t1 = rpt1["Model NTanH(3)"]["Training"][Table Box( 1 )] << get as matrix;
v1 = rpt1["Model NTanH(3)"]["Validation"][Table Box( 1 )] << get as matrix;
t2 = rpt1["Model NTanH(1)"]["Training"][Table Box( 1 )] << get as matrix;
v2 = rpt1["Model NTanH(1)"]["Validation"][Table Box( 1 )] << get as matrix;
t3 = rpt1["Model NTanH(1)NLinear(1)NGaussian(1)"]["Training"][Table Box( 1 )] << get as matrix;
v3 = rpt1["Model NTanH(1)NLinear(1)NGaussian(1)"]["Validation"][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Log capture begins.
- Create neural network model.
- Set response variable.
- Include predictor variables.
- Use validation column.
- Set random seed.
- Fit model with NTanH(3).
- Set random seed again.
- Fit model with NTanH(1).