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

Method SingleRowPredictor

src/c_api.cpp:57–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55 int64_t num_pred_in_one_row;
56
57 SingleRowPredictor(int predict_type, Boosting* boosting, const Config& config, int iter) {
58 bool is_predict_leaf = false;
59 bool is_raw_score = false;
60 bool predict_contrib = false;
61 if (predict_type == C_API_PREDICT_LEAF_INDEX) {
62 is_predict_leaf = true;
63 } else if (predict_type == C_API_PREDICT_RAW_SCORE) {
64 is_raw_score = true;
65 } else if (predict_type == C_API_PREDICT_CONTRIB) {
66 predict_contrib = true;
67 } else {
68 is_raw_score = false;
69 }
70 early_stop_ = config.pred_early_stop;
71 early_stop_freq_ = config.pred_early_stop_freq;
72 early_stop_margin_ = config.pred_early_stop_margin;
73 iter_ = iter;
74 predictor_.reset(new Predictor(boosting, iter_, is_raw_score, is_predict_leaf, predict_contrib,
75 early_stop_, early_stop_freq_, early_stop_margin_));
76 num_pred_in_one_row = boosting->NumPredictOneRow(iter_, is_predict_leaf, predict_contrib);
77 predict_function = predictor_->GetPredictFunction();
78 num_total_model_ = boosting->NumberOfTotalModel();
79 }
80 ~SingleRowPredictor() {}
81 bool IsPredictorEqual(const Config& config, int iter, Boosting* boosting) {
82 return early_stop_ != config.pred_early_stop ||

Callers

nothing calls this directly

Calls 3

resetMethod · 0.80
NumPredictOneRowMethod · 0.45
NumberOfTotalModelMethod · 0.45

Tested by

no test coverage detected