OBJECT
- Type of object being annotatedANNOTATION
- Type of annotation@Reference(type=Article, author={"Fan, Rong-En","Chang, Kai-Wei","Hsieh, Cho-Jui","Wang, Xiang-Rui","Lin, Chih-Jen"}, title="LIBLINEAR: A Library for Large Linear Classification", year="2008", journal="J. Mach. Learn. Res.", pages={"1871","","1874"}, url="http://dl.acm.org/citation.cfm?id=1390681.1442794", month="june", publisher="JMLR.org", volume="9", customData={"date","6/1/2008","issn","1532-4435","numpages","4","acmid","1442794"}) public class LiblinearAnnotator<OBJECT,ANNOTATION> extends BatchAnnotator<OBJECT,ANNOTATION>
Linear
) or DenseLinear
depending on the density of the
features. Two modes of operation are available depending on whether the
problem is multiclass or multilabel. Binary classification can be achieved
with either mode, although multiclass mode is more efficient in this case.Modifier and Type | Class and Description |
---|---|
static class |
LiblinearAnnotator.Mode
The classifier mode; either multiclass or multilabel.
|
Constructor and Description |
---|
LiblinearAnnotator(FeatureExtractor<? extends FeatureVector,OBJECT> extractor,
LiblinearAnnotator.Mode mode,
de.bwaldvogel.liblinear.SolverType solver,
double C,
double eps)
Default constructor.
|
LiblinearAnnotator(FeatureExtractor<? extends FeatureVector,OBJECT> extractor,
LiblinearAnnotator.Mode mode,
de.bwaldvogel.liblinear.SolverType solver,
double C,
double eps,
double bias,
boolean dense)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
List<ScoredAnnotation<ANNOTATION>> |
annotate(OBJECT object)
Generate annotations for the given object.
|
Set<ANNOTATION> |
getAnnotations() |
void |
train(GroupedDataset<ANNOTATION,? extends ListDataset<OBJECT>,OBJECT> dataset)
Train the annotator with the given grouped dataset.
|
void |
train(List<? extends Annotated<OBJECT,ANNOTATION>> data)
Train the object with the given data.
|
classify
public LiblinearAnnotator(FeatureExtractor<? extends FeatureVector,OBJECT> extractor, LiblinearAnnotator.Mode mode, de.bwaldvogel.liblinear.SolverType solver, double C, double eps)
extractor
- the feature extractormode
- the modesolver
- the liblinear solverC
- the C parameter (usually 1 or larger)eps
- the epsilon valuepublic LiblinearAnnotator(FeatureExtractor<? extends FeatureVector,OBJECT> extractor, LiblinearAnnotator.Mode mode, de.bwaldvogel.liblinear.SolverType solver, double C, double eps, double bias, boolean dense)
extractor
- the feature extractormode
- the modesolver
- the liblinear solverC
- the C parameter (usually 1 or larger)eps
- the epsilon valuebias
- the biasdense
- are the features dense? If so the dense variant of liblinear
will be used to drastically reduce memory usagepublic 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 imagepublic void train(GroupedDataset<ANNOTATION,? extends ListDataset<OBJECT>,OBJECT> dataset)
BatchAnnotator
train
in class BatchAnnotator<OBJECT,ANNOTATION>
dataset
- the dataset to train on