def _train_convert_evaluate(self, bt_params = {}, **params):
"""
Set up the unit test by loading the dataset and training a model.
"""
# Train a model
xgb_model = xgboost.train(bt_params, self.dtrain, **params)
# Convert the model
spec = xgb_converter.convert(xgb_model, self.feature_names, self.output_name, force_32bit_float = False)
# Get predictions
df = pd.DataFrame(self.X, columns=self.feature_names)
df['prediction'] = xgb_model.predict(self.dtrain)
# Evaluate it
metrics = evaluate_regressor(spec, df, target = 'target', verbose = False)
return metrics
test_boosted_trees_regression_numeric.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录