M
M
Mark Adams2016-10-13 02:08:21
Python
Mark Adams, 2016-10-13 02:08:21

How to implement logistic regression in xgboost (Python)?

There is a tutorial :

import xgboost as xgb
# read in data
dtrain = xgb.DMatrix('demo/data/agaricus.txt.train')
dtest = xgb.DMatrix('demo/data/agaricus.txt.test')
# specify parameters via map
param = {'max_depth':2, 'eta':1, 'silent':1, 'objective':'binary:logistic' }
num_round = 2
bst = xgb.train(param, dtrain, num_round)
# make prediction
preds = bst.predict(dtest)

But it is not clear what the agaricus.txt format is. How to implement logregression in xgboost? An example, if not difficult.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vlad_Fedorenko, 2016-10-14
@Vlad_Fedorenko

xgboost.readthedocs.io/en/latest/python/python_api.html
Create DMatrix from ndarray)
Well, xgboost is not a logistic regression)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question