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, transformpublic 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)
FeatureTransformlearn in class FeatureTransformattributes - 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)
FeatureTransformtransform in class FeatureTransformx - a feature vector.public java.lang.String toString()
toString in class java.lang.Object