FreeLing
4.0
|
Class example is a vector of real-valued features, each identified by an integer label, plus info about to which classes the example belongs to, and with prediction storage functionalities. More...
#include <example.h>
Public Member Functions | |
example (int nl) | |
constructors | |
example (const example &e) | |
copy constructor | |
example (double f1, const example &i1, double f2, const example &i2) | |
new example is f1*i1 + f2*i2 | |
double | norm () const |
compute norm of example as a vector | |
void | add_feature (int l, double v=1.0) |
update functions | |
int | get_nlabels () const |
consultors | |
double | get_feature_value (int label) const |
int | get_dimension () const |
double | inner_product (const example &i2) const |
compute inner product with given feature vector | |
void | add_vector (double f, const example &i2) |
add given feature vector with given weight | |
void | set_label (int l, bool b, double w, double pr) |
label and prediction management | |
void | set_belongs (int l, bool b) |
bool | belongs (int l) const |
int | sign (int l) const |
void | set_weight (int l, double w) |
double | get_weight (int l) const |
void | set_prediction (int l, double pr) |
double | get_prediction (int l) const |
Private Attributes | |
int | dimension |
highest integer label | |
std::vector< category > | labels |
label management | |
int | nlabels |
Class example is a vector of real-valued features, each identified by an integer label, plus info about to which classes the example belongs to, and with prediction storage functionalities.
constructors
freeling::example::example | ( | const example & | e | ) |
copy constructor
freeling::example::example | ( | double | f1, |
const example & | i1, | ||
double | f2, | ||
const example & | i2 | ||
) |
new example is f1*i1 + f2*i2
void freeling::example::add_feature | ( | int | l, |
double | v = 1.0 |
||
) |
update functions
Referenced by freeling::nec::analyze(), and freeling::bioner::analyze().
void freeling::example::add_vector | ( | double | f, |
const example & | i2 | ||
) |
add given feature vector with given weight
bool freeling::example::belongs | ( | int | l | ) | const |
int freeling::example::get_dimension | ( | ) | const |
double freeling::example::get_feature_value | ( | int | label | ) | const |
int freeling::example::get_nlabels | ( | ) | const |
consultors
double freeling::example::get_prediction | ( | int | l | ) | const |
double freeling::example::get_weight | ( | int | l | ) | const |
double freeling::example::inner_product | ( | const example & | i2 | ) | const |
compute inner product with given feature vector
double freeling::example::norm | ( | ) | const |
compute norm of example as a vector
void freeling::example::set_belongs | ( | int | l, |
bool | b | ||
) |
void freeling::example::set_label | ( | int | l, |
bool | b, | ||
double | w, | ||
double | pr | ||
) |
label and prediction management
void freeling::example::set_prediction | ( | int | l, |
double | pr | ||
) |
void freeling::example::set_weight | ( | int | l, |
double | w | ||
) |
int freeling::example::sign | ( | int | l | ) | const |
int freeling::example::dimension [private] |
highest integer label
std::vector<category> freeling::example::labels [private] |
label management
int freeling::example::nlabels [private] |