OBJECT
- Type of object being annotatedANNOTATION
- Type of annotationpublic class LinearSVMAnnotator<OBJECT,ANNOTATION> extends BatchAnnotator<OBJECT,ANNOTATION>
Annotator
based on a set of linear SVMs (one per annotation).
The SVMs use the PEGASOS algorithm implemented by the
PrimalEstimatedSubGradient
class.
Constructor and Description |
---|
LinearSVMAnnotator(FeatureExtractor<? extends FeatureVector,OBJECT> extractor)
Construct a new
LinearSVMAnnotator with the given extractor. |
LinearSVMAnnotator(FeatureExtractor<? extends FeatureVector,OBJECT> extractor,
ANNOTATION negativeClass)
Construct a new
LinearSVMAnnotator with the given extractor and
the specified negative class. |
Modifier and Type | Method and Description |
---|---|
List<ScoredAnnotation<ANNOTATION>> |
annotate(OBJECT object)
Generate annotations for the given object.
|
Set<ANNOTATION> |
getAnnotations() |
void |
train(List<? extends Annotated<OBJECT,ANNOTATION>> data)
Train the object with the given data.
|
train
classify
public LinearSVMAnnotator(FeatureExtractor<? extends FeatureVector,OBJECT> extractor, ANNOTATION negativeClass)
LinearSVMAnnotator
with the given extractor and
the specified negative class. The negative class is excluded from the
predicted annotations.extractor
- the extractornegativeClass
- the negative class to exclude from predictionspublic LinearSVMAnnotator(FeatureExtractor<? extends FeatureVector,OBJECT> extractor)
LinearSVMAnnotator
with the given extractor.extractor
- the extractorpublic void train(List<? extends Annotated<OBJECT,ANNOTATION>> data)
BatchTrainer
BatchTrainer
s should reset the underlying
model everytime this method is called.data
- the training datapublic Set<ANNOTATION> getAnnotations()
public List<ScoredAnnotation<ANNOTATION>> annotate(OBJECT object)
Annotator
object
- the image