dislib.preprocessing

class dislib.preprocessing.MinMaxScaler(feature_range=(0, 1))[source]

Bases: object

Standardize features by rescaling them to the provided range

Scaling happen independently on each feature by computing the relevant statistics on the samples in the training set. Minimum and Maximum values are then stored to be used on later data using the transform method.

Variables:feature_range (tuple) – The desired range of values in the ds-array.
fit(x)[source]

Compute the min and max values for later scaling.

Parameters:x (ds-array, shape=(n_samples, n_features))
Returns:self
Return type:MinMaxScaler
fit_transform(x)[source]

Fit to data, then transform it.

Parameters:x (ds-array, shape=(n_samples, n_features))
Returns:x_new – Scaled data.
Return type:ds-array, shape=(n_samples, n_features)
transform(x)[source]

Scale data.

Parameters:x (ds-array, shape=(n_samples, n_features))
Returns:x_new – Scaled data.
Return type:ds-array, shape=(n_samples, n_features)
class dislib.preprocessing.StandardScaler[source]

Bases: object

Standardize features by removing the mean and scaling to unit variance

Centering and scaling happen independently on each feature by computing the relevant statistics on the samples in the training set. Mean and standard deviation are then stored to be used on later data using the transform method.

Variables:
  • mean (ds-array, shape (1, n_features)) – The mean value for each feature in the training set.
  • var (ds-array, shape (1, n_features)) – The variance for each feature in the training set.
fit(x)[source]

Compute the mean and std to be used for later scaling.

Parameters:x (ds-array, shape=(n_samples, n_features))
Returns:self
Return type:StandardScaler
fit_transform(x)[source]

Fit to data, then transform it.

Parameters:x (ds-array, shape=(n_samples, n_features))
Returns:x_new – Scaled data.
Return type:ds-array, shape=(n_samples, n_features)
transform(x)[source]

Standarize data.

Parameters:x (ds-array, shape=(n_samples, n_features))
Returns:x_new – Scaled data.
Return type:ds-array, shape=(n_samples, n_features)