jsat.datatransform
Class WhitenedPCA
- java.lang.Object
-
- jsat.datatransform.DataTransformBase
-
- jsat.datatransform.WhitenedPCA
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, DataTransform, Parameterized
- Direct Known Subclasses:
- WhitenedZCA
public class WhitenedPCA extends DataTransformBase
An extension ofPCAthat attempts to capture the variance, and make the variables in the output space independent from each-other. An of equal scale, so that the covariance is equal toI. The results may be further from the identity matrix than desired as the target dimension shrinks
The Whitened PCA is more computational expensive than the normal PCA algorithm, but transforming the data takes the same time.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description WhitenedPCA()Creates a new WhitenedPCA transform that uses up to 50 dimensions for the transformed space.WhitenedPCA(DataSet dataSet)Creates a new WhitenedPCA.WhitenedPCA(DataSet dataSet, double regularization)Creates a new WhitenedPCA, the dimensions will be chosen so that the subset of dimensions is of full rank.WhitenedPCA(DataSet dataSet, double regularization, int dims)Creates a new WhitenedPCA from the given datasetWhitenedPCA(DataSet dataSet, int dims)Creates a new WhitenedPCA.WhitenedPCA(double regularization, int dims)Creates a new WhitenedPCA transformWhitenedPCA(int dims)Creates a new WhitenedPCA transform
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description DataTransformclone()voidfit(DataSet dataSet)Fits this transform to the given dataset.intgetDimensions()Returns the number of dimensions to project down todoublegetRegularization()static DistributionguessDimensions(DataSet d)voidsetDimensions(int dimensions)Sets the number of dimensions to project down tovoidsetRegularization(double regularization)DataPointtransform(DataPoint dp)Returns a new data point that is a transformation of the original data point.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.parameters.Parameterized
getParameter, getParameters
-
-
-
-
Constructor Detail
-
WhitenedPCA
public WhitenedPCA()
Creates a new WhitenedPCA transform that uses up to 50 dimensions for the transformed space. This may not be optimal for any given dataset.- Parameters:
dims- the number of dimensions to project down to
-
WhitenedPCA
public WhitenedPCA(int dims)
Creates a new WhitenedPCA transform- Parameters:
dims- the number of dimensions to project down to
-
WhitenedPCA
public WhitenedPCA(double regularization, int dims)Creates a new WhitenedPCA transform- Parameters:
regularization- the amount of regularization to add, avoids numerical instabilitydims- the number of dimensions to project down to
-
WhitenedPCA
public WhitenedPCA(DataSet dataSet, double regularization, int dims)
Creates a new WhitenedPCA from the given dataset- Parameters:
dataSet- the data set to whitenregularization- the amount of regularization to add, avoids numerical instabilitydims- the number of dimensions to project down to
-
WhitenedPCA
public WhitenedPCA(DataSet dataSet, double regularization)
Creates a new WhitenedPCA, the dimensions will be chosen so that the subset of dimensions is of full rank.- Parameters:
dataSet- the data set to whitenregularization- the amount of regularization to add, avoids numerical instability
-
WhitenedPCA
public WhitenedPCA(DataSet dataSet)
Creates a new WhitenedPCA. The dimensions will be chosen so that the subset of dimensions is of full rank. The regularization parameter will be chosen as the log of the condition of the covariance.- Parameters:
dataSet- the data set to whiten
-
WhitenedPCA
public WhitenedPCA(DataSet dataSet, int dims)
Creates a new WhitenedPCA. The regularization parameter will be chosen as the log of the condition of the covariance.- Parameters:
dataSet- the data set to whitendims- the number of dimensions to project down to
-
-
Method Detail
-
fit
public void fit(DataSet dataSet)
Description copied from interface:DataTransformFits this transform to the given dataset. Some transforms can only be learned from classification or regression datasets. If an incompatible dataset type is given, aFailedToFitExceptionexception may be thrown.- Parameters:
dataSet- the dataset to fir this transform to
-
transform
public DataPoint transform(DataPoint dp)
Description copied from interface:DataTransformReturns a new data point that is a transformation of the original data point. This new data point is a different object, but may contain the same references as the original data point. It is not guaranteed that you can mutate the transformed point without having a side effect on the original point.- Parameters:
dp- the data point to apply a transformation to- Returns:
- a transformed data point
-
setRegularization
public void setRegularization(double regularization)
- Parameters:
regularization- the regularization to apply to the diagonal of the decomposition. This can improve numeric stability and reduces noise.
-
getRegularization
public double getRegularization()
- Returns:
- the amount of regularization to apply
-
clone
public DataTransform clone()
- Specified by:
clonein interfaceDataTransform- Specified by:
clonein classDataTransformBase
-
setDimensions
public void setDimensions(int dimensions)
Sets the number of dimensions to project down to- Parameters:
dimensions- the feature size to project down to
-
getDimensions
public int getDimensions()
Returns the number of dimensions to project down to- Returns:
- the number of dimensions to project down to
-
guessDimensions
public static Distribution guessDimensions(DataSet d)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG