Skip to content

Commit

Permalink
extended example to use locked and unlocked x-validation
Browse files Browse the repository at this point in the history
  • Loading branch information
karlnapf committed May 22, 2012
1 parent 95f980f commit 3d93199
Showing 1 changed file with 10 additions and 1 deletion.
Expand Up @@ -128,6 +128,8 @@ int main(int argc, char **argv)
CCrossValidation* cross=new CCrossValidation(classifier, features, labels,
splitting_strategy, evaluation_criterium);
cross->set_num_runs(1);
/* note that this automatically is not necessary since done automatically */
cross->set_autolock(true);

/* print all parameter available for modelselection
* Dont worry if yours is not included, simply write to the mailing list */
Expand All @@ -144,7 +146,6 @@ int main(int argc, char **argv)
bool print_state=true;
CParameterCombination* best_combination=grid_search->select_model(
print_state);
SG_SPRINT("best parameter(s):\n");
best_combination->print_tree();

best_combination->apply_to_machine(classifier);
Expand All @@ -156,6 +157,14 @@ int main(int argc, char **argv)
SG_SPRINT("result: ");
result.print_result();

/* now again but unlocked */
SG_UNREF(best_combination);
cross->set_autolock(true);
best_combination=grid_search->select_model(print_state);
best_combination->apply_to_machine(classifier);
result=cross->evaluate();
SG_SPRINT("result (unlocked): ");

/* clean up destroy result parameter */
SG_UNREF(best_combination);
SG_UNREF(grid_search);
Expand Down

0 comments on commit 3d93199

Please sign in to comment.