I have installed lightGBM as described here on Linux:
https://github.com/Microsoft/LightGBM/wiki/Installation-Guide#linux-2
I am able to successfully run the GPU training (and CPU) using the CLI: https://github.com/Microsoft/LightGBM/blob/master/docs/GPU-Tutorial.md#run-your-first-learning-task-on-gpu
However, when i try to import the python package (python 3.6) I receive the following error:
OSError: /home/anaconda3/lib/python3.6/site-packages/lightgbm-0.2-py3.6.egg/lightgbm/lib_lightgbm.so: symbol clCreateCommandQueueWithProperties, version OPENCL_2.0 not defined in file libOpenCL.so.1 with link time reference
I am pretty new to understanding linking and other things that may be the problem. Anyone able to provide some easy to follow suggestions?
Coding an LGBM in Python The LGBM model can be installed by using the Python pip function and the command is “pip install lightbgm” LGBM also has a custom API support in it and using it we can implement both Classifier and regression algorithms where both the models operate in a similar fashion.
LightGBM now comes with a python API.
import numpy as np
from lightgbm import LGBMClassifier
from sklearn.datasets import make_moons
model = LGBMClassifier(boosting_type='goss', num_leaves=31, max_depth=- 1, learning_rate=0.1, n_estimators=300, device = "gpu")
train, label = make_moons(n_samples=300000, shuffle=True, noise=0.3, random_state=None)
model.fit(train, label)
If you managed to build it for the GPU, you are probably a couple of steps away from setting up the python interface.
Assuming the built was successful and the repertory looks like this:
~/Codes/LightGBM$ tree -d -L 1
.
├── build
├── compute
├── docker
├── docs
├── examples
├── helpers
├── include
├── pmml
├── python-package
├── R-package
├── src
├── swig
├── tests
└── windows
Simply use the following commands to set up the python API.
cd python-package/
sudo python setup.py install --precompile
Source detailed guide to install LightGBM with GPU support
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With