Optimization of hyperparameters

Warning

This option is not fully tested. In case of weird results, you can share your experience and report an issue.

The weights of the various components in the database can be optimized using a genetic algorithm through the following objective function:

(1)\[J(\mathbf{w}) = f_e \textrm{MAE}_e (\mathbf{w})+ f_f \textrm{MAE}_f (\mathbf{w})+ f_s \textrm{MAE}_s(\mathbf{w})\]

MAE is the mean average error for energy, force, or stress, and \(f\) is the multiplicative factor for each of them. These multiplicative factors are provided by the user (see below in this section). The optimization of database weights is activated through the optimize_weights_db=.true.. While the weights of chemical channels can be optimized by activation of the flag optimize_weights_chem=.true.. Only one of them can be true, no crossed optimization for this Milady version. The evolution of the objective function is monitorized in the file optimization_error.dat with the first column indicates the call number, second: the objective function, third: \(MAE_e\), fourth: \(MAE_f\) and fifth: \(MAE_s\). At the end, the best set of parameters which corresponds to the best optimization, with a minimum of the objective function, is given as output.

optimize_weights_db (logical)

You can activate or deactivate the optimization of weights \(w_E\), \(w_F\), and \(w_S\) through a genetic algorithm. The initial and final values of these weights are indicated in the db_file (usually named db_model.in). For more information, please refer to the section on Database files. The \(l^{th}\) line of db_model.in introduces three weights that will be optimized: \(w^l_e\), \(w^l_f\), and \(w^l_s\), which stand for the weights for energy, force, and stress, respectively. The maximum number of weights (the number of arguments of the genetic algorithm function) is equal to the number of lines in the DB file, db_model.in, multiplied by three. However, this number can be lower if you use the option class_no_optimize_weights to exclude some lines. For example, if you put class_no_optimize_weights=" 02 06 ", all the lines that belong to the classes 02 and 06 will be excluded from optimization.

Default optimize_weights_db=.false.

optimize_weights_chem (logical)

Activate or not the optimization of the weights (or colors) of atoms in each channel through genetical algorithm. The initial and final values of those weights are those selectioned in ml file. How to activate or not the multi-channel descriptors for multiple elements databases can be found in Atomic systems. The result of the optimization can be found at screen of in the file optimization_chemical.info.

Default optimize_weights_chem=.false.

Warning

This options optimize_weights_db and optimize_weights_chem cannot be true simultaneously.

class_no_optimize_weights (character(len=90))

The classes (with the same names / numbers as in db_file) for which the the optimization through genetical algorithm is no activated . If there are many classes, theirs names should be separated by space (see the default value for an example) This option is active only if optimize_weights=.true. Example: class_no_optimize_weights=" 02 06 " - no optimization for the classes 02 and 06.

Default: class_no_optimize_weights=" "

optimize_ga_population (integer)

The size of the population of genetical algorithm.

Default optimize_ga_puplation=80

max_iter_optimize_weights (integer)

The maximum number of optimization steps. The total number of optimization steps are given by: optimize_ga_puplation \(\times\) max_iter_optimize_weights

Default: max_iter_optimize_weights=40

factor_energy_error (real)

The factor for energy in the objective function \(f_e\) in the Eq. (1).

Default: force_energy_error=1.d0

factor_force_error (real)

The factor for force in the objective function \(f_f\) in the Eq. (1).

Default: force_force_error=1.d0

factor_stress_error (real)

The factor for energy in the objective function \(f_s\) in the Eq. (1).

Default: force_stress_error=1.d0

optimize_weights_L1 (logical)

The regularization is performed by adding a \(L^1\) function on the objective function from Eq. (1) The weigths are optimized in the same time as the lambda_krr regularizitation parameter. The new objective function becomes:

\[J(\mathbf{w}) = J(\mathbf{w}) + \lambda_{krr} \sum_k \left| w_k \right|\]

Default optimize_weights_L1=.false.

optimize_weights_L2 (logical)

The regularization is performed by adding a \(L^2\) function on the objective function from Eq. (1). The weigths are optimized in the same time as the lambda_krr regularizitation parameter. The new objective function becomes:

\[J(\mathbf{w}) = J(\mathbf{w}) + \lambda_{krr} \sum_k \left| w_k \right|^2\]

Default optimize_weights_L1=.false.

optimize_weights_Le (logical)

The regularization is performed by adding a \(L^2\) + \(L^1\) function on the objective function from Eq. (1). The weigths are optimized in the same time as the lambda_krr regularizitation parameter. The new objective function becomes:

\[J(\mathbf{w}) = J(\mathbf{w}) + \lambda_{krr} \sum_k \left| w_k \right|^2 + \lambda_{krr} \sum_k \left| w_k \right|\]

Default optimize_weights_Le=.false.