Class Normalizer
java.lang.Object
qupath.opencv.ml.objects.features.Normalizer
Class to help with simple feature normalization, by adding an offset and then multiplying by a scaling factor.
- Author:
- Pete Bankhead
-
Method Summary
Modifier and TypeMethodDescriptionstatic Normalizer
createNormalizer
(double[] offsets, double[] scales, double missingValue) Create aNormalizer
with the specified parameters.double
Return the value that will be output after normalization if the computed value is not finite.double
getOffset
(int ind) Get the offset for the specified featuredouble
getScale
(int ind) Get the scale factor for the specified featureboolean
Returns true if this normalizer does not actually do anything.int
The total number of features supported by thisNormalizer
double
normalizeFeature
(int idx, double originalValue) Normalize a single feature.
-
Method Details
-
createNormalizer
Create aNormalizer
with the specified parameters.- Parameters:
offsets
- value to add to each featurescales
- value to multiply each feature, after applying the offsetmissingValue
- replacement value for non-finite features- Returns:
- a
Normalizer
initialized accordingly
-
normalizeFeature
public double normalizeFeature(int idx, double originalValue) Normalize a single feature.- Parameters:
idx
- the index of the feature; this is required to identify the corresponding offset and scaleoriginalValue
- the original value of the feature- Returns:
- the normalized value of the feature
-
isIdentity
public boolean isIdentity()Returns true if this normalizer does not actually do anything. This is the case if all offsets are zero and all scales are 1.- Returns:
-
getMissingValue
public double getMissingValue()Return the value that will be output after normalization if the computed value is not finite.- Returns:
-
nFeatures
public int nFeatures()The total number of features supported by thisNormalizer
- Returns:
-
getOffset
public double getOffset(int ind) Get the offset for the specified feature- Parameters:
ind
- index of the feature- Returns:
-
getScale
public double getScale(int ind) Get the scale factor for the specified feature- Parameters:
ind
- index of the feature- Returns:
-