Active Learning Module#

The active learning module contains components for intelligent data point selection.

Active learning module for electromagnetic field optimization.

This module implements active learning strategies to efficiently select the most informative data points for training electromagnetic field prediction models.

class EMFieldML.ActiveLearning.ActiveLearning.ActiveLearning#

Bases: object

Active learning strategies for electromagnetic field model optimization.

This class implements methods to select the most informative data points for training, improving model performance with minimal data.

static pre_deviation(input_path_y_data: Path, input_path_model: Path, x_train_data: numpy.ndarray, test_data_list: list[int], point_index: int)#

Calculate deviation for active learning point selection.

Identify and select test data samples that show a large variance with respect to the current model’s predictions.

Parameters:
  • input_path_y_data – Path to training target data

  • input_path_model – Path to trained model file

  • x_train_data – Training input features

  • test_data_list – List of test data indices

  • point_index – Index of prediction point

Returns:

Average and maximum deviation values

Note

This function corresponds to 5 steps in Figure 5a of the paper.

static active_learning(X_test_list, predict_point_list)#

Perform active learning process.

Active learning iteratively selects instances from the test set that have high prediction uncertainty for the current model. These difficult cases are then used to retrain the model. This active learning approach enables the efficient creation of a robust model, particularly in scenarios where generating a large and diverse training dataset is difficult.

Parameters:
  • X_test_list – List of test data points

  • predict_point_list – List of points to predict

Returns:

List of selected data points for training

Note

This function corresponds to Figure 5a in the paper.

static uncertainly_sampling()#

Perform uncertainty sampling for active learning.

Iteratively selects data points with high prediction uncertainty, runs simulations for these points, and updates the training dataset.

Note

This function corresponds to step 6 in Figure 5a of the paper.

Module for deciding 6 points in active learning.

class EMFieldML.ActiveLearning.Decide6points.Decide6points#

Bases: object

Class for deciding 6 points in active learning process.

static get_pattern(i: int, j: int, k: int) int#

Divide the entire space into 27 blocks. i corresponds to x, j corresponds to y, and k corresponds to z. The if statements are complex to account for overlapping regions.

Parameters:
  • i (int) – i corresponds to x

  • j (int) – j corresponds to y

  • k (int) – k corresponds to z

Returns:

The index of the block in which the point (i, j, k) is located.

Return type:

int

static make_pattern_list() None#

Assign each point to a block one by one. Exclude those that overlap with the ferrite shield.

static make_learning_model_all() None#

Create learning models for all patterns.

static pre_deviation(input_path_y_data: Path, input_path_model: Path, x_train_data: numpy.ndarray, init_test_data_list: list[int])#

Calculate pre-deviation for given data.

static predict_deviation_all() None#

Predict deviation for all patterns.

static check_deviation() None#

Check deviation values.