ZGen  0.2.0
a linearization system for natural language.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
ZGen::BestFirst::Learner Class Reference

#include <learner.h>

Public Types

enum  { CONVERGED = 0, SAFE_UNCONVERGED, UNSAFE_UNCONVERGED, NO_GOLD_IN_AGENDA }
 The learning result status. More...
 

Public Member Functions

 Learner (Model *model, int max_iteration=1)
 
void config_model (Model *model)
 
void config_timestamp (int timestamp)
 
int learn (const SpanSet &gold_spans, SpanMaxHeap &agenda)
 

Member Enumeration Documentation

anonymous enum

The learning result status.

Enumerator
CONVERGED 
SAFE_UNCONVERGED 
UNSAFE_UNCONVERGED 
NO_GOLD_IN_AGENDA 

Constructor & Destructor Documentation

ZGen::BestFirst::Learner::Learner ( Model model,
int  max_iteration = 1 
)

Member Function Documentation

void ZGen::BestFirst::Learner::config_model ( Model model)

Config the model onto the learner.

Parameters
[in]modelThe pointer to the model.
void ZGen::BestFirst::Learner::config_timestamp ( int  timestamp)

Config the timestamp to learner.

Parameters
[in]timestampThe timestamp.
int ZGen::BestFirst::Learner::learn ( const SpanSet gold_spans,
SpanMaxHeap agenda 
)

The main function for Perceptron learning. The learning process includes:

  • 1: calculate the number of gold spans in the agenda.
  • 2: check whether the current agenda is converged.
  • 3: while not converged: update parameter, check converged

PREREQUISITE

  • model is configed.
  • timestamp is configed.
Parameters
[in]gold_spansThe set of gold spans.
in/out]agenda The agenda.
Returns
int The learning status.

The documentation for this class was generated from the following files: