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

4
Contributors: https://github.com/microsoft/LightGBM/graphs/contributors.
wxchan's avatar
wxchan committed
5
6
7
"""
from __future__ import absolute_import

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

Guolin Ke's avatar
Guolin Ke committed
13
import os
14
15
import sys
import warnings
16

wxchan's avatar
wxchan committed
17
18
19
20
try:
    from .sklearn import LGBMModel, LGBMRegressor, LGBMClassifier, LGBMRanker
except ImportError:
    pass
21
try:
22
23
    from .plotting import (plot_importance, plot_split_value_histogram, plot_metric,
                           plot_tree, create_tree_digraph)
24
25
except ImportError:
    pass
wxchan's avatar
wxchan committed
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')):
31
32
    with open(os.path.join(dir_path, 'VERSION.txt')) as version_file:
        __version__ = version_file.read().strip()
wxchan's avatar
wxchan committed
33

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

# REMOVEME: remove warning after 3.1.0 version release
if sys.version_info[0] == 2:
    warnings.warn("LightGBM 3.1 version is the last version that supports Python 2.\n"
                  "Next release will drop the support.", UserWarning)