MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / CreateBinary

Function CreateBinary

src/boosting/prediction_early_stop.cpp:54–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54PredictionEarlyStopInstance CreateBinary(const PredictionEarlyStopConfig& config) {
55 // margin_threshold will be captured by value
56 const double margin_threshold = config.margin_threshold;
57
58 return PredictionEarlyStopInstance{
59 [margin_threshold](const double* pred, int sz) {
60 if (sz != 1) {
61 Log::Fatal("Binary early stopping needs predictions to be of length one");
62 }
63 const auto margin = 2.0 * fabs(pred[0]);
64
65 if (margin > margin_threshold) {
66 return true;
67 }
68
69 return false;
70 },
71 config.round_period
72 };
73}
74
75PredictionEarlyStopInstance CreatePredictionEarlyStopInstance(const std::string& type,
76 const PredictionEarlyStopConfig& config) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected