Ordinal_BLE Class Reference

Ordinal regression via binary learning on extended examples. More...

#include <ordinal_ble.h>

Inheritance diagram for Ordinal_BLE:

Inheritance graph
[legend]
Collaboration diagram for Ordinal_BLE:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Ordinal_BLE ()
 Ordinal_BLE (const Ordinal_BLE &)
const Ordinal_BLEoperator= (const Ordinal_BLE &)
 Ordinal_BLE (std::istream &is)
virtual const id_tid () const
virtual Ordinal_BLEcreate () const
 Create a new object using the default constructor.
virtual Ordinal_BLEclone () const
 Create a new object by replicating itself.
void set_model (const LearnModel &)
 set the underlying learning model
const LearnModelmodel () const
 the underlying model
UINT n_rank () const
 the number of ranks from the training set
virtual bool support_weighted_data () const
 Whether the learning model/algorithm supports unequally weighted data.
virtual REAL c_error (const Output &out, const Output &y) const
 Error measure for classification problems.
virtual REAL r_error (const Output &out, const Output &y) const
 Error measure for regression problems.
virtual void set_train_data (const pDataSet &, const pDataWgt &=0)
 Set the data set and sample weight to be used in training.
virtual void train ()
 Train with preset data set and sample weight.
virtual void reset ()
virtual Output operator() (const Input &) const
bool full_extension () const
void set_full_extension (bool=true)
const ECOC_TABLEECOC_table () const
const EXT_TABLEextension_table () const
void set_tables (const ECOC_TABLE &, const EXT_TABLE &)
void set_tables (BLE_TYPE, UINT)

Protected Member Functions

void extend_input (const Input &, UINT, Input &) const
void extend_example (const Input &, UINT, UINT, Input &, REAL &) const
void extend_data ()
virtual REAL ECOC_distance (const Output &, const ECOC_VECTOR &) const
const std::vector< REAL > & distances (const Input &) const
virtual bool serialize (std::ostream &, ver_list &) const
virtual bool unserialize (std::istream &, ver_list &, const id_t &=NIL_ID)

Protected Attributes

pLearnModel lm
 the learning model
bool full_ext
 use the full extension or the partial one?
ECOC_TABLE out_tab
 K (nrank) by T (n_hyp) output ECC matrix.
EXT_TABLE ext_tab
 T (n_hyp) by E (n_ext) extension matrix.
UINT n_ext
pDataSet ext_d
 the extended dataset
pDataWgt ext_w
 the weight for the extended set
UINT d_nrank
 number of ranking levels of the training set
bool reset_data
 whether to reset the training set for lm
std::vector< REALlocal_d

Detailed Description

Ordinal regression via binary learning on extended examples.

Definition at line 23 of file ordinal_ble.h.


Constructor & Destructor Documentation

Ordinal_BLE  )  [inline]
 

Definition at line 32 of file ordinal_ble.h.

References LearnModel::set_dimensions().

Referenced by Ordinal_BLE::clone(), and Ordinal_BLE::create().

Ordinal_BLE const Ordinal_BLE  ) 
 

Definition at line 78 of file ordinal_ble.cpp.

References Ordinal_BLE::lm.

Ordinal_BLE std::istream &  is  )  [inline, explicit]
 

Definition at line 36 of file ordinal_ble.h.


Member Function Documentation

REAL c_error const Output out,
const Output y
const [virtual]
 

Error measure for classification problems.

Parameters:
out is the output from the learned hypothesis.
y is the real output.
Returns:
Classification error between out and y. The error measure is not necessary symmetric. A commonly used measure is out != y.

Reimplemented from LearnModel.

Definition at line 152 of file ordinal_ble.cpp.

References LearnModel::n_output(), OUT2RANK, and VALIDRANK.

virtual Ordinal_BLE* clone  )  const [inline, virtual]
 

Create a new object by replicating itself.

