jsat.regression
Class KernelRidgeRegression
- java.lang.Object
-
- jsat.regression.KernelRidgeRegression
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Parameterized, Regressor
public class KernelRidgeRegression extends java.lang.Object implements Regressor, Parameterized
A kernelized implementation of Ridge Regression. Ridge Regression is equivalent toMultipleLinearRegressionwith an added L2 penalty for the weight vector.
This algorithm is very expensive to compute O(n3), where n is the number of training points.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description KernelRidgeRegression()Creates a new Kernel Ridge Regression learner that uses an RBF kernelKernelRidgeRegression(double lambda, KernelTrick kernel)Creates a new Kernel Ridge Regression learner
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description KernelRidgeRegressionclone()KernelTrickgetKernel()Returns the kernel in usedoublegetLambda()Returns the regularization constant in usestatic DistributionguessLambda(DataSet d)Guesses the distribution to use for the λ parameterdoubleregress(DataPoint data)voidsetKernel(KernelTrick k)Sets the kernel trick to usevoidsetLambda(double lambda)Sets the regularization parameter used.booleansupportsWeightedData()voidtrain(RegressionDataSet dataSet, boolean parallel)-
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
-
KernelRidgeRegression
public KernelRidgeRegression()
Creates a new Kernel Ridge Regression learner that uses an RBF kernel
-
KernelRidgeRegression
public KernelRidgeRegression(double lambda, KernelTrick kernel)Creates a new Kernel Ridge Regression learner- Parameters:
lambda- the regularization parameterkernel- the kernel to use- See Also:
setLambda(double)
-
-
Method Detail
-
guessLambda
public static Distribution guessLambda(DataSet d)
Guesses the distribution to use for the λ parameter- Parameters:
d- the dataset to get the guess for- Returns:
- the guess for the λ parameter
-
setLambda
public void setLambda(double lambda)
Sets the regularization parameter used. The value of lambda depends on the data set and kernel used, with easier problems using smaller lambdas.- Parameters:
lambda- the positive regularization constant in (0, Inf)
-
getLambda
public double getLambda()
Returns the regularization constant in use- Returns:
- the regularization constant in use
-
setKernel
public void setKernel(KernelTrick k)
Sets the kernel trick to use- Parameters:
k- the kernel to use
-
getKernel
public KernelTrick getKernel()
Returns the kernel in use- Returns:
- the kernel in use
-
train
public void train(RegressionDataSet dataSet, boolean parallel)
-
supportsWeightedData
public boolean supportsWeightedData()
- Specified by:
supportsWeightedDatain interfaceRegressor
-
clone
public KernelRidgeRegression clone()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG