Class Preprocessing
java.lang.Object
qupath.opencv.ml.objects.features.Preprocessing
Helper class for preprocessing input for machine learning algorithms using OpenCV Mats.
- Author:
- Pete Bankhead
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Helper class to apply PCA projection. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Normalizer
createNormalizer
(Normalization normalization, Mat samples, double missingValue) Create a simple normalizer to rescale input data.static Preprocessing.PCAProjector
createPCAProjector
(Mat data, double retainedVariance, boolean normalize) Create a principle components analysis projection to reduce features.static void
normalize
(Mat samples, Normalizer normalizer) Apply aNormalizer
to new training data samples.
-
Constructor Details
-
Preprocessing
public Preprocessing()
-
-
Method Details
-
createPCAProjector
public static Preprocessing.PCAProjector createPCAProjector(Mat data, double retainedVariance, boolean normalize) Create a principle components analysis projection to reduce features.- Parameters:
data
- input data used to create the projectorretainedVariance
- variance to retain (determines the number of output features)normalize
- if true, normalize the output features- Returns:
- a
Preprocessing.PCAProjector
that can be applied to new data
-
createNormalizer
public static Normalizer createNormalizer(Normalization normalization, Mat samples, double missingValue) Create a simple normalizer to rescale input data.- Parameters:
normalization
- the method of normalization to applysamples
- the input samples used to determine the normalization parametermissingValue
- an optional value that may be used to replace non-finite (i.e. missing) feature values- Returns:
- a
Normalizer
that may be applied to new data
-
normalize
Apply aNormalizer
to new training data samples. Features may be either columns or channels.- Parameters:
samples
- the input datanormalizer
- the normalizer to apply
-