MCPcopy Create free account
hub / github.com/dmlc/xgboost / VerifyPredictionWithLesserFeatures

Function VerifyPredictionWithLesserFeatures

tests/cpp/predictor/test_predictor.cc:294–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294void VerifyPredictionWithLesserFeatures(Learner *learner, bst_idx_t kRows,
295 std::shared_ptr<DMatrix> m_test,
296 std::shared_ptr<DMatrix> m_invalid) {
297 HostDeviceVector<float> prediction;
298 Json config{Object()};
299 learner->SaveConfig(&config);
300
301 learner->Predict(m_test, false, &prediction, 0, 0);
302 ASSERT_EQ(prediction.Size(), kRows);
303
304 ASSERT_THROW({ learner->Predict(m_invalid, false, &prediction, 0, 0); }, dmlc::Error);
305}
306
307} // anonymous namespace
308

Calls 3

PredictMethod · 0.80
SaveConfigMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected