The Normaliser
Abstract Base Class¶
-
class
nPYc.utilities.normalisation._normaliserABC.
Normaliser
¶ Normaliser classes must implement the
normalise()
,__eq__()
and__str__()
methods andnormalisation_coefficients
attribute.-
_reset
()¶ Resets the objects including any
normalisation_coefficients
, causing them to be calculated again next timenormalise()
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 yetRaises: 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 returnTrue
when either object would return identical values for identical Xs.Parameters: other – Object to compare for equality Returns: True
if both objects perform equivalent normalisationsReturn type: bool
-
__str__
()¶ Returns: A human readable description of the normalisation the object applies. Return type: str
-