This class is responsible for caching the path to each node of the tree. More...

Public Types

enum  PathFormat
{
  FormatLR
,
  FormatLR_ID
,
  FormatID_LR

}
 Possible formats to use for output. More...

 

Public Member Functions

template
<
typename
MatType
>
 PathCacher (PathFormat fmt, DTree< MatType, int > *tree)
 Construct a PathCacher object on the given tree with the given format. More...

 
template
<
typename
MatType
>
void Enter (const DTree< MatType, int > *node, const DTree< MatType, int > *parent)
 Enter a given node. More...

 
template
<
typename
MatType
>
void Leave (const DTree< MatType, int > *node, const DTree< MatType, int > *parent)
 Leave the given node. More...

 
size_t NumNodes () const
 Get the number of nodes in the path cache. More...

 
int ParentOf (int tag) const
 Get the parent tag of a given tag. More...

 
const std::string & PathFor (int tag) const
 Return the constructed path for a given tag. More...

 

Protected Types

typedef std::vector< std::pair< int, std::string > > PathCacheType
 
typedef std::list< std::pair< bool, int > > PathType
 

Protected Member Functions

std::string BuildString ()
 

Protected Attributes

PathFormat format
 
PathType path
 
PathCacheType pathCache
 

Detailed Description

This class is responsible for caching the path to each node of the tree.

Its instance is provided to EnumerateTree() utility ONCE and it caches the paths to all the leafs and then easily (and quickly) retrieves these paths for each test entry.

Definition at line 81 of file dt_utils.hpp.

Member Typedef Documentation

◆ PathCacheType

typedef std::vector<std::pair<int, std::string> > PathCacheType
protected

Definition at line 137 of file dt_utils.hpp.

◆ PathType

typedef std::list<std::pair<bool, int> > PathType
protected

Definition at line 136 of file dt_utils.hpp.

Member Enumeration Documentation

◆ PathFormat

enum PathFormat

Possible formats to use for output.

Enumerator
FormatLR 

Print only whether we went left or right.

FormatLR_ID 

Print the direction, then the tag of the node.

FormatID_LR 

Print the tag of the node, then the direction.

Definition at line 87 of file dt_utils.hpp.

Constructor & Destructor Documentation

◆ PathCacher()

PathCacher ( PathFormat  fmt,
DTree< MatType, int > *  tree 
)

Construct a PathCacher object on the given tree with the given format.

Parameters
fmtFormat to use for output.
treeTree to cache paths in.

Member Function Documentation

◆ BuildString()

std::string BuildString ( )
inlineprotected

◆ Enter()

void Enter ( const DTree< MatType, int > *  node,
const DTree< MatType, int > *  parent 
)

Enter a given node.

◆ Leave()

void Leave ( const DTree< MatType, int > *  node,
const DTree< MatType, int > *  parent 
)

Leave the given node.

◆ NumNodes()

size_t NumNodes ( ) const
inline

Get the number of nodes in the path cache.

Definition at line 133 of file dt_utils.hpp.

References PathCacher::pathCache.

◆ ParentOf()

int ParentOf ( int  tag) const
inline

Get the parent tag of a given tag.

◆ PathFor()

const std::string& PathFor ( int  tag) const
inline

Return the constructed path for a given tag.

Member Data Documentation

◆ format

PathFormat format
protected

Definition at line 140 of file dt_utils.hpp.

◆ path

PathType path
protected

Definition at line 139 of file dt_utils.hpp.

◆ pathCache

PathCacheType pathCache
protected

Definition at line 141 of file dt_utils.hpp.

Referenced by PathCacher::NumNodes().


The documentation for this class was generated from the following file:
  • /home/ryan/src/mlpack.org/_src/mlpack-git/src/mlpack/methods/det/dt_utils.hpp