2.1.1.1.1.7. emicroml.modelling.cbed.distortion.estimation.normalize_normalizable_elems_in_ml_data_dict

normalize_normalizable_elems_in_ml_data_dict(ml_data_dict, normalization_weights=None, normalization_biases=None, check_ml_data_dict_first=True)[source]

Normalize in-place normalizable features of a dictionary representation of machine learning data instances.

The current function normalizes in-place the normalizable features of a dictionary representation ml_data_dict of complete or incomplete machine learning (ML) data instances. If complete, the ML data instances can be used to train and/or evaluate ML models represented by the class emicroml.modelling.cbed.distortion.estimation.MLModel.

Each dict key in ml_data_dict is the name of a feature of the ML data instances. A complete dictionary representation is identical in structure to a dictionary returned by the method emicroml.modelling.cbed.distortion.estimation.MLDataset.get_ml_data_instances() of the class emicroml.modelling.cbed.distortion.estimation.MLDataset. See the documentation for said method for more details. An incomplete dictionary representation is identical in structure to a complete dictionary representation, except that at least one dict item is missing.

The normalizable features are "undistorted_disk_center_sets", "common_undistorted_disk_radii", "distortion_centers", "quadratic_radial_distortion_amplitudes", "spiral_distortion_amplitudes", "elliptical_distortion_vectors"`, and ``"parabolic_distortion_vectors".

Let unnormalized_values be the unnormalized values of a normalizable feature of the ML data instances. The normalization is performed by

normalized_values = (unnormalized_values*normalization_weight
                     + normalization_bias)

where normalized_values are the normalized values, normalization_weight is a valid normalization weight, and normalization_bias is a valid noramlization bias. Valid normalization weights and biases are those with values that yield normalized features with elements that lie within the closed interval \([0, 1]\).

Parameters:
ml_data_dictdict

The dictionary representation of the ML data instances, for which to perform in-place normalization. Prior to normalization, all normalizable features are assumed to be unnormalized.

normalization_weightsdict, optional

The normalization weights. The dict keys must be the same as those as the instance attribute emicroml.modelling.cbed.distortion.estimation.MLDataset.normalization_weights of the class emicroml.modelling.cbed.distortion.estimation.MLDataset. The value of each dict item is expected to be a valid real number.

normalization_biasesdict, optional

The normalization biases. The dict keys must be the same as those as the instance attribute emicroml.modelling.cbed.distortion.estimation.MLDataset.normalization_biases of the class emicroml.modelling.cbed.distortion.estimation.MLDataset. The value of each dict item is expected to be a valid real number.

check_ml_data_dict_firstbool, optional

If check_ml_data_dict_first is set to True, then ml_data_dict is checked, raising an exception if ml_data_dict is not a valid dictionary representation of ML data instances. Otherwise, ml_data_dict is not checked.