This class defines, for each EventKeyType, a set of initial questions that it tries and also a number of iterations for which to refine the questions to increase likelihood. More...
#include <build-tree-questions.h>
Public Member Functions | |
const QuestionsForKey & | GetQuestionsOf (EventKeyType key) const |
void | SetQuestionsOf (EventKeyType key, const QuestionsForKey &options_of_key) |
void | GetKeysWithQuestions (std::vector< EventKeyType > *keys_out) const |
bool | HasQuestionsForKey (EventKeyType key) const |
~Questions () | |
Questions () | |
Initializer with arguments. More... | |
void | InitRand (const BuildTreeStatsType &stats, int32 num_quest, int32 num_iters_refine, AllKeysType all_keys_type) |
InitRand attempts to generate "reasonable" random questions. More... | |
void | Write (std::ostream &os, bool binary) const |
void | Read (std::istream &is, bool binary) |
Private Member Functions | |
KALDI_DISALLOW_COPY_AND_ASSIGN (Questions) | |
Private Attributes | |
std::vector< QuestionsForKey * > | key_options_ |
std::map< EventKeyType, size_t > | key_idx_ |
This class defines, for each EventKeyType, a set of initial questions that it tries and also a number of iterations for which to refine the questions to increase likelihood.
It is perhaps a bit more than an options class, as it contains the actual questions.
Definition at line 77 of file build-tree-questions.h.
|
inline |
Definition at line 108 of file build-tree-questions.h.
References kaldi::DeletePointers().
|
inline |
Initializer with arguments.
After using this you would have to set up the config for each key you are going to use, or use InitRand().
Definition at line 113 of file build-tree-questions.h.
References kaldi::InitRand(), QuestionsForKey::Read(), and QuestionsForKey::Write().
|
inline |
Definition at line 101 of file build-tree-questions.h.
References kaldi::CopyMapKeysToVector(), and KALDI_ASSERT.
Referenced by DecisionTreeSplitter::FindBestSplit(), and kaldi::TestBuildTree().
|
inline |
Definition at line 79 of file build-tree-questions.h.
References KALDI_ASSERT, and KALDI_ERR.
Referenced by kaldi::ComputeInitialSplit(), kaldi::FindBestSplitForKey(), kaldi::TestBuildTree(), kaldi::TestQuestionsInitRand(), and kaldi::TestSplitDecisionTree().
|
inline |
Definition at line 105 of file build-tree-questions.h.
Referenced by DecisionTreeSplitter::FindBestSplit(), kaldi::TestBuildTree(), kaldi::TestQuestionsInitRand(), and kaldi::TestSplitDecisionTree().
void InitRand | ( | const BuildTreeStatsType & | stats, |
int32 | num_quest, | ||
int32 | num_iters_refine, | ||
AllKeysType | all_keys_type | ||
) |
InitRand attempts to generate "reasonable" random questions.
Only of use for debugging. This initializer creates a config that is ready to use. e.g. num_iters_refine = 0 means just use stated questions (if >1, will use different questions at each split of the tree).
Definition at line 89 of file build-tree-questions.cc.
References kaldi::FindAllKeys(), rnnlm::i, rnnlm::j, KALDI_ASSERT, KALDI_WARN, kaldi::kAllKeysUnion, RefineClustersOptions::num_iters, kaldi::PossibleValues(), kaldi::RandInt(), QuestionsForKey::refine_opts, and kaldi::SortAndUniq().
Referenced by kaldi::GenRandContextDependency(), kaldi::GenRandContextDependencyLarge(), kaldi::TestBuildTree(), kaldi::TestClusterEventMapRestricted(), kaldi::TestQuestionsInitRand(), kaldi::TestShareEventMapLeaves(), and kaldi::TestSplitDecisionTree().
|
private |
void Read | ( | std::istream & | is, |
bool | binary | ||
) |
Definition at line 63 of file build-tree-questions.cc.
References kaldi::DeletePointers(), kaldi::ExpectToken(), KALDI_ERR, QuestionsForKey::Read(), kaldi::ReadBasicType(), and kaldi::ReadToken().
Referenced by main(), and kaldi::TestQuestionsInitRand().
|
inline |
Definition at line 89 of file build-tree-questions.h.
References QuestionsForKey::Check(), KALDI_ASSERT, and QuestionsForKey::QuestionsForKey().
Referenced by main().
void Write | ( | std::ostream & | os, |
bool | binary | ||
) | const |
Definition at line 48 of file build-tree-questions.cc.
References rnnlm::i, QuestionsForKey::Write(), kaldi::WriteBasicType(), and kaldi::WriteToken().
Referenced by kaldi::TestQuestionsInitRand().
|
private |
Definition at line 127 of file build-tree-questions.h.
|
private |
Definition at line 126 of file build-tree-questions.h.