public class Normalizer extends FeatureTransform
Scaling inputs to unit norms is a common operation for text classification or clustering for instance.
Modifier and Type | Class and Description |
---|---|
static class |
Normalizer.Norm
The types of data scaling.
|
copy
Constructor and Description |
---|
Normalizer()
Default constructor with L2 norm.
|
Normalizer(boolean copy)
Constructor with L2 norm.
|
Normalizer(Normalizer.Norm norm)
Constructor.
|
Normalizer(Normalizer.Norm norm,
boolean copy)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
learn(smile.data.Attribute[] attributes,
double[][] data)
Learns transformation parameters from a dataset.
|
java.lang.String |
toString() |
double[] |
transform(double[] x)
Transform a feature vector.
|
learn, transform
public Normalizer()
public Normalizer(boolean copy)
copy
- If false, try to avoid a copy and do inplace scaling instead.public Normalizer(Normalizer.Norm norm)
norm
- The norm to use to normalize each non zero sample.public Normalizer(Normalizer.Norm norm, boolean copy)
norm
- The norm to use to normalize each non zero sample.copy
- If false, try to avoid a copy and do inplace scaling instead.public void learn(smile.data.Attribute[] attributes, double[][] data)
FeatureTransform
learn
in class FeatureTransform
attributes
- The variable attributes. Of which, numeric variables
will be standardized.data
- The training data to learn scaling parameters.
The data will not be modified.public double[] transform(double[] x)
FeatureTransform
transform
in class FeatureTransform
x
- a feature vector.public java.lang.String toString()
toString
in class java.lang.Object