__init__.py 1.8 KB
Newer Older
wxchan's avatar
wxchan committed
1
2
3
4
5
6
7
# coding: utf-8
"""LightGBM, Light Gradient Boosting Machine.

Contributors: https://github.com/Microsoft/LightGBM/graphs/contributors
"""
from __future__ import absolute_import

8
from .basic import Booster, Dataset
9
10
11
from .callback import (early_stopping, print_evaluation, record_evaluation,
                       reset_parameter)
from .engine import cv, train
12

Guolin Ke's avatar
Guolin Ke committed
13
import os
14
15
import warnings
from platform import system
16

wxchan's avatar
wxchan committed
17
18
19
20
try:
    from .sklearn import LGBMModel, LGBMRegressor, LGBMClassifier, LGBMRanker
except ImportError:
    pass
21
try:
22
    from .plotting import plot_importance, plot_metric, plot_tree, create_tree_digraph
23
24
except ImportError:
    pass
wxchan's avatar
wxchan committed
25
26


27
28
29
30
dir_path = os.path.dirname(os.path.realpath(__file__))

if os.path.isfile(os.path.join(dir_path, 'VERSION.txt')):
    __version__ = open(os.path.join(dir_path, 'VERSION.txt')).read().strip()
wxchan's avatar
wxchan committed
31

32
__all__ = ['Dataset', 'Booster',
wxchan's avatar
wxchan committed
33
           'train', 'cv',
34
           'LGBMModel', 'LGBMRegressor', 'LGBMClassifier', 'LGBMRanker',
35
           'print_evaluation', 'record_evaluation', 'reset_parameter', 'early_stopping',
36
           'plot_importance', 'plot_metric', 'plot_tree', 'create_tree_digraph']
37
38
39
40
41
42
43
44
45

if system() == 'Darwin':
    warnings.warn("Starting from version 2.1.4, the library file in distribution wheels for macOS "
                  "will be built by the Apple Clang compiler.\n"
                  "This means that in case of installing LightGBM from PyPI via the ``pip install lightgbm`` command, "
                  "you won't need to install the gcc compiler anymore.\n"
                  "Instead of that, you'll need to install the OpenMP library, "
                  "which is required for running LightGBM on the system with the Apple Clang compiler.\n"
                  "You can install the OpenMP library by the following command: ``brew install libomp``.", FutureWarning)