Objective_function.Properties.regularization module

Description

This module defines the ParaMol.Objective_function.Properties.regularization.Regularization class, which is a ParaMol representation of the regularization property.

class ParaMol.Objective_function.Properties.regularization.Regularization(initial_parameters_values, prior_widths, method, weight=1.0, scaling_factor=1.0, hyperbolic_beta=0.01)

Bases: ParaMol.Objective_function.Properties.property.Property

ParaMol representation of the regularization property.

Parameters
  • initial_parameters_values (list or np.array of floats) – List or np.array containing the initial parameters’ values.

  • prior_widths (list or np.array of floats) – List or np.array containing the prior width of each parameter.

  • method (str) – Type of regularization. Options are ‘L1’, ‘L2’ or ‘hyperbolic’ (‘hyperbolic’ only for RESP calculations)

  • weight (float) – Weight of this property in the objective function.

  • scaling_factor (float) – Scaling factor of the regularization value.

  • hyperbolic_beta (float) – Hyperbolic beta value. Only used if method is hyperbolic.

Variables
  • name (str) – ‘REGULARIZATION’

  • systems (list of ParaMol.System.system.ParaMolSystem) – List of ParaMol Systems. Currently not used and it is set to None.

  • units (str) – ‘ADIMENSIONAL’

  • value (float) – Current value of this property

  • weight (float) – Weight of this property in the objective function.

_hyperbolic_regularization(current_parameters, a=None, b=None)

Method that computes the value of the hyperbolic regularization.

Parameters
  • current_parameters (list of floats) – Lists containing the optimizable values of the parameters.

  • a (float, default=`None`) – a parameter (scaling factor). If not None, instance attribute self._scaling_factor is ignored.

  • b (float, default=`None`) – Hyperbolic beta parameter. If not None, instance attribute self._hyperbolic_beta is ignored.

Notes

\(hyperbolic = a\sum_{m}^{N_{charges}} ((q_m^2 + b^2 )^{1/2} - b)\)

Returns

value (float) – Value of the regularization.

_l1_regularization(current_parameters, a=None)

Method that computes the value of the L1 regularization.

Parameters
  • current_parameters (list of floats) – Lists containing the optimizable values of the parameters.

  • a (float, default=`None`) – a parameter (scaling factor). If not None, instance attribute self._scaling_factor is ignored.

Notes

\(L1 = a|param-param_0|\) where a is a scaling factor.

Returns

value (float) – Value of the regularization.

_l2_regularization(current_parameters, a=None)

Method that computes the value of the L2 regularization.

Parameters
  • current_parameters (list of floats) – Lists containing the optimizable values of the parameters.

  • a (float, default=`None`) – a parameter (scaling factor). If not None, instance attribute self._scaling_factor is ignored.

Notes

\(L2 = a(param-param_0)^2\) where a is a scaling factor.

Returns

value (float) – Value of the regularization.

calculate_property(current_parameters, a=None, b=None)

Method that wraps private regularization methods in order to calculate the regularization term of the objective function.

Parameters
  • current_parameters (list of floats) – Lists containing the optimizable values of the parameters.

  • a (float, default=`None`) – a parameter (scaling factor). If not None, instance attribute self._scaling_factor is ignored.

  • b (float, default=`None`) – Hyperbolic beta parameter. If not None, instance attribute self._hyperbolic_beta is ignored.

Returns

float – Regularization value.

set_initial_parameters_values(initial_parameters_values)

Method that sets the initial parameters’ values as a private attribute of this instance.

Parameters

initial_parameters_values (list or np.array of floats) – List or np.array containing the initial parameters’ values.

Returns

initial_parameters_values (list of floats) – List containing the prior width of each parameter (private attribute).

set_prior_widths(prior_widths)

Method that sets the prior widths of the variables as a private attribute of this instance.

Parameters

prior_widths (list or np.array of floats) – List or np.array containing the prior width of each parameter.

Returns

prior_widths (list of floats) – List containing the prior width of each parameter (private attribute).