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()
Computes the squared norm of the hyperplane this model is based on
|
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
|
Integer |
getSupportVectorIndex(Example instance)
Returns the index of the 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) |
void |
substituteSupportVector(int index,
Example newInstance,
float newWeight) |
getBias, setBiaspublic BinaryKernelMachineModel(Kernel kernel)
public BinaryKernelMachineModel()
public Kernel getKernel()
getKernel in interface KernelMachineModelpublic void setKernel(Kernel kernel)
setKernel in interface KernelMachineModelkernel - 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()
Modelpublic void addExample(float weight,
Example example)
BinaryModeladdExample in class BinaryModelweight - the weight of the new example to addexample - the example to addpublic float getSquaredNorm(Example example)
BinaryModelgetSquaredNorm in class BinaryModelexample - the example whose squared norm is requiredpublic SupportVector getSupportVector(Example instance)
instance - the instance whose corresponding support vector must be retrievedinstancepublic Integer getSupportVectorIndex(Example instance)
instance - the instance whose corresponding support vector must be retrievedinstancepublic boolean isSupportVector(Example instance)
KernelMachineModelinstance is a support vector in this modelisSupportVector in interface KernelMachineModelinstance - the instanceinstance is a support vector in this modelpublic void setSupportVector(SupportVector sv, int position)
position with
svsv - the new support vector to be addedposition - the position in which sv must be addedpublic void substituteSupportVector(int index,
Example newInstance,
float newWeight)
public int getNumberOfSupportVectors()
getNumberOfSupportVectors in interface KernelMachineModelpublic float getSquaredNorm()
BinaryModelgetSquaredNorm in class BinaryModelCopyright © 2015 Semantic Analytics Group @ Uniroma2. All rights reserved.