public class Nystrom extends DataTransformBase
Modifier and Type | Class and Description |
---|---|
static class |
Nystrom.SamplingMethod
Different sample methods may be used to select a better and more
representative set of vectors to form the basis vectors at increased
cost, where
n is the number of data points in the full data set
and b is the number of basis vectors to obtain. |
Modifier | Constructor and Description |
---|---|
|
Nystrom()
Creates a new Nystrom approximation object using the
RBF Kernel with 500 basis vectors |
|
Nystrom(KernelTrick k,
DataSet dataset,
int basisSize,
Nystrom.SamplingMethod method)
Creates a new Nystrom approximation object
|
|
Nystrom(KernelTrick k,
DataSet dataset,
int basisSize,
Nystrom.SamplingMethod method,
double ridge,
boolean sampleWithReplacment)
Creates a new Nystrom approximation object
|
|
Nystrom(KernelTrick k,
int basisSize)
Creates a new Nystrom approximation object
|
|
Nystrom(KernelTrick k,
int basisSize,
Nystrom.SamplingMethod method,
double ridge,
boolean sampleWithReplacment)
Creates a new Nystrom approximation object
|
protected |
Nystrom(Nystrom toCopy)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
Nystrom |
clone() |
void |
fit(DataSet dataset)
Fits this transform to the given dataset.
|
Nystrom.SamplingMethod |
getBasisSamplingMethod()
Returns the method of selecting the basis vectors
|
int |
getBasisSize()
Returns the number of basis vectors to use
|
int |
getDimension()
Returns the number of dimensions to project down too
|
KernelTrick |
getKernel() |
double |
getRidge()
Returns the regularization value added to each eigen value
|
static List<Vec> |
sampleBasisVectors(KernelTrick k,
DataSet dataset,
List<Vec> X,
Nystrom.SamplingMethod method,
int basisSize,
boolean sampleWithReplacment,
Random rand)
Performs sampling of a data set for a subset of the vectors that make a
good set of basis vectors for forming an approximation of a full kernel
space.
|
void |
setBasisSamplingMethod(Nystrom.SamplingMethod method)
Sets the method of selecting the basis vectors
|
void |
setBasisSize(int basisSize)
Sets the basis size for the Kernel PCA to be learned from.
|
void |
setDimension(int dimension)
Sets the dimension of the new feature space, which is the number of
principal components to select from the kernelized feature space.
|
void |
setKernel(KernelTrick k) |
void |
setRidge(double ridge)
Sets the regularization parameter to add to the eigen values of the gram
matrix.
|
DataPoint |
transform(DataPoint dp)
Returns a new data point that is a transformation of the original data
point.
|
getParameter, getParameters
public Nystrom(KernelTrick k, DataSet dataset, int basisSize, Nystrom.SamplingMethod method)
k
- the kernel trick to form an approximation ofdataset
- the data set to form the approximate feature space frombasisSize
- the number of basis vectors to use, this is the output
dimension size.method
- what sampling method should be used to select the basis
vectors from the full data set.public Nystrom()
RBF Kernel
with 500 basis vectorspublic Nystrom(KernelTrick k, int basisSize)
k
- the kernel trick to form an approximation ofbasisSize
- the number of basis vectors to use, this is the output
dimension size.public Nystrom(KernelTrick k, int basisSize, Nystrom.SamplingMethod method, double ridge, boolean sampleWithReplacment)
k
- the kernel trick to form an approximation ofbasisSize
- the number of basis vectors to use, this is the output
dimension size.method
- what sampling method should be used to select the basis
vectors from the full data set.ridge
- a non negative additive term to regularize the eigen values
of the decomposition.sampleWithReplacment
- true
if the basis vectors should be
sampled with replacement, false
if they should not.public Nystrom(KernelTrick k, DataSet dataset, int basisSize, Nystrom.SamplingMethod method, double ridge, boolean sampleWithReplacment)
k
- the kernel trick to form an approximation ofdataset
- the data set to form the approximate feature space frombasisSize
- the number of basis vectors to use, this is the output
dimension size.method
- what sampling method should be used to select the basis
vectors from the full data set.ridge
- a non negative additive term to regularize the eigen values
of the decomposition.sampleWithReplacment
- true
if the basis vectors should be
sampled with replacement, false
if they should not.protected Nystrom(Nystrom toCopy)
toCopy
- the object to copypublic void fit(DataSet dataset)
DataTransform
FailedToFitException
exception may be
thrown.dataset
- the dataset to fir this transform topublic static List<Vec> sampleBasisVectors(KernelTrick k, DataSet dataset, List<Vec> X, Nystrom.SamplingMethod method, int basisSize, boolean sampleWithReplacment, Random rand)
k
- the kernel trick to form the basis fordataset
- the data set to sample fromX
- the list of vectors from the data setmethod
- the sampling method to usebasisSize
- the number of basis vectors to selectsampleWithReplacment
- whether or not the sample with replacementrand
- the source of randomness for the samplingNystrom.SamplingMethod
public DataPoint transform(DataPoint dp)
DataTransform
dp
- the data point to apply a transformation topublic Nystrom clone()
clone
in interface DataTransform
clone
in class DataTransformBase
public void setRidge(double ridge)
ridge
- the non-negative value in [0, ∞) to add to each eigen
valuepublic double getRidge()
public void setDimension(int dimension)
dimension
- the number of dimensions to project down toopublic int getDimension()
public void setBasisSamplingMethod(Nystrom.SamplingMethod method)
method
- the method of selecting the basis vectorspublic Nystrom.SamplingMethod getBasisSamplingMethod()
public void setBasisSize(int basisSize)
basisSize
- the number of basis vectors to build Kernel PCA frompublic int getBasisSize()
public void setKernel(KernelTrick k)
k
- the kernel trick to usepublic KernelTrick getKernel()
Copyright © 2017. All rights reserved.