Stump Class Reference

Decision stump. More...

#include <stump.h>

Inheritance diagram for Stump:

Inheritance graph
[legend]
Collaboration diagram for Stump:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Stump (UINT n_in=0)
 Stump (std::istream &is)
virtual const id_tid () const
virtual Stumpcreate () const
 Create a new object using the default constructor.
virtual Stumpclone () const
 Create a new object by replicating itself.
UINT index () const
REAL threshold () const
bool direction () const
bool soft_threshold () const
void use_soft_threshold (bool s=true)
virtual bool support_weighted_data () const
 Whether the learning model/algorithm supports unequally weighted data.
virtual void train ()
 Train with preset data set and sample weight.
virtual Output operator() (const Input &) const

Static Public Member Functions

static REAL train_1d (const std::vector< REAL > &, const std::vector< REAL > &, REAL, bool &, bool &, REAL &, REAL &)
 Find the optimal threshold and direction (prefer the middle thresholds).
static REAL train_1d (const std::vector< REAL > &, const std::vector< REAL > &)
 Find the optimal threshold for positive direction.

Protected Member Functions

virtual bool serialize (std::ostream &, ver_list &) const
virtual bool unserialize (std::istream &, ver_list &, const id_t &=NIL_ID)

Detailed Description

Decision stump.

Todo:
Documentation

Definition at line 18 of file stump.h.


Constructor & Destructor Documentation

Stump UINT  n_in = 0  )  [inline, explicit]
 

Definition at line 25 of file stump.h.

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

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

Definition at line 27 of file stump.h.


Member Function Documentation

virtual Stump* 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 31 of file stump.h.

References Stump::Stump().

virtual Stump* 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 30 of file stump.h.

References Stump::Stump().

bool direction  )  const [inline]
 

Definition at line 35 of file stump.h.

virtual const id_t& id  )  const [virtual]
 

Returns:
Class ID string (class name)

Implements Object.

UINT index  )  const [inline]
 

Definition at line 33 of file stump.h.

Output operator() const Input  )  const [virtual]
 

Implements LearnModel.

Definition at line 194 of file stump.cpp.

References LearnModel::n_input().

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

Reimplemented from LearnModel.

Definition at line 16 of file stump.cpp.

References SERIALIZE_PARENT.

bool soft_threshold  )  const [inline]
 

Definition at line 36 of file stump.h.

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 39 of file stump.h.

REAL threshold  )  const [inline]
 

Definition at line 34 of file stump.h.

void train  )  [virtual]
 

Train with preset data set and sample weight.

Implements LearnModel.

Definition at line 160 of file stump.cpp.

References LearnModel::_n_in, LearnModel::n_samples, LearnModel::ptd, LearnModel::ptw, LearnModel::set_dimensions(), and Stump::train_1d().

REAL train_1d const std::vector< REAL > &  ,
const std::vector< REAL > & 
[static]
 

Find the optimal threshold for positive direction.

Definition at line 43 of file stump.cpp.

References INFINITESIMAL, and INFINITY.

REAL train_1d const std::vector< REAL > &  ,
const std::vector< REAL > &  ,
REAL  ,
bool &  ,
bool &  ,
REAL ,
REAL
[static]
 

Find the optimal threshold and direction (prefer the middle thresholds).

Definition at line 82 of file stump.cpp.

References INFINITESIMAL.

Referenced by Stump::train().

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

Reimplemented from LearnModel.

Definition at line 22 of file stump.cpp.

References LearnModel::_n_in, LearnModel::_n_out, Object::NIL_ID, and UNSERIALIZE_PARENT.

void use_soft_threshold bool  s = true  )  [inline]
 

Definition at line 37 of file stump.h.


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