Returns:
A pointer to the new copy.
The code for a derived class Derived is always
 return new Derived(*this); 
Though seemingly redundant, it helps to copy an object without knowing the real type of the object.
See also:
C++ FAQ Lite 20.6

Implements LearnModel.

Definition at line 40 of file ordinal_ble.h.

References Ordinal_BLE::Ordinal_BLE().

virtual Ordinal_BLE* create  )  const [inline, virtual]
 

Create a new object using the default constructor.

The code for a derived class Derived is always

 return new Derived(); 

Implements LearnModel.

Definition at line 39 of file ordinal_ble.h.

References Ordinal_BLE::Ordinal_BLE().

const std::vector< REAL > & distances const Input  )  const [protected]
 

Definition at line 304 of file ordinal_ble.cpp.

References Ordinal_BLE::extend_input(), and Ordinal_BLE::lm.

Referenced by Ordinal_BLE::operator()().

REAL ECOC_distance const Output ,
const ECOC_VECTOR
const [protected, virtual]
 

Definition at line 295 of file ordinal_ble.cpp.

const ECOC_TABLE& ECOC_table  )  const [inline]
 

Definition at line 50 of file ordinal_ble.h.

References Ordinal_BLE::out_tab.

void extend_data  )  [protected]
 

Definition at line 203 of file ordinal_ble.cpp.

References dataset::append(), Ordinal_BLE::extend_example(), LearnModel::n_samples, nrank, OUT2RANK, and LearnModel::ptd.

Referenced by Ordinal_BLE::train().

void extend_example const Input ,
UINT  ,
UINT  ,
Input ,
REAL
const [protected]
 

Definition at line 287 of file ordinal_ble.cpp.

References Ordinal_BLE::extend_input(), nrank, and Ordinal_BLE::out_tab.

Referenced by Ordinal_BLE::extend_data().

void extend_input const Input x,
UINT  t,
Input ext_x
const [protected]
 

  • t: hypothesis index

Definition at line 278 of file ordinal_ble.cpp.

References Ordinal_BLE::ext_tab.

Referenced by Ordinal_BLE::distances(), and Ordinal_BLE::extend_example().

const EXT_TABLE& extension_table  )  const [inline]
 

Definition at line 51 of file ordinal_ble.h.

References Ordinal_BLE::ext_tab.

bool full_extension  )  const [inline]
 

Definition at line 48 of file ordinal_ble.h.

References Ordinal_BLE::full_ext.

virtual const id_t& id  )  const [virtual]
 

Returns:
Class ID string (class name)

Implements Object.

const LearnModel& model  )  const [inline]
 

the underlying model

Definition at line 45 of file ordinal_ble.h.

References Ordinal_BLE::lm.

UINT n_rank  )  const [inline]
 

the number of ranks from the training set

Definition at line 57 of file ordinal_ble.h.

References Ordinal_BLE::d_nrank.

Output operator() const Input  )  const [virtual]
 

Implements LearnModel.

Definition at line 270 of file ordinal_ble.cpp.

References Ordinal_BLE::distances(), GET_BEST_RANK, RANK2OUT, and LearnModel::valid_dimensions().

const Ordinal_BLE & operator= const Ordinal_BLE  ) 
 

Definition at line 87 of file ordinal_ble.cpp.

References Ordinal_BLE::d_nrank, Ordinal_BLE::ext_d, Ordinal_BLE::ext_tab, Ordinal_BLE::ext_w, Ordinal_BLE::full_ext, Ordinal_BLE::lm, Ordinal_BLE::n_ext, Ordinal_BLE::out_tab, and Ordinal_BLE::reset_data.

REAL r_error const Output out,
const Output y
const [virtual]
 

Error measure for regression problems.

Parameters:
out is the output from the learned hypothesis.
y is the real output.
Returns:
Regression error between out and y. A commonly used measure is the squared error.

Reimplemented from LearnModel.

