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

Method NumPredictOneRow

src/boosting/gbdt.h:213–226  ·  view source on GitHub ↗

! * \brief Get number of prediction for one data * \param num_iteration number of used iterations * \param is_pred_leaf True if predicting leaf index * \param is_pred_contrib True if predicting feature contribution * \return number of prediction */

Source from the content-addressed store, hash-verified

211 * \return number of prediction
212 */
213 inline int NumPredictOneRow(int num_iteration, bool is_pred_leaf, bool is_pred_contrib) const override {
214 int num_preb_in_one_row = num_class_ * num_labels_;
215 if (is_pred_leaf) {
216 int max_iteration = GetCurrentIteration();
217 if (num_iteration > 0) {
218 num_preb_in_one_row *= static_cast<int>(std::min(max_iteration, num_iteration));
219 } else {
220 num_preb_in_one_row *= max_iteration;
221 }
222 } else if (is_pred_contrib) {
223 num_preb_in_one_row = num_tree_per_iteration_ * (max_feature_idx_ + 2); // +1 for 0-based indexing, +1 for baseline
224 }
225 return num_preb_in_one_row;
226 }
227
228 void PredictRaw(const double* features, double* output,
229 const PredictionEarlyStopInstance* earlyStop) const override;

Callers 5

SingleRowPredictorMethod · 0.45
PredictMethod · 0.45
EvalMethod · 0.45
PredictorMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected