InputType
- The input type for the categorizer.EntryType
- The type of weighted value entry in the categorizer's list of examples.public class KernelBinaryCategorizer<InputType,EntryType extends WeightedValue<? extends InputType>> extends AbstractDiscriminantBinaryCategorizer<InputType> implements KernelContainer<InputType>, ThresholdBinaryCategorizer<InputType>
KernelBinaryCategorizer
class implements a binary
categorizer that uses a kernel to do its categorization. It is parameterized
by a kernel function, a list of examples and their weights, and a bias term.
This type of classifier represents what is learned by a standard Support
Vector Machine or the Kernel Perceptron.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<EntryType> |
examples
The list of weighted examples that are used for categorization.
|
protected Kernel<? super InputType> |
kernel
The internal kernel.
|
BINARY_CATEGORIES
Constructor and Description |
---|
KernelBinaryCategorizer()
Creates a new instance of KernelBinaryCategorizer.
|
KernelBinaryCategorizer(Kernel<? super InputType> kernel)
Creates a new instance of KernelBinaryCategorizer with the given kernel.
|
KernelBinaryCategorizer(Kernel<? super InputType> kernel,
java.util.Collection<EntryType> examples,
double bias)
Creates a new instance of KernelBinaryCategorizer with the given kernel,
weighted examples, and bias.
|
KernelBinaryCategorizer(KernelBinaryCategorizer<InputType,? extends EntryType> other)
Creates a new copy of a KernelBinaryCategorizer.
|
Modifier and Type | Method and Description |
---|---|
double |
evaluateAsDouble(InputType input)
Categorizes the given input vector as a double by:
sum w_i * k(input, x_i)
|
double |
getBias()
Gets the bias term.
|
java.util.Collection<EntryType> |
getExamples()
Gets the list of weighted examples that categorizer is using.
|
Kernel<? super InputType> |
getKernel()
Gets the kernel.
|
double |
getThreshold()
Gets the threshold, which is the negative of the bias.
|
void |
setBias(double bias)
Sets the bias term.
|
void |
setExamples(java.util.Collection<EntryType> examples)
Sets the list of weighted examples that categorizer is using.
|
void |
setKernel(Kernel<? super InputType> kernel)
Sets the internal kernel.
|
void |
setThreshold(double threshold)
Sets the threshold, which is the negative of the bias.
|
evaluate, evaluateWithDiscriminant
getCategories
clone
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
evaluateWithDiscriminant
getCategories
clone
public static final double DEFAULT_BIAS
protected java.util.Collection<EntryType extends WeightedValue<? extends InputType>> examples
protected double bias
public KernelBinaryCategorizer()
public KernelBinaryCategorizer(Kernel<? super InputType> kernel)
kernel
- The kernel to use.public KernelBinaryCategorizer(Kernel<? super InputType> kernel, java.util.Collection<EntryType> examples, double bias)
kernel
- The kernel to use.examples
- The weighted examples.bias
- The bias.public KernelBinaryCategorizer(KernelBinaryCategorizer<InputType,? extends EntryType> other)
other
- The KernelBinaryCategorizer to copy.public double evaluateAsDouble(InputType input)
evaluateAsDouble
in interface DiscriminantBinaryCategorizer<InputType>
input
- The input to categorize.public double getThreshold()
getThreshold
in interface ThresholdBinaryCategorizer<InputType>
public void setThreshold(double threshold)
setThreshold
in interface ThresholdBinaryCategorizer<InputType>
threshold
- the threshold, which is the negative of the bias.public java.util.Collection<EntryType> getExamples()
public void setExamples(java.util.Collection<EntryType> examples)
examples
- The list of weighted examples.public double getBias()
public void setBias(double bias)
bias
- The bias term.public Kernel<? super InputType> getKernel()
KernelContainer
getKernel
in interface KernelContainer<InputType>