Definition at line 157 of file ordinal_ble.cpp.

References LearnModel::n_output(), and VALIDRANK.

void reset  )  [virtual]
 

Cleaning up the learning model but keeping most settings.

Note:
This is probably needed after training or loading from file, but before having another training.

Reimplemented from LearnModel.

Definition at line 257 of file ordinal_ble.cpp.

References Ordinal_BLE::lm, and LearnModel::reset().

bool serialize std::ostream &  ,
ver_list
const [protected, virtual]
 

Reimplemented from LearnModel.

Definition at line 18 of file ordinal_ble.cpp.

References Ordinal_BLE::full_ext, Ordinal_BLE::lm, Ordinal_BLE::n_ext, n_hyp, nrank, Ordinal_BLE::out_tab, and SERIALIZE_PARENT.

void set_full_extension bool  = true  ) 
 

Definition at line 105 of file ordinal_ble.cpp.

References Ordinal_BLE::ext_d, Ordinal_BLE::ext_w, and Ordinal_BLE::full_ext.

void set_model const LearnModel  ) 
 

set the underlying learning model

Definition at line 100 of file ordinal_ble.cpp.

References LearnModel::clone(), Ordinal_BLE::lm, and Ordinal_BLE::reset_data.

void set_tables BLE_TYPE  ,
UINT 
 

Definition at line 126 of file ordinal_ble.cpp.

References lemga::MULTI_THRESHOLD.

void set_tables const ECOC_TABLE ,
const EXT_TABLE
 

Definition at line 113 of file ordinal_ble.cpp.

References Ordinal_BLE::ext_tab, Ordinal_BLE::local_d, nrank, and Ordinal_BLE::out_tab.

Referenced by Ordinal_BLE::train().

void set_train_data const pDataSet pd,
const pDataWgt pw = 0
[virtual]
 

Set the data set and sample weight to be used in training.

If the learning model/algorithm can only do training using uniform sample weight, i.e., support_weighted_data() returns false, a ``boostrapped'' copy of the original data set will be generated and used in the following training. The boostrapping is done by randomly pick samples (with replacement) w.r.t. the given weight pw.

In order to make the life easier, when support_weighted_data() returns true, a null pw will be replaced by a uniformly distributed probability vector. So we have the following invariant

Invariant:
support_weighted_data() == (ptw != 0)
Parameters:
pd gives the data set.
pw gives the sample weight, whose default value is 0.
See also:
support_weighted_data(), train()

Reimplemented from LearnModel.

Definition at line 162 of file ordinal_ble.cpp.

References Ordinal_BLE::d_nrank, Ordinal_BLE::ext_d, Ordinal_BLE::ext_w, LearnModel::n_samples, OUT2RANK, LearnModel::ptd, LearnModel::set_train_data(), and VALIDRANK.

virtual bool support_weighted_data  )  const [inline, virtual]
 

Whether the learning model/algorithm supports unequally weighted data.

Returns:
true if supporting; false otherwise. The default is false, just for safety.
See also:
set_train_data()

Reimplemented from LearnModel.

Definition at line 59 of file ordinal_ble.h.

void train  )  [virtual]
 

Train with preset data set and sample weight.

Implements LearnModel.

Definition at line 232 of file ordinal_ble.cpp.

References lemga::BLE_DEFAULT, Ordinal_BLE::d_nrank, Ordinal_BLE::ext_d, Ordinal_BLE::ext_w, Ordinal_BLE::extend_data(), Ordinal_BLE::lm, nrank, LearnModel::ptd, LearnModel::ptw, Ordinal_BLE::reset_data, LearnModel::set_dimensions(), and Ordinal_BLE::set_tables().

bool unserialize std::istream &  ,
ver_list ,
const id_t = NIL_ID
[protected, virtual]
 

Reimplemented from LearnModel.

Definition at line 45 of file ordinal_ble.cpp.

