Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ RUN apt-get install -y libfreetype6-dev && \
pip install wordcloud && \
pip install xgboost && \
# Pinned to match GPU version. Update version together.
pip install lightgbm==2.3.1 && \
pip install lightgbm==3.1.1 && \
pip install keras && \
pip install keras-tuner && \
pip install flake8 && \
Expand Down
2 changes: 1 addition & 1 deletion gpu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ RUN pip uninstall -y lightgbm && \
cd /usr/local/src && \
git clone --recursive https://github.com/microsoft/LightGBM && \
cd LightGBM && \
git checkout tags/v2.3.1 && \
git checkout tags/v3.1.1 && \
mkdir build && cd build && \
cmake -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda/include/ .. && \
make -j$(nproc) && \
Expand Down
Binary file removed tests/data/lgb_test.bin
Binary file not shown.
100 changes: 100 additions & 0 deletions tests/data/lgb_test.csv

Large diffs are not rendered by default.

Binary file removed tests/data/lgb_train.bin
Binary file not shown.
100 changes: 100 additions & 0 deletions tests/data/lgb_train.csv

Large diffs are not rendered by default.

23 changes: 18 additions & 5 deletions tests/test_lightgbm.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import unittest

import lightgbm as lgb
import pandas as pd

from common import gpu_test

class TestLightgbm(unittest.TestCase):
# Based on the "simple_example" from their documentation:
# https://github.com/Microsoft/LightGBM/blob/master/examples/python-guide/simple_example.py
def test_cpu(self):
lgb_train = lgb.Dataset('/input/tests/data/lgb_train.bin')
lgb_eval = lgb.Dataset('/input/tests/data/lgb_test.bin', reference=lgb_train)
lgb_train, lgb_eval = self.load_datasets()

params = {
'task': 'train',
Expand All @@ -35,9 +35,8 @@ def test_cpu(self):

@gpu_test
def test_gpu(self):
lgb_train = lgb.Dataset('/input/tests/data/lgb_train.bin')
lgb_eval = lgb.Dataset('/input/tests/data/lgb_test.bin', reference=lgb_train)

lgb_train, lgb_eval = self.load_datasets()

params = {
'boosting_type': 'gbdt',
'objective': 'regression',
Expand All @@ -59,3 +58,17 @@ def test_gpu(self):
early_stopping_rounds=1)

self.assertEqual(1, gbm.best_iteration)

def load_datasets(self):
df_train = pd.read_csv('/input/tests/data/lgb_train.csv', header=None, sep='\t')
df_test = pd.read_csv('/input/tests/data/lgb_test.csv', header=None, sep='\t')

y_train = df_train[0]
y_test = df_test[0]
X_train = df_train.drop(0, axis=1)
X_test = df_test.drop(0, axis=1)

lgb_train = lgb.Dataset(X_train, y_train)
lgb_eval = lgb.Dataset(X_test, y_test, reference=lgb_train)

return (lgb_train, lgb_eval)