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.
-
Method Summary
Modifier and TypeMethodDescriptionstatic NormalizercreateNormalizer(double[] offsets, double[] scales, double missingValue) Create aNormalizerwith the specified parameters.doubleReturn the value that will be output after normalization if the computed value is not finite.doublegetOffset(int ind) Get the offset for the specified featuredoublegetScale(int ind) Get the scale factor for the specified featurebooleanReturns true if this normalizer does not actually do anything.intThe total number of features supported by thisNormalizerdoublenormalizeFeature(int idx, double originalValue) Normalize a single feature.
-
Method Details
-
createNormalizer
Create aNormalizerwith 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
Normalizerinitialized 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:
-