References Ordinal_BLE::d_nrank, Ordinal_BLE::ext_d, Ordinal_BLE::ext_tab, Ordinal_BLE::ext_w, Ordinal_BLE::full_ext, Ordinal_BLE::lm, Ordinal_BLE::n_ext, n_hyp, Object::NIL_ID, nrank, Ordinal_BLE::out_tab, LearnModel::ptd, LearnModel::ptw, Ordinal_BLE::reset_data, and UNSERIALIZE_PARENT.


Member Data Documentation

UINT d_nrank [protected]
 

number of ranking levels of the training set

Definition at line 70 of file ordinal_ble.h.

Referenced by Ordinal_BLE::n_rank(), Ordinal_BLE::operator=(), Ordinal_BLE::set_train_data(), Ordinal_BLE::train(), and Ordinal_BLE::unserialize().

pDataSet ext_d [protected]
 

the extended dataset

Definition at line 68 of file ordinal_ble.h.

Referenced by Ordinal_BLE::operator=(), Ordinal_BLE::set_full_extension(), Ordinal_BLE::set_train_data(), Ordinal_BLE::train(), and Ordinal_BLE::unserialize().

EXT_TABLE ext_tab [protected]
 

T (n_hyp) by E (n_ext) extension matrix.

Definition at line 28 of file ordinal_ble.h.

Referenced by Ordinal_BLE::extend_input(), Ordinal_BLE::extension_table(), Ordinal_BLE::operator=(), Ordinal_BLE::set_tables(), and Ordinal_BLE::unserialize().

pDataWgt ext_w [protected]
 

the weight for the extended set

Definition at line 69 of file ordinal_ble.h.

Referenced by Ordinal_BLE::operator=(), Ordinal_BLE::set_full_extension(), Ordinal_BLE::set_train_data(), Ordinal_BLE::train(), and Ordinal_BLE::unserialize().

bool full_ext [protected]
 

use the full extension or the partial one?

Definition at line 26 of file ordinal_ble.h.

Referenced by Ordinal_BLE::full_extension(), Ordinal_BLE::operator=(), Ordinal_BLE::serialize(), Ordinal_BLE::set_full_extension(), and Ordinal_BLE::unserialize().

pLearnModel lm [protected]
 

the learning model

Definition at line 25 of file ordinal_ble.h.

Referenced by Ordinal_BLE::distances(), Ordinal_BLE::model(), Ordinal_BLE::operator=(), Ordinal_BLE::Ordinal_BLE(), Ordinal_BLE::reset(), Ordinal_BLE::serialize(), Ordinal_BLE::set_model(), Ordinal_BLE::train(), and Ordinal_BLE::unserialize().

std::vector<REAL> local_d [mutable, protected]
 

Definition at line 78 of file ordinal_ble.h.

Referenced by Ordinal_BLE::set_tables().

UINT n_ext [protected]
 

Definition at line 29 of file ordinal_ble.h.

Referenced by Ordinal_BLE::operator=(), Ordinal_BLE::serialize(), and Ordinal_BLE::unserialize().

ECOC_TABLE out_tab [protected]
 

K (nrank) by T (n_hyp) output ECC matrix.

Definition at line 27 of file ordinal_ble.h.

Referenced by Ordinal_BLE::ECOC_table(), Ordinal_BLE::extend_example(), Ordinal_BLE::operator=(), Ordinal_BLE::serialize(), Ordinal_BLE::set_tables(), and Ordinal_BLE::unserialize().

bool reset_data [protected]
 

whether to reset the training set for lm

Definition at line 71 of file ordinal_ble.h.

Referenced by Ordinal_BLE::operator=(), Ordinal_BLE::set_model(), Ordinal_BLE::train(), and Ordinal_BLE::unserialize().


The documentation for this class was generated from the following files:
Generated on Wed Nov 8 08:17:19 2006 for LEMGA by  doxygen 1.4.6