Optimize multi objectives - Population

PyALAF.multi_optimize.run_continuous_batch_learning_multi(models, aggregation_function, regression_models, acquisition_function='ideal', opt_method='PSO', pool=None, batch_size=1, noise=0.1, noise_test=None, initial_samples=2, active_learning_steps=10, lim_features=[-1, 1], feature_scaler='min_max', alpha=0, n_jobs=1, random_state=None, initialization='random', pso_options=None, fictive_noise_level=0, poly_degree=3, custom_acfn_input={}, calculate_test_metrics=True, verbose=True, single_update=False, **kwargs)[source]

Multi-objective batch-mode Active Learning in continuous parameter space. This method is similar to ‘run_continuous_batch_learning’ but also enables to take into account multiple objective functions. Multiple objectives are handeled by an aggregation function, which combines the individual output for each data point of each objective into a single output value. The aggregation functions needs to be provided customly. For each objective function it is also possible to use an individual model. E.g. we can use Gaussian Process Regression for objective 1 and Linear Regression for objective 2.

The active learning acquisition functions are modified in order to also take the aggregation function as an argument. Therefore, active learning acquisition functions from outside this module are not compatible.

The algorithm generates initial data automatically using either a random approach or using the model-free GSx approach.

Parameters:
  • models (List of model class) – Models to generate true data for each objective. One model per objective needs to be provided. The models evaluation function takes as input the unscaled features.

  • aggregation_function (callable) – Function to aggregate multiple outputs for various objective functions. The function needs to get an np_array as input and also requires the scaled features as input. Scaled features are chosen here, because it makes the usage of optimization algorithms easier. If unscaled features should be used, a scaler can be provided. Furthermore, it needs a parameter ‘uncert’ which tells the function if it should aggregate uncertainty or not, in case we want to aggregate uncertainty different than the mean prediction.

  • regression_models (sklearn model, list) – scikit-learn regression models. Either a single model can be given or a list of models with a length corresponding to the number of objectives.

  • acquissition_function (str, optional) – Acquisition function. The default is ‘ideal’.

  • opt_method (str, optional) – The method to optimize the acquisition function. Choose from ‘lbfgs’ and ‘PSO’. The default is ‘PSO’.

  • pool (nd_array, None, optional) – Array containing pool of data for testing. For ‘None’ a grid with 100 points in each dimension is created. This is only used when ‘calculate_test_metrics’ is True. The default is ‘None’.

  • batch_size (int, optional) – Batch size for Active Learning. The model is updated only with true data when a batch is completed. The default value is 1.

  • noise (float, optional) – Noise in observation. The default is 0.1.

  • initial_samples (nd_array, int, optional) – If an integer is provided: Number of initial samples to draw. The default is 2. If an nd_array is provided: Initial data points. The parameter ‘initialization’ must be ‘data’.

  • active_learning_steps (int, optional) – Number of active learning steps to perform. The default is 10.

  • lim_features (list, optional) – Boundaries for model evaluation. Only used when pool=None. The default is [-1,1].

  • feature_scaler (scikit-learn scaler) – Scaler for the features. The ‘min_max’ scaler scales all features between 0 and 1. Furthermore, every pretrained scikit-learn scaler can be used and provided as an object. If None is provided, the features are not scaled. The default is ‘min_max’.

  • alpha (float) – Hyperparameter for acquisition function. The default is 0.

  • n_jobs (int, optional) – Number of cores to use for parallel evaluation of PSO. Currently not used, PSO runs only in serial mode. The default is 1.

  • random_state (int, optional) – Set random state. The default is None.

  • initialization (str, optional) – Initialization method for generating initial data. Choose from ‘random’, ‘GSx’ or ‘data’. ‘random’ uses Latin Hypercube sampling to generate the initial dat points. ‘GSx’ draws randomly the first data point and then uses the model-free GSx method to sample the other initial data points. If ‘data’ is chosen, the initial data is assumed to be provided by ‘initial_samples’. The default value is ‘random’.

  • pso_options (dict, optional) – Dictionary with parameters for the Particle Swarm Optimization. Only used when o pt_method is ‘PSO’. For ‘None’ default values are used. [‘c1’: 0.5, ‘c2’: 0.3, ‘w’: 0.9, ‘p’:dimensions*10, ‘i’:200]. c1 and c2 are swarm parmeters, w is the inertia, p gives the number of particles, i is the number of iterations. The default is ‘None’.

  • fictive_noise_level (float, optional) – Noise level for non-GPR models used for assuming predictions as true values to enable batch-wise learning.

  • calculate_test_metrics (bool, optional) – Can be used for testing Active Learning algorithms for known models. Test metrics are calculated automatically. If ‘False’ no test metrics are calculated and the AL runs in deployement mode.

  • verbose (bool, optional) – Whether to print additional information. The default value is True.

  • single_update (bool, optional) – Whether to stop the Active Learning after the first iteration. The default value is False.

  • custom_acfn_input (dict) – Dictionary that contains which information is used by a custom acquisition function.

  • **kwargs (various, optional) – Keyword arguments for the aggregation function.

Returns:

  • samples (nd_array) – Numpy array which contains the unscaled features for data points in the order in which they were selected.

  • results (pd_DataFrame) – Pandas DataFrame containing the columns: ‘m’, ‘mean_MSE_train’, ‘mean_MAE_train’, ‘mean_MaxE_train’, ‘mean_MSE_test’, ‘mean_MAE_test’, ‘mean_MaxE_test’, ‘max_observation’. Data is stored for each active learning step, where ‘m’ gives the number of data used for training, ‘mean_MSE_train’ and ‘mean_MSE_test’ the MSE of the training and test set, respectively, and ‘max_observation’ the maximum value observed so far. MAE corresponds to the Mean Absolute Error and MaxE to the maximum absolute error.