InputType
- The type of the input to the Kernel. For example, Vector.@CodeReview(reviewer="Kevin R. Dixon", date="2009-07-08", changesNeeded=false, comments={"Made clone call super.clone.","Now implements Weighted interface.","Looks fine otherwise."}) public class WeightedKernel<InputType> extends DefaultKernelContainer<InputType> implements Kernel<InputType>, Weighted
WeightedKernel
class implements a kernel that takes another
kernel, evaluates it, and then the result is rescaled by a given weight.Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_WEIGHT
The default weight is 1.0.
|
protected double |
weight
The weight on the kernel.
|
kernel
Constructor and Description |
---|
WeightedKernel()
Creates a new instance of WeightedKernel with a default weight of 1.0
and a null kernel.
|
WeightedKernel(double weight,
Kernel<? super InputType> kernel)
Creates a new instance of WeightedKernel from the given weight and
kernel.
|
Modifier and Type | Method and Description |
---|---|
WeightedKernel<InputType> |
clone()
Creates a copy of this kernel.
|
double |
evaluate(InputType x,
InputType y)
The weighted kernel just passes the kernel evaluation to its own
internal kernel and then multiplies it by the weight.
|
double |
getWeight()
Gets the weight used to rescale the kernel's results.
|
void |
setWeight(double weight)
Sets the weight used to rescale the kernel's results.
|
getKernel, setKernel
public static final double DEFAULT_WEIGHT
protected double weight
public WeightedKernel()
public WeightedKernel<InputType> clone()
clone
in interface CloneableSerializable
clone
in class DefaultKernelContainer<InputType>
public double evaluate(InputType x, InputType y)
public double getWeight()
public void setWeight(double weight)
weight
- The kernel's weight. Must be non-negative.