Skip to main content

Interactions between Dask and XGBoost

Project description

Distributed training with XGBoost and Dask.distributed

This repository enables you to perform distributed training with XGBoost on Dask.array and Dask.dataframe collections.

pip install dask-xgboost

Example

from dask.distributed import Client
client = Client('scheduler-address:8786')  # connect to cluster

import dask.dataframe as dd
df = dd.read_csv('...')  # use dask.dataframe to load and
df_train = ...           # preprocess data
labels_train = ...

import dask_xgboost as dxgb
params = {'objective': 'binary:logistic', ...}  # use normal xgboost params
bst = dxgb.train(client, params, df_train, labels_train)

>>> bst  # Get back normal XGBoost result
<xgboost.core.Booster at ... >

predictions = dxgb.predict(client, bsg, data_test)

How this works

For more information on using Dask.dataframe for preprocessing see the Dask.dataframe documentation.

Once you have created suitable data and labels we are ready for distributed training with XGBoost. Every Dask worker sets up an XGBoost slave and gives them enough information to find each other. Then Dask workers hand their in-memory Pandas dataframes to XGBoost (one Dask dataframe is just many Pandas dataframes spread around the memory of many machines). XGBoost handles distributed training on its own without Dask interference. XGBoost then hands back a single xgboost.Booster result object.

Larger Example

For a more serious example see

History

Conversation during development happened at dmlc/xgboost #2032

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dask-xgboost-0.1.5.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

dask_xgboost-0.1.5-py2.py3-none-any.whl (11.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file dask-xgboost-0.1.5.tar.gz.

File metadata

File hashes

Hashes for dask-xgboost-0.1.5.tar.gz
Algorithm Hash digest
SHA256 1860d06965fe68def1c83b9195130a92050fd4bc28bf2be689898a3a74ee1316
MD5 4d2b7b3a217eacd92791a4386c002918
BLAKE2b-256 da3bd4cd935dae08e83ff7c8efc2cf16a5e4103e5a0cfc5eebd37ec3bbce32fd

See more details on using hashes here.

Provenance

File details

Details for the file dask_xgboost-0.1.5-py2.py3-none-any.whl.

File metadata

  • Download URL: dask_xgboost-0.1.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.7.3

File hashes

Hashes for dask_xgboost-0.1.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bea11a461790d4153918486c53bc020a3aeacfc7c9ed920a3ea563bf5775ffd7
MD5 8f9317d8f2994102deb41a5c810e2606
BLAKE2b-256 cae22aca20f6d99cafb6e614b73ff685eedf91cbebf3e557806f78a1188a1e28

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page