The Normaliser Abstract Base Class

class nPYc.utilities.normalisation._normaliserABC.Normaliser

Normaliser classes must implement the normalise(), __eq__() and __str__() methods and normalisation_coefficients attribute.

_reset()

Resets the objects including any normalisation_coefficients, causing them to be calculated again next time normalise() is called.

Should additionally reset any configuration applied after initialisation.

normalisation_coefficients

Returns the last set of normalisation coefficients calculated.

Returns:Normalisation coefficients or None if they have not been generated yet
Raises:AttributeError – Setting the normalisation coefficients directly is not allowed and raises an error
normalise(X)

Apply normalisation to the data in matrix X and return a view to the normalised matrix.

Where relevant the method must ensure that it is not possible to write to the returned normalised X where this cannot be meaningfully reflected in the raw X.

Parameters:X (numpy.ndarray, shape [n_samples, n_features]) – Data intensity matrix
Returns:The normalised X matrix
Return type:numpy.ndarray, shape [n_samples, n_features]
Raises:ValueError – If X is not a numpy 2-d array representing a data matrix
__eq__(other)

Compares two Normaliser objects. Should return True when either object would return identical values for identical Xs.

Parameters:other – Object to compare for equality
Returns:True if both objects perform equivalent normalisations
Return type:bool
__str__()
Returns:A human readable description of the normalisation the object applies.
Return type:str