jsat.regression
Class KernelRLS
- java.lang.Object
-
- jsat.regression.KernelRLS
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Parameterized, Regressor, UpdateableRegressor
public class KernelRLS extends java.lang.Object implements UpdateableRegressor, Parameterized
Provides an implementation of the Kernel Recursive Least Squares algorithm. This algorithm updates the model one per data point, and induces sparsity by projecting data points down onto a set of basis vectors learned from the data stream.
See: Engel, Y., Mannor, S.,&Meir, R. (2004). The Kernel Recursive Least-Squares Algorithm. IEEE Transactions on Signal Processing, 52(8), 2275–2285. doi:10.1109/TSP.2004.830985- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description KernelRLS(KernelTrick k, double errorTolerance)Creates a new Kernel RLS learner
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description KernelRLSclone()voidfinalizeModel()Finalizes the model.doublegetErrorTolerance()Returns the projection approximation toleranceintgetModelSize()Returns the number of basis vectors that make up the modeldoubleregress(DataPoint data)voidsetErrorTolerance(double v)Sets the tolerance for errors in approximating a data point by projecting it onto the set of basis vectors.voidsetUp(CategoricalData[] categoricalAttributes, int numericAttributes)Prepares the classifier to begin learning from itsUpdateableRegressor.update(jsat.classifiers.DataPoint, double)method.booleansupportsWeightedData()voidtrain(RegressionDataSet dataSet)voidtrain(RegressionDataSet dataSet, boolean parallel)voidupdate(DataPoint dataPoint, double y_t)Updates the classifier by giving it a new data point to learn from.-
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
-
KernelRLS
public KernelRLS(KernelTrick k, double errorTolerance)
Creates a new Kernel RLS learner- Parameters:
k- the kernel trick to useerrorTolerance- the tolerance for errors in the projection
-
-
Method Detail
-
setErrorTolerance
public void setErrorTolerance(double v)
Sets the tolerance for errors in approximating a data point by projecting it onto the set of basis vectors. In general: as the tolerance increases the sparsity of the model increases but the accuracy may go down.
Values in the range 10x ∀ x ∈ {-1, -2, -3, -4} often work well for this algorithm.- Parameters:
v- the approximation tolerance
-
getErrorTolerance
public double getErrorTolerance()
Returns the projection approximation tolerance- Returns:
- the projection approximation tolerance
-
getModelSize
public int getModelSize()
Returns the number of basis vectors that make up the model- Returns:
- the number of basis vectors that make up the model
-
finalizeModel
public void finalizeModel()
Finalizes the model. During online training, the the gram matrix and its inverse must be stored to perform updates, at the cost of O(n2) memory. One training is completed, these matrices are no longer needed - and can be removed to reclaim memory by finalizing the model. Once finalized, the model can no longer be updated - unless reset (destroying the model) by callingsetUp(jsat.classifiers.CategoricalData[], int)
-
train
public void train(RegressionDataSet dataSet, boolean parallel)
-
train
public void train(RegressionDataSet dataSet)
-
supportsWeightedData
public boolean supportsWeightedData()
- Specified by:
supportsWeightedDatain interfaceRegressor
-
clone
public KernelRLS clone()
- Specified by:
clonein interfaceRegressor- Specified by:
clonein interfaceUpdateableRegressor- Overrides:
clonein classjava.lang.Object
-
setUp
public void setUp(CategoricalData[] categoricalAttributes, int numericAttributes)
Description copied from interface:UpdateableRegressorPrepares the classifier to begin learning from itsUpdateableRegressor.update(jsat.classifiers.DataPoint, double)method.- Specified by:
setUpin interfaceUpdateableRegressor- Parameters:
categoricalAttributes- an array containing the categorical attributes that will be in each data pointnumericAttributes- the number of numeric attributes that will be in each data point
-
update
public void update(DataPoint dataPoint, double y_t)
Description copied from interface:UpdateableRegressorUpdates the classifier by giving it a new data point to learn from.- Specified by:
updatein interfaceUpdateableRegressor- Parameters:
dataPoint- the data point to learny_t- the target value of the data point
-
-
DataMelt 3.0 © DataMelt by jWork.ORG