Kaspersky Machine Learning for Anomaly Detection

Training an ML model predictive element

With Kaspersky MLAD, you can train a predictive element for an ML model that was created manually, imported into Kaspersky MLAD, created from a template, or copied.

System administrators and users who have the Train models permission from the Manage ML models group of rights can train elements of ML models. The functionality is available after a license key is added.

To train an ML model element:

  1. In the main menu, select the Models section.
  2. In the asset tree, select the predictive element that you want to train.

    A list of options appears on the right.

  3. Open the Training tab and click the Edit button in the upper-right corner of the window.
  4. In the Data selection interval field, specify the data time interval on which you want to train the ML model.
  5. To apply markups when selecting data for training the ML model within a selected interval, select one or several markups in the Markups field.

    The selected markups will form a

    .

  6. To view the data that will be selected by the markups, click On graph.

    Markups are displayed in the colors that were specified when they were created.

    You can select a preset when viewing the data on the graph.

  7. If you need to configure extended training settings, turn on Advanced training settings toggle switch.
  8. In Maximum training duration (sec), specify a maximum time in seconds the Kaspersky MLAD server can spend training an ML model.
  9. In the Validation split field, use a decimal value to specify the share of the validation sample as a percentage of the entire dataset used to train the ML model.

    You can specify a value in the range of 0 to 1.

    The default value of this parameter is 0.2.

  10. In the Maximum epoch count field, specify the maximum number of epochs for training the ML model.

    The default value of this parameter is 500.

  11. In the Patience field, specify the number of epochs with no improvement in training quality to wait before stopping the ML model training process early.

    Stopping the ML model training early avoids overfitting of the model. Training in this case is considered to be completed successfully.

    The default value of this parameter is 15.

  12. In the Resolution of training results graphs field, use a decimal value to specify the graph resolution for displaying training results on the Training results tab.

    You can specify a value in the range of 0 to 1.

  13. In the Batch size field, specify the number of selection items that must be sent for training within the iteration.

    The default value of this parameter is 16.

    This parameter is not available for an element with TCN architecture.

  14. In Block count, specify the number of blocks to split the ML model training dataset into.

    The default value of this parameter is 4.

  15. In the Inference mode drop-down list, select one of the following values:
    • If you want to load all datasets for training into RAM, select Fast inference.

      This inference mode allows you to perform inference faster.

    • If you want to load datasets into RAM one at a time, select Memory saving mode.

      This inference mode allows inference to be performed with minimal expenditure of RAM, but it will take place slower than in Fast inference mode.

  16. In the Training mode drop-down list, select one of the following values:
    • To load the entire training dataset into RAM, select Load all data to RAM.
    • If you want to load one data block at a time into RAM and generate validation blocks from the end of the dataset, select Validate at the end of the dataset.
    • If you want to load one data block at a time into RAM without generating validation blocks, select Run validation in each training data block.

      Validation data is generated from each training data block.

  17. In the Memory allocation mode drop-down list, select one of the following settings:
    • Reserve minimum amount of free RAM. If this setting is selected, the Trainer service will make sure that the minimum amount of memory specified in the Amount of RAM, MB field remains free when training the ML model.
    • Reserve maximum available amount of RAM for model training. If this setting is selected, the Trainer service will use the maximum amount of RAM specified in the Amount of RAM, MB field when training the ML model.
  18. To consider previous training results while training an ML model on new data, enable the option to Initialize model weights with values from previous training results.
  19. If you want to shuffle the data to improve the quality of ML model training, enable the Shuffle data option.
  20. In Initialization of pseudorandom number generator, set a value for generating a pseudorandom number sequence.
  21. In Learning rate coefficient, set the coefficient to be used for adjusting ML model element weights in each training iteration.

    The default value of this parameter is 0.0001.

  22. In the Training optimization algorithm drop-down list, select one of the following algorithms:
    • Adadelta is an adaptive learning rate-based algorithm for each dimension.
    • Adagrad is the algorithm in which the learning rate depends on the update rate of settings during learning.
    • Adam is the algorithm based on adaptive computing of the first-order and second-order momentum of setting distribution.
    • RMSprop is the algorithm that uses a moving average of the squared gradient to adaptively normalize the learning rate at each step.
    • SGD is the Stochastic Gradient Descent algorithm.
  23. In the Loss function drop-down list, select one of the following functions:
    • MSE: for calculating the root mean square error.
    • MSLE: for calculating the logarithmic mean error.
    • MAE: for calculating the mean absolute error.
    • MAPE: for calculating the mean absolute percentage error.
  24. In the upper-right corner of the window, click the Save button.

    If you change the learning parameters for a previously trained element, you have to confirm the changes.

  25. In the information block located above the training settings, click the Train element button.

    The information block will show the number of the current training epoch of the element.

After the training is complete, you can view the training results of an ML model element in the Training results tab.

After all predictive elements and elliptic envelope-based elements that are part of the ML model have been successfully trained, the model will be assigned a status of Trained. If required, you can retrain the ML model element by clicking Restart training.