Classes | Public Types | Public Member Functions | Public Attributes | Private Attributes
Stump Class Reference

#include <Stump.hh>

Inheritance diagram for Stump:
Inheritance graph
[legend]

List of all members.

Classes

struct  stump_experience

Public Types

enum  splitTypes { ONLY, CUT }

Public Member Functions

void buildStump ()
float calcGainRatio (int dim, float val, int type, float I)
float calcIforSet (const std::vector< stump_experience * > &instances)
float calcIofP (float *P, int size)
void compareSplits (float gainRatio, int dim, float val, int type, int *nties, float *bestGainRatio, int *bestDim, float *bestVal, int *bestType)
int findMatching (const std::vector< stump_experience * > &instances, int dim, int val, int minConf)
float getConf (const std::vector< float > &input)
virtual StumpgetCopy ()
void implementSplit (float bestGainRatio, int bestDim, float bestVal, int bestType)
void initStump ()
void outputProbabilities (std::multiset< float > outputs, std::map< float, float > *retval)
bool passTest (int dim, float val, int type, const std::vector< float > &input)
void printStump ()
void setParams (float margin, float forestPct, float minRatio)
float * sortOnDim (int dim)
 Stump (int id, int trainMode, int trainFreq, int m, float featPct, Random rng)
 Stump (const Stump &)
void testInstance (const std::vector< float > &input, std::map< float, float > *retval)
void testPossibleSplits (float *bestGainRatio, int *bestDim, float *bestVal, int *bestType)
bool trainInstance (classPair &instance)
bool trainInstances (std::vector< classPair > &instances)
 ~Stump ()

Public Attributes

bool ALLOW_ONLY_SPLITS
float LOSS_MARGIN
float MIN_GAIN_RATIO
int nExperiences
float REBUILD_RATIO
float SPLIT_MARGIN
bool SPLITDEBUG
bool STDEBUG

Private Attributes

stump_experience allExp [N_STUMP_EXP]
int dim
std::vector< stump_experience * > experiences
float featPct
const int freq
float gainRatio
const int id
std::multiset< float > leftOutputs
const int M
const int mode
int nnodes
int nOutput
std::multiset< float > rightOutputs
Random rng
int type
float val

Detailed Description

C4.5 decision stump class

Definition at line 13 of file Stump.hh.


Member Enumeration Documentation

Enumerator:
ONLY 
CUT 

Definition at line 35 of file Stump.hh.


Constructor & Destructor Documentation

Stump::Stump ( int  id,
int  trainMode,
int  trainFreq,
int  m,
float  featPct,
Random  rng 
)

Definition at line 5 of file Stump.cc.

Stump::Stump ( const Stump s)

Definition at line 35 of file Stump.cc.

Definition at line 72 of file Stump.cc.


Member Function Documentation

Build the stump from this node down using this set of experiences.

Definition at line 366 of file Stump.cc.

float Stump::calcGainRatio ( int  dim,
float  val,
int  type,
float  I 
)

Calculate gain ratio for this possible split.

Definition at line 550 of file Stump.cc.

float Stump::calcIforSet ( const std::vector< stump_experience * > &  instances)

Calculate I(P) for set.

Definition at line 627 of file Stump.cc.

float Stump::calcIofP ( float *  P,
int  size 
)

Definition at line 617 of file Stump.cc.

void Stump::compareSplits ( float  gainRatio,
int  dim,
float  val,
int  type,
int *  nties,
float *  bestGainRatio,
int *  bestDim,
float *  bestVal,
int *  bestType 
)

Decide if this split is better.

Definition at line 500 of file Stump.cc.

int Stump::findMatching ( const std::vector< stump_experience * > &  instances,
int  dim,
int  val,
int  minConf 
)

Definition at line 302 of file Stump.cc.

float Stump::getConf ( const std::vector< float > &  input) [virtual]

Implements Classifier.

Definition at line 284 of file Stump.cc.

Stump * Stump::getCopy ( ) [virtual]

Implements Classifier.

Definition at line 67 of file Stump.cc.

void Stump::implementSplit ( float  bestGainRatio,
int  bestDim,
float  bestVal,
int  bestType 
)

Definition at line 390 of file Stump.cc.

void Stump::initStump ( )

Definition at line 322 of file Stump.cc.

void Stump::outputProbabilities ( std::multiset< float >  outputs,
std::map< float, float > *  retval 
)

See if the attributes are independent of the output class If they are all independent, we have no more inputs to split on

Definition at line 855 of file Stump.cc.

bool Stump::passTest ( int  dim,
float  val,
int  type,
const std::vector< float > &  input 
)

Decide if this passes the test

Definition at line 342 of file Stump.cc.

Print the stump for debug purposes.

Definition at line 728 of file Stump.cc.

void Stump::setParams ( float  margin,
float  forestPct,
float  minRatio 
)
float * Stump::sortOnDim ( int  dim)

Returns a list of the attributes in this dimension sorted from lowest to highest.

Definition at line 672 of file Stump.cc.

void Stump::testInstance ( const std::vector< float > &  input,
std::map< float, float > *  retval 
) [virtual]

Implements Classifier.

Definition at line 265 of file Stump.cc.

void Stump::testPossibleSplits ( float *  bestGainRatio,
int *  bestDim,
float *  bestVal,
int *  bestType 
)

Definition at line 433 of file Stump.cc.

bool Stump::trainInstance ( classPair instance) [virtual]

Implements Classifier.

Definition at line 173 of file Stump.cc.

bool Stump::trainInstances ( std::vector< classPair > &  instances) [virtual]

Implements Classifier.

Definition at line 81 of file Stump.cc.


Member Data Documentation

Definition at line 96 of file Stump.hh.

Definition at line 69 of file Stump.hh.

int Stump::dim [private]

Definition at line 99 of file Stump.hh.

std::vector<stump_experience*> Stump::experiences [private]

Definition at line 95 of file Stump.hh.

float Stump::featPct [private]

Definition at line 87 of file Stump.hh.

const int Stump::freq [private]

Definition at line 85 of file Stump.hh.

float Stump::gainRatio [private]

Definition at line 102 of file Stump.hh.

const int Stump::id [private]

Definition at line 82 of file Stump.hh.

std::multiset<float> Stump::leftOutputs [private]

Definition at line 105 of file Stump.hh.

Definition at line 78 of file Stump.hh.

const int Stump::M [private]

Definition at line 86 of file Stump.hh.

Definition at line 76 of file Stump.hh.

const int Stump::mode [private]

Definition at line 84 of file Stump.hh.

Definition at line 73 of file Stump.hh.

int Stump::nnodes [private]

Definition at line 92 of file Stump.hh.

int Stump::nOutput [private]

Definition at line 91 of file Stump.hh.

Definition at line 77 of file Stump.hh.

std::multiset<float> Stump::rightOutputs [private]

Definition at line 106 of file Stump.hh.

Random Stump::rng [private]

Definition at line 89 of file Stump.hh.

Definition at line 75 of file Stump.hh.

Definition at line 72 of file Stump.hh.

Definition at line 71 of file Stump.hh.

int Stump::type [private]

Definition at line 101 of file Stump.hh.

float Stump::val [private]

Definition at line 100 of file Stump.hh.


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


rl_agent
Author(s): Todd Hester
autogenerated on Thu Jun 6 2019 22:00:14