TST: Added glm test for Python
This commit is contained in:
parent
33f1ab3ae1
commit
eb1b185d70
15
tests/python/test_models.py
Normal file
15
tests/python/test_models.py
Normal file
@ -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()
|
||||
Loading…
x
Reference in New Issue
Block a user