Exemplo n.º 1
0
 def test_groupby1(self):
     df = load_iris()
     train_out = xgb_regression_train(
         df,
         feature_cols=['sepal_length', 'sepal_width', 'petal_length'],
         label_col='petal_width',
         group_by=['species'])
     predict_out = xgb_regression_predict(df, train_out['model'])
Exemplo n.º 2
0
 def test(self):
     xgb_train = xgb_regression_train(
         self.testdata,
         feature_cols=['sepal_length', 'sepal_width', 'petal_length'],
         label_col='petal_width')['model']
     np.testing.assert_array_almost_equal(
         xgb_train['feature_importance'],
         [0.2591911852359772, 0.2077205926179886, 0.533088207244873], 10)
     predict = xgb_regression_predict(self.testdata,
                                      xgb_train)['out_table']['prediction']
     np.testing.assert_array_almost_equal(predict[:5], [
         0.2634012401, 0.1740619838, 0.1951409280, 0.1879036427,
         0.2634012401
     ], 10)
Exemplo n.º 3
0
 def groupby1(self):
     df = get_iris()
     train_out = xgb_regression_train(df, feature_cols=['sepal_length', 'sepal_width', 'petal_length'], label_col='petal_width', group_by=['species'])
     predict_out = xgb_regression_predict(df, train_out['model'])
     print(predict_out['out_table'][['petal_width', 'prediction']])