From eb1b185d700d130f8ba4aaba7ca7a6070687822d Mon Sep 17 00:00:00 2001 From: terrytangyuan Date: Tue, 8 Sep 2015 09:47:48 -0400 Subject: [PATCH] TST: Added glm test for Python --- tests/python/test_models.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/python/test_models.py diff --git a/tests/python/test_models.py b/tests/python/test_models.py new file mode 100644 index 000000000..a12198f59 --- /dev/null +++ b/tests/python/test_models.py @@ -0,0 +1,15 @@ +import numpy as np +import xgboost as xgb + +dpath = 'demo/data/' + +def test_glm(): + dtrain = xgb.DMatrix('../data/agaricus.txt.train') + dtest = xgb.DMatrix('../data/agaricus.txt.test') + param = {'silent':1, 'objective':'binary:logistic', 'booster':'gblinear', + 'alpha': 0.0001, 'lambda': 1 } + watchlist = [(dtest,'eval'), (dtrain,'train')] + num_round = 4 + bst = xgb.train(param, dtrain, num_round, watchlist) + preds = bst.predict(dtest) + labels = dtest.get_label() \ No newline at end of file