Class Normalizer

java.lang.Object
qupath.opencv.ml.objects.features.Normalizer

public class Normalizer extends Object
Class to help with simple feature normalization, by adding an offset and then multiplying by a scaling factor.
Author:
Pete Bankhead
  • Method Details

    • createNormalizer

      public static Normalizer createNormalizer(double[] offsets, double[] scales, double missingValue)
      Create a Normalizer with the specified parameters.
      Parameters:
      offsets - value to add to each feature
      scales - value to multiply each feature, after applying the offset
      missingValue - 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 scale
      originalValue - 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 this Normalizer
      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: