LabVIEW Analytics and Machine Learning Toolkit API Reference

Content Type
Programming Language
Current manual

Initialize Classification Model (NN) VI

Initialize Classification Model (NN) VI

Owning Palette: Classification VIs

Requires: Analytics and Machine Learning Toolkit

Initializes the hyperparameters of the neural network (NN) algorithm. You can either directly set the hyperparameters or specify multiple values for each hyperparameter. If you specify multiple values for each hyperparameter, the Train Classification Model VI uses grid search to find the optimal set of hyperparameters. This VI supports single hidden layers only.

Examples

Set Parameters

hyperparameters specifies the hyperparameters of the neural network model.
number of hidden neurons specifies the number of neurons in the hidden layer. The default is 5.
hidden layer type specifies the activation function type in the neurons of the hidden layer.

This VI supports the following activation functions for the hidden layer:

Function typeDefinitionDescription
Sigmoid functionx is the activation value of the hidden neuron.
Tanh functionx is the activation value of the hidden neuron.
Rectified linear unit functionx is the activation value of the hidden neuron.


0Sigmoid (default)—Sigmoid function
1Tanh—Tanh function
2ReLU—Rectified linear unit function
output layer type specifies the activation function type in the neurons of the output layer.

This VI supports the following activation functions for the output layer:

Function typeDefinitionDescription
Sigmoid functionx is the activation value of the output neuron.
Softmax functionx is the activation value of the output neuron and n is the number of classes.


0Sigmoid (default)—Sigmoid function
1Softmax—Softmax function
cost function type specifies the type of the cost function. cost function type is always Cross-entropy if output layer type is Softmax.

This VI supports the following cost functions:

Function typeDefinitionDescription
Quadratic functiont is the target value, y is the output value, and l is the number of training samples.
Cross-entropy functiont is the target value, y is the output value, l is the number of training samples, and n is the number of classes.


0Quadratic (default)—Quadratic function
1Cross-entropy—Cross-entropy function
tolerance specifies the tolerance for the stopping criteria. The default is 0.0001. The model fitting stops if the change of training error between two successive optimization iterations is lower than tolerance.
max iteration specifies the maximum number of optimization iterations for the stopping criteria. The default is 1000. The model fitting stops if the number of optimization iterations reaches max iteration.
cross validation configuration specifies settings for cross validation.
enable? specifies whether this VI enables cross validation in model training. The default is FALSE, which specifies that this VI disables cross validation in model training.

If enable? is TRUE, the Train Classification Model VI can return confusion matrix and metrics.
number of folds specifies the number of sections that this VI divides the training data into. The default is 3. One section is test data, and the remaining sections are training data. The Evaluate Classification Model VI repeats the cross-validation process for n times, where n equals number of folds.
metric configuration specifies the configuration for the evaluation metric in cross validation.
average method specifies the averaging method for this VI to calculate metric values for multiclass classification.

0Micro (default)—Calculates metric values for each sample and returns the mean of the metric values for all samples.
1Macro—Calculates the metric values for each label and returns the mean of the metric values for all labels.
2Weighted—Calculates the metric values for each label and returns the mean of weighted metric values for all labels. The number of true cases in a label determines the weight of the metric value of the label.
3Binary—Calculates the metric values for the class that positive label specifies.
positive label specifies the label of the class to calculate metric values. The default is 0. This input is valid only if average method is Binary.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
untrained neural network model returns the initialized neural network model for training.
error out contains error information. This output provides standard error out functionality.

Search Parameters

hyperparameter grids specifies multiple values for each hyperparameter of the neural network model.
number of hidden neurons specifies the number of neurons in the hidden layer.
hidden layer type specifies the activation function type in the neurons of the hidden layer.

This VI supports the following activation functions for the hidden layer:

Function typeDefinitionDescription
Sigmoid functionx is the activation value of the hidden neuron.
Tanh functionx is the activation value of the hidden neuron.
Rectified linear unit functionx is the activation value of the hidden neuron.


0Sigmoid—Sigmoid function
1Tanh—Tanh function
2ReLU—Rectified linear unit function
output layer type specifies the activation function type in the neurons of the output layer.

This VI supports the following activation functions for the output layer:

Function typeDefinitionDescription
Sigmoid functionx is the activation value of the output neuron.
Softmax functionx is the activation value of the output neuron and n is the number of classes.


0Sigmoid—Sigmoid function
1Softmax—Softmax function
cost function type specifies the type of the cost function. cost function type is always Cross-entropy if output layer type is Softmax.

This VI supports the following cost functions:

Function typeDefinitionDescription
Quadratic functiont is the target value, y is the output value, and l is the number of training samples.
Cross-entropy functiont is the target value, y is the output value, l is the number of samples of training samples, and n is the number of classes.


0Quadratic—Quadratic function
1Cross-entropy—Cross-entropy function
tolerance specifies the tolerance for the stopping criteria. The model fitting stops if the change of training error between two successive optimization iterations is lower than tolerance.
max iteration specifies the maximum number of optimization iterations for the stopping criteria. The model fitting stops if the number of optimization iterations reaches max iteration.
hyperparameter optimization specifies the method of optimization to determine the optimal hyperparameter settings.
hyperparameter search method specifies the method to search for the optimal set of hyperparameters.

0Exhaustive search (default)—Tests all possible hyperparameter combinations in the training process. This method is reliable but time-consuming.
1Random search—Tests a random subset of the hyperparameter combinations in the training process. This method is faster.
number of searchings specifies the number of hyperparameter combinations that this VI selects to train the model. The default is 1. This input is valid only if hyperparameter search method is Random search.
evaluation metric specifies the metric to evaluate the trained model with different hyperparameter combinations. The Train Classification Model VI finds the optimal hyperparameter set based on evaluation metric.

0Accuracy
1Precision
2Recall
3F1 score
cross validation configuration specifies settings for cross validation.
number of folds specifies the number of sections that this VI divides the training data into. The default is 3. One section is test data, and the remaining sections are training data. The Evaluate Classification Model VI repeats the cross-validation process for n times, where n equals number of folds.
metric configuration specifies the configuration for the evaluation metric in cross validation.
average method specifies the averaging method for this VI to calculate metric values for multiclass classification.

0Micro (default)—Calculates metric values for each sample and returns the mean of the metric values for all samples.
1Macro—Calculates the metric values for each label and returns the mean of the metric values for all labels.
2Weighted—Calculates the metric values for each label and returns the mean of weighted metric values for all labels. The number of true cases in a label determines the weight of the metric value of the label.
3Binary—Calculates the metric values for the class that positive label specifies.
positive label specifies the label of the class to calculate metric values. The default is 0. This input is valid only if average method is Binary.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
untrained neural network model returns the initialized neural network model for training.
error out contains error information. This output provides standard error out functionality.

Examples

Refer to the following VIs for examples of using the Initialize Classification Model (NN) VI:

  • Classification (Set Parameters, Training) VI: labview\examples\AML\Classification
  • Classification (Search Parameters, Training) VI: labview\examples\AML\Classification
Was this information helpful?