InputType
- The type of the input to the function.
For example, Vector.public class KernelScalarFunction<InputType> extends DefaultKernelContainer<InputType> implements Regressor<InputType>
KernelScalarFunction
class implements a scalar function that
uses a kernel to compute its output value. It is parameterized by a kernel
function, a list of examples and their weights, and a bias term. This types
of scalar function represents what is learned by algorithms such as
Support Vector Regression.Modifier and Type | Field and Description |
---|---|
protected double |
bias
The bias term.
|
static double |
DEFAULT_BIAS
The default value for the bias is 0.0.
|
protected java.util.Collection<? extends WeightedValue<? extends InputType>> |
examples
The list of weighted examples that are used for categorization.
|
kernel
Constructor and Description |
---|
KernelScalarFunction()
Creates a new instance of KernelScalarFunction.
|
KernelScalarFunction(Kernel<? super InputType> kernel)
Creates a new instance of KernelScalarFunction with the given kernel.
|
KernelScalarFunction(Kernel<? super InputType> kernel,
java.util.Collection<? extends WeightedValue<? extends InputType>> examples,
double bias)
Creates a new instance of KernelScalarFunction with the given kernel,
weighted examples, and bias.
|
KernelScalarFunction(KernelScalarFunction<InputType> other)
Creates a new copy of a KernelScalarFunction.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Double |
evaluate(InputType input)
Evaluates the given input vector as a double by:
sum w_i * k(input, x_i)
|
double |
evaluateAsDouble(InputType input)
Evaluates the given input vector as a double by:
sum w_i * k(input, x_i)
|
double |
getBias()
Gets the bias term.
|
java.util.Collection<? extends WeightedValue<? extends InputType>> |
getExamples()
Gets the list of weighted examples that categorizer is using.
|
void |
setBias(double bias)
Sets the bias term.
|
void |
setExamples(java.util.Collection<? extends WeightedValue<? extends InputType>> examples)
Sets the list of weighted examples that categorizer is using.
|
clone, getKernel, setKernel
public static final double DEFAULT_BIAS
protected java.util.Collection<? extends WeightedValue<? extends InputType>> examples
protected double bias
public KernelScalarFunction()
public KernelScalarFunction(Kernel<? super InputType> kernel)
kernel
- The kernel to use.public KernelScalarFunction(Kernel<? super InputType> kernel, java.util.Collection<? extends WeightedValue<? extends InputType>> examples, double bias)
kernel
- The kernel to use.examples
- The weighted examples.bias
- The bias.public KernelScalarFunction(KernelScalarFunction<InputType> other)
other
- The KernelScalarFunction to copy.public java.lang.Double evaluate(InputType input)
public double evaluateAsDouble(InputType input)
evaluateAsDouble
in interface ScalarFunction<InputType>
input
- The input to categorize.public java.util.Collection<? extends WeightedValue<? extends InputType>> getExamples()
public void setExamples(java.util.Collection<? extends WeightedValue<? extends InputType>> examples)
examples
- The list of weighted examples.public double getBias()
public void setBias(double bias)
bias
- The bias term.