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 |
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 106 of file build-tree-questions.h.
References kaldi::DeletePointers(), and Questions::key_options_.
|
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 111 of file build-tree-questions.h.
|
inline |
Definition at line 101 of file build-tree-questions.h.
References kaldi::CopyMapKeysToVector(), KALDI_ASSERT, and Questions::key_idx_.
Referenced by DecisionTreeSplitter::FindBestSplit(), kaldi::TestBuildTree(), and Questions::Write().
|
inline |
Definition at line 79 of file build-tree-questions.h.
References KALDI_ASSERT, KALDI_ERR, Questions::key_idx_, and Questions::key_options_.
Referenced by kaldi::ComputeInitialSplit(), kaldi::FindBestSplitForKey(), kaldi::TestBuildTree(), kaldi::TestQuestionsInitRand(), kaldi::TestSplitDecisionTree(), and Questions::Write().
|
inline |
Definition at line 105 of file build-tree-questions.h.
References Questions::key_idx_.
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, Questions::SetQuestionsOf(), 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, Questions::key_idx_, Questions::key_options_, QuestionsForKey::Read(), kaldi::ReadBasicType(), kaldi::ReadToken(), and Questions::SetQuestionsOf().
Referenced by main(), and kaldi::TestQuestionsInitRand().
|
inline |
Definition at line 89 of file build-tree-questions.h.
References QuestionsForKey::Check(), KALDI_ASSERT, Questions::key_idx_, and Questions::key_options_.
Referenced by Questions::InitRand(), main(), and Questions::Read().
void Write | ( | std::ostream & | os, |
bool | binary | ||
) | const |
Definition at line 48 of file build-tree-questions.cc.
References Questions::GetKeysWithQuestions(), Questions::GetQuestionsOf(), rnnlm::i, QuestionsForKey::Write(), kaldi::WriteBasicType(), and kaldi::WriteToken().
Referenced by kaldi::TestQuestionsInitRand().
|
private |
Definition at line 125 of file build-tree-questions.h.
Referenced by Questions::GetKeysWithQuestions(), Questions::GetQuestionsOf(), Questions::HasQuestionsForKey(), Questions::Read(), and Questions::SetQuestionsOf().
|
private |
Definition at line 124 of file build-tree-questions.h.
Referenced by Questions::GetQuestionsOf(), Questions::Read(), Questions::SetQuestionsOf(), and Questions::~Questions().