本文整理汇总了C++中Corpus::getSamples方法的典型用法代码示例。如果您正苦于以下问题:C++ Corpus::getSamples方法的具体用法?C++ Corpus::getSamples怎么用?C++ Corpus::getSamples使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Corpus
的用法示例。
在下文中一共展示了Corpus::getSamples方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: validate
void dtw_model::validate(Corpus& corpus) {
static const size_t MINIATURE_SIZE = 10000;
static vector<tsample> samples = corpus.getSamples(MINIATURE_SIZE);
static double objective = 0;
static bool aboutToStop = false;
static const double SOFT_THRESHOLD = 2e-6 * _learning_rate;
static const double HARD_THRESHOLD = SOFT_THRESHOLD * 0.1;
static size_t MIN_ITERATION = 128;
static size_t itr = 0;
double obj = calcObjective(samples);
double diff = obj - objective;
double improveRate = abs(diff / objective);
printf("objective = %.7f \t prev-objective = %.7f \n", obj, objective);
printf("improvement rate on dev-set of size %lu = %.6e ", samples.size(), improveRate);
printf(", still "GREEN"%.0f"COLOREND" times of threshold \n", improveRate / SOFT_THRESHOLD);
if (itr > MIN_ITERATION) {
if (improveRate != improveRate)
exit(-1);
if (improveRate < HARD_THRESHOLD) {
printf("\nObjective function on dev-set is no longer decreasing...\n");
printf("Training process "GREEN"DONE"COLOREND"\n");
// doPause();
exit(0);
}
else if (aboutToStop || improveRate < SOFT_THRESHOLD) {
aboutToStop = true;
_learning_rate /= 2;
}
}
objective = obj;
++itr;
}