AP Class Reference
Averaged Perceptron Classifier.
More...
#include <ap.h>
List of all members.
Public Member Functions |
void | train (Cases &cases, int T) |
| Train the perceptron with a set of cases , performing T iterations through them.
|
int | train (Case &cas) |
| Train a single case.
|
Y | predict (X &x) |
std::vector< Float > | scores (X &x) |
virtual size_t | size () |
Public Attributes |
unsigned | k |
| k = |Y|
|
unsigned | d |
| d = |X|
|
int | t |
| t = current number of iterations
|
std::vector< std::string > | labels |
Tanl::Text::WordIndex | predIndex |
Static Public Attributes |
static float | updatePercent = 0.1F |
| Termination threshold.
|
static bool | verbose = false |
| Control output.
|
static int | partitionSize = 500000 |
| Split cases into partitions of this maximum size.
|
Protected Member Functions |
virtual void | update (X &x, unsigned yt, std::vector< unsigned > &E)=0 |
virtual Float | score (unsigned i, X &v)=0 |
| Similarity score.
|
| AP (int k=0, int d=0) |
virtual bool | load (std::istream &is) |
| Load parameters from stream.
|
Detailed Description
Averaged Perceptron Classifier.
- See also:
- http://jmlr.csail.mit.edu/papers/volume3/crammer03a/crammer03a.pdf K. Crammer, Y. Singer, Ultraconservative Online Algorithms for Multiclass Problems. Journ. of Machine Learning Research, 2003.
Member Function Documentation
virtual bool AP::load |
( |
std::istream & |
is |
) |
[protected, virtual] |
Load parameters from stream.
- Returns:
- true if successful
Reimplemented in APS, APSV, and APD.
vector< Float > AP::scores |
( |
X & |
x |
) |
|
- Returns:
- a vector with the scores for all labels
References score().
virtual size_t AP::size |
( |
|
) |
[inline, virtual] |
- Returns:
- number of features
Reimplemented in APS, and APSV.
int AP::train |
( |
Case & |
cas |
) |
|
Train a single case.
train(<xi, yi>) train the current model on <xi, yi>
- Returns:
- true if an update was performed.
References score(), and t.
The documentation for this class was generated from the following files:
- parse/desr/src/ap.h
- parse/desr/src/ap.cpp