morphoclass.transforms.scalers.min_max_scaler module

Implementation of the min-max scaler transform.

class morphoclass.transforms.scalers.min_max_scaler.FeatureMinMaxScaler(feature_indices, feature_range=(0, 1), take_abs=False, **kwargs)

Bases: morphoclass.transforms.scalers.abstract_scaler.AbstractFeatureScaler

Scaler that scales the features to a given range.

Internally the MinMaxScaler from scikit-learn is applied

Parameters
  • feature_indices – List of indices of the feature maps to which to apply the scaling.

  • feature_range (sequence (optional)) – The feature range to which to scale the features. This value is passed through to the MinMaxScaler class in sklearn.

  • take_abs (bool (optional)) – If true then the scaler will be fitted on the absolute values of the features. This way a feature range of (0, 1) would translate to an effective range of (-1, 1). This is useful when it’s necessary to avoid shifting the features away from the origin.

  • kwargs – Additional keyword argument to pass through to the AbstractFeatureScaler base class.

get_config()

Generate the configuration necessary for reconstructing the scaler.

Returns

config – The configuration of the scaler. It should contain all information necessary for reconstructing the scaler using the scaler_from_config function.

Return type

dict

reconstruct(params)

Reconstruct the configuration from parameters.

Parameters

params (dict) – The parameters found in config[“params”] with the config being the dictionary returned by get_config.