public class BinaryKernelMachineModel extends BinaryModel implements KernelMachineModel
bias
Constructor and Description |
---|
BinaryKernelMachineModel() |
BinaryKernelMachineModel(Kernel kernel) |
Modifier and Type | Method and Description |
---|---|
void |
addExample(float weight,
Example example)
Adds an example to the model with a given weight.
|
void |
addSupportVector(SupportVector supportVector)
Adds a support vector
NOTE: it does not check whether a support vector with the same instance of the
given supportVector is already in the model
|
Kernel |
getKernel() |
int |
getNumberOfSupportVectors() |
float |
getSquaredNorm(Example example)
Computes the squared norm of a given example according to the space in which the model
is operating
|
SupportVector |
getSupportVector(Example instance)
Returns the support vector associated to a given instance, null the instance
is not a support vector in this model
|
List<SupportVector> |
getSupportVectors()
Returns all the support vectors
|
boolean |
isSupportVector(Example instance)
Returns whether
instance is a support vector in this model |
void |
reset()
Resets the model parameters to the default state.
|
void |
setKernel(Kernel kernel) |
void |
setSupportVector(SupportVector sv,
int position)
Substitutes the support vector in position
position with
sv |
void |
setSupportVectors(List<SupportVector> supportVectors) |
getBias, setBias
public BinaryKernelMachineModel(Kernel kernel)
public BinaryKernelMachineModel()
public Kernel getKernel()
getKernel
in interface KernelMachineModel
public void setKernel(Kernel kernel)
setKernel
in interface KernelMachineModel
kernel
- the kernel to setpublic List<SupportVector> getSupportVectors()
public void setSupportVectors(List<SupportVector> supportVectors)
supportVectors
- the supportVectors to setpublic void addSupportVector(SupportVector supportVector)
supportVector
- the new support vector to be addedpublic void reset()
Model
public void addExample(float weight, Example example)
BinaryModel
addExample
in class BinaryModel
weight
- the weight of the new example to addexample
- the example to addpublic float getSquaredNorm(Example example)
BinaryModel
getSquaredNorm
in class BinaryModel
example
- the example whose squared norm is requiredpublic SupportVector getSupportVector(Example instance)
instance
- the instance whose corresponding support vector must be retrievedinstance
public boolean isSupportVector(Example instance)
KernelMachineModel
instance
is a support vector in this modelisSupportVector
in interface KernelMachineModel
instance
- the instanceinstance
is a support vector in this modelpublic void setSupportVector(SupportVector sv, int position)
position
with
sv
sv
- the new support vector to be addedposition
- the position in which sv
must be addedpublic int getNumberOfSupportVectors()
getNumberOfSupportVectors
in interface KernelMachineModel
Copyright © 2014 Semantic Analytics Group @ Uniroma2. All rights reserved.