Commit d94ec89b authored by Nikita Titov's avatar Nikita Titov Committed by Guolin Ke
Browse files

[docs] fixed building at Python 2.x (#997)

* fixed docs building at Python 2.x

* updated docs building guide

* get back Python 3 at Travis

* test commit for OSX

* be more precise with python version inpylint task

* turned warnings into errors

* removed linkchecker validation from osx

* removed warning about not included into any toctree

* docs config cleanup

* refined deprecation warnings mechanism

* refine docs mock mechanism

* be more precise with python version in check-docs task

* redused the number of code lines

* refined venv deployment

* rollback python version in check-docs task

* revert 'refine docs mock mechanism'. autodoc_mock_imports seems to be not working

* added targets for big images

* rollback to default python version in check-docs task

* break long lines for mobile view

* replaced pip with conda where it's possible
parent d4bec4f2
...@@ -14,20 +14,25 @@ if [[ ${TASK} == "gpu" ]]; then ...@@ -14,20 +14,25 @@ if [[ ${TASK} == "gpu" ]]; then
export CPLUS_INCLUDE_PATH="$HOME/miniconda/envs/test-env/include:$AMDAPPSDK/include/:$CPLUS_INCLUDE_PATH" export CPLUS_INCLUDE_PATH="$HOME/miniconda/envs/test-env/include:$AMDAPPSDK/include/:$CPLUS_INCLUDE_PATH"
fi fi
case ${TRAVIS_OS_NAME} in if [[ $TRAVIS_OS_NAME == "osx" ]]; then
osx)
export CXX=g++-7 export CXX=g++-7
export CC=gcc-7 export CC=gcc-7
;; fi
linux)
;; conda create -q -n test-env python=$PYTHON_VERSION
esac source activate test-env
cd $TRAVIS_BUILD_DIR cd $TRAVIS_BUILD_DIR
if [[ ${TASK} == "check-docs" ]]; then if [[ ${TASK} == "check-docs" ]]; then
if [[ $TRAVIS_OS_NAME != "osx" ]]; then
sudo apt-get install linkchecker sudo apt-get install linkchecker
pip install rstcheck sphinx sphinx_rtd_theme # html5validator fi
if [[ ${PYTHON_VERSION} == "2.7" ]]; then
conda install mock
fi
conda install sphinx sphinx_rtd_theme # html5validator
pip install rstcheck
cd python-package cd python-package
rstcheck --report warning `find . -type f -name "*.rst"` || exit -1 rstcheck --report warning `find . -type f -name "*.rst"` || exit -1
cd ../docs cd ../docs
...@@ -36,19 +41,20 @@ if [[ ${TASK} == "check-docs" ]]; then ...@@ -36,19 +41,20 @@ if [[ ${TASK} == "check-docs" ]]; then
find ./_build/html/ -type f -name '*.html' -exec \ find ./_build/html/ -type f -name '*.html' -exec \
sed -i -e 's;\(\.\/[^.]*\.\)rst\([^[:space:]]*\);\1html\2;g' {} \; # Emulate js function sed -i -e 's;\(\.\/[^.]*\.\)rst\([^[:space:]]*\);\1html\2;g' {} \; # Emulate js function
# html5validator --root ./_build/html/ || exit -1 # html5validator --root ./_build/html/ || exit -1
if [[ $TRAVIS_OS_NAME != "osx" ]]; then
linkchecker --config=.linkcheckerrc ./_build/html/*.html || exit -1 linkchecker --config=.linkcheckerrc ./_build/html/*.html || exit -1
fi
exit 0 exit 0
fi fi
if [[ ${TASK} == "pylint" ]]; then if [[ ${TASK} == "pylint" ]]; then
pip install pep8 conda install pep8
pep8 --ignore=E501 --exclude=./compute,./docs . || exit -1 pep8 --ignore=E501 --exclude=./compute,./docs . || exit -1
exit 0 exit 0
fi fi
if [[ ${TASK} == "if-else" ]]; then if [[ ${TASK} == "if-else" ]]; then
conda create -q -n test-env python=$PYTHON_VERSION numpy conda install numpy
source activate test-env
mkdir build && cd build && cmake .. && make lightgbm || exit -1 mkdir build && cd build && cmake .. && make lightgbm || exit -1
cd $TRAVIS_BUILD_DIR/tests/cpp_test && ../../lightgbm config=train.conf convert_model_language=cpp convert_model=../../src/boosting/gbdt_prediction.cpp && ../../lightgbm config=predict.conf output_result=origin.pred || exit -1 cd $TRAVIS_BUILD_DIR/tests/cpp_test && ../../lightgbm config=train.conf convert_model_language=cpp convert_model=../../src/boosting/gbdt_prediction.cpp && ../../lightgbm config=predict.conf output_result=origin.pred || exit -1
cd $TRAVIS_BUILD_DIR/build && make lightgbm || exit -1 cd $TRAVIS_BUILD_DIR/build && make lightgbm || exit -1
...@@ -57,7 +63,7 @@ if [[ ${TASK} == "if-else" ]]; then ...@@ -57,7 +63,7 @@ if [[ ${TASK} == "if-else" ]]; then
fi fi
if [[ ${TASK} == "proto" ]]; then if [[ ${TASK} == "proto" ]]; then
conda create -q -n test-env python=$PYTHON_VERSION numpy conda install numpy
source activate test-env source activate test-env
mkdir build && cd build && cmake .. && make lightgbm || exit -1 mkdir build && cd build && cmake .. && make lightgbm || exit -1
cd $TRAVIS_BUILD_DIR/tests/cpp_test && ../../lightgbm config=train.conf && ../../lightgbm config=predict.conf output_result=origin.pred || exit -1 cd $TRAVIS_BUILD_DIR/tests/cpp_test && ../../lightgbm config=train.conf && ../../lightgbm config=predict.conf output_result=origin.pred || exit -1
...@@ -68,8 +74,7 @@ if [[ ${TASK} == "proto" ]]; then ...@@ -68,8 +74,7 @@ if [[ ${TASK} == "proto" ]]; then
exit 0 exit 0
fi fi
conda create -q -n test-env python=$PYTHON_VERSION numpy nose scipy scikit-learn pandas matplotlib pytest conda install numpy nose scipy scikit-learn pandas matplotlib pytest
source activate test-env
if [[ ${TASK} == "sdist" ]]; then if [[ ${TASK} == "sdist" ]]; then
LGB_VER=$(head -n 1 VERSION.txt) LGB_VER=$(head -n 1 VERSION.txt)
......
...@@ -163,6 +163,7 @@ We record the wall clock time after 500 iterations, as shown in the figure below ...@@ -163,6 +163,7 @@ We record the wall clock time after 500 iterations, as shown in the figure below
.. image:: ./_static/images/gpu-performance-comparison.png .. image:: ./_static/images/gpu-performance-comparison.png
:align: center :align: center
:target: ./_static/images/gpu-performance-comparison.png
When using a GPU, it is advisable to use a bin size of 63 rather than 255, because it can speed up training significantly without noticeably affecting accuracy. When using a GPU, it is advisable to use a bin size of 63 rather than 255, because it can speed up training significantly without noticeably affecting accuracy.
On CPU, using a smaller bin size only marginally improves performance, sometimes even slows down training, On CPU, using a smaller bin size only marginally improves performance, sometimes even slows down training,
......
GPU SDK Correspondence and Device Targeting Table
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GPU Targets Table GPU Targets Table
================= =================
......
...@@ -45,16 +45,19 @@ To modify PATH, just follow the pictures after going to the ``Control Panel``: ...@@ -45,16 +45,19 @@ To modify PATH, just follow the pictures after going to the ``Control Panel``:
.. image:: ./_static/images/screenshot-system.png .. image:: ./_static/images/screenshot-system.png
:align: center :align: center
:target: ./_static/images/screenshot-system.png
Then, go to ``Advanced`` > ``Environment Variables...``: Then, go to ``Advanced`` > ``Environment Variables...``:
.. image:: ./_static/images/screenshot-advanced-system-settings.png .. image:: ./_static/images/screenshot-advanced-system-settings.png
:align: center :align: center
:target: ./_static/images/screenshot-advanced-system-settings.png
Under ``System variables``, the variable ``Path``: Under ``System variables``, the variable ``Path``:
.. image:: ./_static/images/screenshot-environment-variables.png .. image:: ./_static/images/screenshot-environment-variables.png
:align: center :align: center
:target: ./_static/images/screenshot-environment-variables.png
-------------- --------------
...@@ -99,6 +102,7 @@ You may choose a version other than the most recent one if you need a previous M ...@@ -99,6 +102,7 @@ You may choose a version other than the most recent one if you need a previous M
.. image:: ./_static/images/screenshot-mingw-installation.png .. image:: ./_static/images/screenshot-mingw-installation.png
:align: center :align: center
:target: ./_static/images/screenshot-mingw-installation.png
Then, add to your PATH the following (to adjust to your MinGW version): Then, add to your PATH the following (to adjust to your MinGW version):
...@@ -116,6 +120,7 @@ You can check which MinGW version you are using by running the following in a co ...@@ -116,6 +120,7 @@ You can check which MinGW version you are using by running the following in a co
.. image:: ./_static/images/screenshot-r-mingw-used.png .. image:: ./_static/images/screenshot-r-mingw-used.png
:align: center :align: center
:target: ./_static/images/screenshot-r-mingw-used.png
To check whether you need 32-bit or 64-bit MinGW for R, install LightGBM as usual and check for the following: To check whether you need 32-bit or 64-bit MinGW for R, install LightGBM as usual and check for the following:
...@@ -211,6 +216,7 @@ This is what you should (approximately) get at the end of Boost compilation: ...@@ -211,6 +216,7 @@ This is what you should (approximately) get at the end of Boost compilation:
.. image:: ./_static/images/screenshot-boost-compiled.png .. image:: ./_static/images/screenshot-boost-compiled.png
:align: center :align: center
:target: ./_static/images/screenshot-boost-compiled.png
If you are getting an error: If you are getting an error:
...@@ -233,6 +239,7 @@ Installing Git for Windows is straightforward, use the following `link`_. ...@@ -233,6 +239,7 @@ Installing Git for Windows is straightforward, use the following `link`_.
.. image:: ./_static/images/screenshot-git-for-windows.png .. image:: ./_static/images/screenshot-git-for-windows.png
:align: center :align: center
:target: ./_static/images/screenshot-git-for-windows.png
Then, click on the big Download button, you can't miss it. Then, click on the big Download button, you can't miss it.
...@@ -261,6 +268,7 @@ Installing CMake requires one download first and then a lot of configuration for ...@@ -261,6 +268,7 @@ Installing CMake requires one download first and then a lot of configuration for
.. image:: ./_static/images/screenshot-downloading-cmake.png .. image:: ./_static/images/screenshot-downloading-cmake.png
:align: center :align: center
:target: ./_static/images/screenshot-downloading-cmake.png
- Download `CMake`_ 3.8.0 - Download `CMake`_ 3.8.0
...@@ -278,14 +286,17 @@ Installing CMake requires one download first and then a lot of configuration for ...@@ -278,14 +286,17 @@ Installing CMake requires one download first and then a lot of configuration for
.. image:: ./_static/images/screenshot-create-directory.png .. image:: ./_static/images/screenshot-create-directory.png
:align: center :align: center
:target: ./_static/images/screenshot-create-directory.png
.. image:: ./_static/images/screenshot-mingw-makefiles-to-use.png .. image:: ./_static/images/screenshot-mingw-makefiles-to-use.png
:align: center :align: center
:target: ./_static/images/screenshot-mingw-makefiles-to-use.png
- Lookup for ``USE_GPU`` and check the checkbox - Lookup for ``USE_GPU`` and check the checkbox
.. image:: ./_static/images/screenshot-use-gpu.png .. image:: ./_static/images/screenshot-use-gpu.png
:align: center :align: center
:target: ./_static/images/screenshot-use-gpu.png
- Click ``Configure`` - Click ``Configure``
...@@ -293,6 +304,7 @@ Installing CMake requires one download first and then a lot of configuration for ...@@ -293,6 +304,7 @@ Installing CMake requires one download first and then a lot of configuration for
.. image:: ./_static/images/screenshot-configured-lightgbm.png .. image:: ./_static/images/screenshot-configured-lightgbm.png
:align: center :align: center
:target: ./_static/images/screenshot-configured-lightgbm.png
:: ::
...@@ -352,6 +364,7 @@ You can do everything in the Git Bash console you left open: ...@@ -352,6 +364,7 @@ You can do everything in the Git Bash console you left open:
.. image:: ./_static/images/screenshot-lightgbm-with-gpu-support-compiled.png .. image:: ./_static/images/screenshot-lightgbm-with-gpu-support-compiled.png
:align: center :align: center
:target: ./_static/images/screenshot-lightgbm-with-gpu-support-compiled.png
If everything was done correctly, you now compiled CLI LightGBM with GPU support! If everything was done correctly, you now compiled CLI LightGBM with GPU support!
...@@ -367,6 +380,7 @@ You can now test LightGBM directly in CLI in a **command prompt** (not Git Bash) ...@@ -367,6 +380,7 @@ You can now test LightGBM directly in CLI in a **command prompt** (not Git Bash)
.. image:: ./_static/images/screenshot-lightgbm-in-cli-with-gpu.png .. image:: ./_static/images/screenshot-lightgbm-in-cli-with-gpu.png
:align: center :align: center
:target: ./_static/images/screenshot-lightgbm-in-cli-with-gpu.png
Congratulations for reaching this stage! Congratulations for reaching this stage!
...@@ -381,6 +395,7 @@ Now that you compiled LightGBM, you try it... and you always see a segmentation ...@@ -381,6 +395,7 @@ Now that you compiled LightGBM, you try it... and you always see a segmentation
.. image:: ./_static/images/screenshot-segmentation-fault.png .. image:: ./_static/images/screenshot-segmentation-fault.png
:align: center :align: center
:target: ./_static/images/screenshot-segmentation-fault.png
Please check you are using the right device and whether it works with the default ``gpu_device_id = 0`` and ``gpu_platform_id = 0``. Please check you are using the right device and whether it works with the default ``gpu_device_id = 0`` and ``gpu_platform_id = 0``.
If it still does not work with the default values, then you should follow all the steps below. If it still does not work with the default values, then you should follow all the steps below.
...@@ -393,17 +408,20 @@ You will have to redo the compilation steps for LightGBM to add debugging mode. ...@@ -393,17 +408,20 @@ You will have to redo the compilation steps for LightGBM to add debugging mode.
.. image:: ./_static/images/screenshot-files-to-remove.png .. image:: ./_static/images/screenshot-files-to-remove.png
:align: center :align: center
:target: ./_static/images/screenshot-files-to-remove.png
Once you removed the file, go into CMake, and follow the usual steps. Once you removed the file, go into CMake, and follow the usual steps.
Before clicking "Generate", click on "Add Entry": Before clicking "Generate", click on "Add Entry":
.. image:: ./_static/images/screenshot-added-manual-entry-in-cmake.png .. image:: ./_static/images/screenshot-added-manual-entry-in-cmake.png
:align: center :align: center
:target: ./_static/images/screenshot-added-manual-entry-in-cmake.png
In addition, click on Configure and Generate: In addition, click on Configure and Generate:
.. image:: ./_static/images/screenshot-configured-and-generated-cmake.png .. image:: ./_static/images/screenshot-configured-and-generated-cmake.png
:align: center :align: center
:target: ./_static/images/screenshot-configured-and-generated-cmake.png
And then, follow the regular LightGBM CLI installation from there. And then, follow the regular LightGBM CLI installation from there.
...@@ -416,6 +434,7 @@ open a command prompt and run the following: ...@@ -416,6 +434,7 @@ open a command prompt and run the following:
.. image:: ./_static/images/screenshot-debug-run.png .. image:: ./_static/images/screenshot-debug-run.png
:align: center :align: center
:target: ./_static/images/screenshot-debug-run.png
Type ``run`` and press the Enter key. Type ``run`` and press the Enter key.
......
...@@ -22,9 +22,9 @@ With GUI ...@@ -22,9 +22,9 @@ With GUI
3. Go to ``LightGBM-master/windows`` folder. 3. Go to ``LightGBM-master/windows`` folder.
4. Open ``LightGBM.sln`` file with Visual Studio, choose ``Release`` configuration and click ``BUILD-> Build Solution (Ctrl+Shift+B)``. 4. Open ``LightGBM.sln`` file with Visual Studio, choose ``Release`` configuration and click ``BUILD``->\ ``Build Solution (Ctrl+Shift+B)``.
If you have errors about **Platform Toolset**, go to ``PROJECT-> Properties-> Configuration Properties-> General`` and select the toolset installed on your machine. If you have errors about **Platform Toolset**, go to ``PROJECT``->\ ``Properties``->\ ``Configuration Properties``->\ ``General`` and select the toolset installed on your machine.
The exe file will be in ``LightGBM-master/windows/x64/Release`` folder. The exe file will be in ``LightGBM-master/windows/x64/Release`` folder.
...@@ -135,9 +135,9 @@ With GUI ...@@ -135,9 +135,9 @@ With GUI
4. Go to ``LightGBM-master/windows`` folder. 4. Go to ``LightGBM-master/windows`` folder.
5. Open ``LightGBM.sln`` file with Visual Studio, choose ``Release_mpi`` configuration and click ``BUILD-> Build Solution (Ctrl+Shift+B)``. 5. Open ``LightGBM.sln`` file with Visual Studio, choose ``Release_mpi`` configuration and click ``BUILD``->\ ``Build Solution (Ctrl+Shift+B)``.
If you have errors about **Platform Toolset**, go to ``PROJECT-> Properties-> Configuration Properties-> General`` and select the toolset installed on your machine. If you have errors about **Platform Toolset**, go to ``PROJECT``->\ ``Properties``->\ ``Configuration Properties``->\ ``General`` and select the toolset installed on your machine.
The exe file will be in ``LightGBM-master/windows/x64/Release_mpi`` folder. The exe file will be in ``LightGBM-master/windows/x64/Release_mpi`` folder.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# You can set these variables from the command line. # You can set these variables from the command line.
SPHINXOPTS = SPHINXOPTS = -W
SPHINXBUILD = sphinx-build SPHINXBUILD = sphinx-build
SPHINXPROJ = LightGBM SPHINXPROJ = LightGBM
SOURCEDIR = . SOURCEDIR = .
......
...@@ -8,9 +8,19 @@ After each commit on ``master``, documentation is updated and published to `Read ...@@ -8,9 +8,19 @@ After each commit on ``master``, documentation is updated and published to `Read
Build Build
----- -----
You can build the documentation locally. Just run in ``docs`` folder: You can build the documentation locally. Just run in ``docs`` folder
for Python 3.x:
.. code:: sh .. code:: sh
pip install sphinx sphinx_rtd_theme pip install sphinx sphinx_rtd_theme
make html make html
for Python 2.x:
.. code:: sh
pip install mock sphinx sphinx_rtd_theme
make html
$(function() { $(function() {
$('a[href^="./"][href*=".rst"]').attr('href', (i, val) => { return val.replace('.rst', '.html'); }); /* Replace '.rst' with '.html' in all internal links like './[Something].rst[#anchor]' */ $('a[href^="./"][href*=".rst"]').attr('href', (i, val) => { return val.replace('.rst', '.html'); }); /* Replace '.rst' with '.html' in all internal links like './[Something].rst[#anchor]' */
$('.wy-nav-content').each(function () { this.style.setProperty('max-width', 'none', 'important'); }); $('.wy-nav-content').each(function () { this.style.setProperty('max-width', 'none', 'important'); });
$('.wy-menu.wy-menu-vertical > ul:nth-of-type(2)').hide(); /* Fix theme navbar shows hidden toctree */
}); });
...@@ -27,15 +27,18 @@ libpath = os.path.join(curr_path, '../python-package/') ...@@ -27,15 +27,18 @@ libpath = os.path.join(curr_path, '../python-package/')
sys.path.insert(0, libpath) sys.path.insert(0, libpath)
# -- mock out modules # -- mock out modules
from unittest.mock import Mock try:
MOCK_MODULES = [ from unittest.mock import Mock # Python 3.x
'numpy', 'scipy', 'scipy.sparse', except ImportError:
from mock import Mock # Python 2.x
MOCK_MODULES = ['numpy', 'scipy', 'scipy.sparse',
'sklearn', 'matplotlib', 'pandas', 'graphviz', 'sklearn', 'matplotlib', 'pandas', 'graphviz',
'lightgbm.compat.LGBMDeprecated'
] ]
for mod_name in MOCK_MODULES: for mod_name in MOCK_MODULES:
sys.modules[mod_name] = Mock() sys.modules[mod_name] = Mock()
# -- General configuration ------------------------------------------------ # -- General configuration ------------------------------------------------
os.environ['LIGHTGBM_BUILD_DOC'] = '1' os.environ['LIGHTGBM_BUILD_DOC'] = '1'
...@@ -126,56 +129,5 @@ html_static_path = ['_static'] ...@@ -126,56 +129,5 @@ html_static_path = ['_static']
htmlhelp_basename = 'LightGBMdoc' htmlhelp_basename = 'LightGBMdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
# latex_documents = [
# (master_doc, 'LightGBM.tex', 'LightGBM Documentation',
# 'Microsoft Corporation', 'manual'),
# ]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
# man_pages = [
# (master_doc, 'lightgbm', 'LightGBM Documentation',
# [author], 1)
# ]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
# texinfo_documents = [
# (master_doc, 'LightGBM', 'LightGBM Documentation',
# author, 'LightGBM', 'One line description of project.',
# 'Miscellaneous'),
# ]
def setup(app): def setup(app):
app.add_javascript("js/rst_links_fix.js") app.add_javascript("js/rst_links_fix.js")
...@@ -31,21 +31,28 @@ Some explanatory pictures: ...@@ -31,21 +31,28 @@ Some explanatory pictures:
.. image:: ./_static/images/gcc-table.png .. image:: ./_static/images/gcc-table.png
:align: center :align: center
:target: ./_static/images/gcc-table.png
.. image:: ./_static/images/gcc-bars.png .. image:: ./_static/images/gcc-bars.png
:align: center :align: center
:target: ./_static/images/gcc-bars.png
.. image:: ./_static/images/gcc-chart.png .. image:: ./_static/images/gcc-chart.png
:align: center :align: center
:target: ./_static/images/gcc-chart.png
.. image:: ./_static/images/gcc-comparison-1.png .. image:: ./_static/images/gcc-comparison-1.png
:align: center :align: center
:target: ./_static/images/gcc-comparison-1.png
.. image:: ./_static/images/gcc-comparison-2.png .. image:: ./_static/images/gcc-comparison-2.png
:align: center :align: center
:target: ./_static/images/gcc-comparison-2.png
.. image:: ./_static/images/gcc-meetup-1.png .. image:: ./_static/images/gcc-meetup-1.png
:align: center :align: center
:target: ./_static/images/gcc-meetup-1.png
.. image:: ./_static/images/gcc-meetup-2.png .. image:: ./_static/images/gcc-meetup-2.png
:align: center :align: center
:target: ./_static/images/gcc-meetup-2.png
...@@ -24,6 +24,15 @@ Welcome to LightGBM's documentation! ...@@ -24,6 +24,15 @@ Welcome to LightGBM's documentation!
FAQ <FAQ> FAQ <FAQ>
Development Guide <Development-Guide> Development Guide <Development-Guide>
.. toctree::
:hidden:
GPU-Performance
GPU-Targets
GPU-Windows
gcc-Tips
README
Indices and Tables Indices and Tables
================== ==================
......
...@@ -10,6 +10,7 @@ if "%SPHINXBUILD%" == "" ( ...@@ -10,6 +10,7 @@ if "%SPHINXBUILD%" == "" (
set SOURCEDIR=. set SOURCEDIR=.
set BUILDDIR=_build set BUILDDIR=_build
set SPHINXPROJ=LightGBM set SPHINXPROJ=LightGBM
set SPHINXOPTS=-W
if "%1" == "" goto help if "%1" == "" goto help
......
...@@ -63,7 +63,6 @@ try: ...@@ -63,7 +63,6 @@ try:
from sklearn.base import BaseEstimator from sklearn.base import BaseEstimator
from sklearn.base import RegressorMixin, ClassifierMixin from sklearn.base import RegressorMixin, ClassifierMixin
from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import LabelEncoder
from sklearn.utils import deprecated
from sklearn.utils.multiclass import check_classification_targets from sklearn.utils.multiclass import check_classification_targets
from sklearn.utils.validation import check_X_y, check_array, check_consistent_length from sklearn.utils.validation import check_X_y, check_array, check_consistent_length
try: try:
...@@ -77,7 +76,6 @@ try: ...@@ -77,7 +76,6 @@ try:
_LGBMRegressorBase = RegressorMixin _LGBMRegressorBase = RegressorMixin
_LGBMClassifierBase = ClassifierMixin _LGBMClassifierBase = ClassifierMixin
_LGBMLabelEncoder = LabelEncoder _LGBMLabelEncoder = LabelEncoder
LGBMDeprecated = deprecated
LGBMNotFittedError = NotFittedError LGBMNotFittedError = NotFittedError
_LGBMStratifiedKFold = StratifiedKFold _LGBMStratifiedKFold = StratifiedKFold
_LGBMGroupKFold = GroupKFold _LGBMGroupKFold = GroupKFold
...@@ -91,7 +89,6 @@ except ImportError: ...@@ -91,7 +89,6 @@ except ImportError:
_LGBMClassifierBase = object _LGBMClassifierBase = object
_LGBMRegressorBase = object _LGBMRegressorBase = object
_LGBMLabelEncoder = None _LGBMLabelEncoder = None
# LGBMDeprecated = None Don't uncomment it because it causes error without installed sklearn
LGBMNotFittedError = ValueError LGBMNotFittedError = ValueError
_LGBMStratifiedKFold = None _LGBMStratifiedKFold = None
_LGBMGroupKFold = None _LGBMGroupKFold = None
......
...@@ -12,7 +12,7 @@ except ImportError: ...@@ -12,7 +12,7 @@ except ImportError:
_IS_PANDAS_INSTALLED = False _IS_PANDAS_INSTALLED = False
from .basic import Dataset, LightGBMError from .basic import Dataset, LightGBMError
from .compat import (SKLEARN_INSTALLED, _LGBMClassifierBase, LGBMDeprecated, from .compat import (SKLEARN_INSTALLED, _LGBMClassifierBase,
LGBMNotFittedError, _LGBMLabelEncoder, _LGBMModelBase, LGBMNotFittedError, _LGBMLabelEncoder, _LGBMModelBase,
_LGBMRegressorBase, _LGBMCheckXY, _LGBMCheckArray, _LGBMCheckConsistentLength, _LGBMRegressorBase, _LGBMCheckXY, _LGBMCheckArray, _LGBMCheckConsistentLength,
_LGBMCheckClassificationTargets, argc_, range_) _LGBMCheckClassificationTargets, argc_, range_)
...@@ -582,12 +582,14 @@ class LGBMModel(_LGBMModelBase): ...@@ -582,12 +582,14 @@ class LGBMModel(_LGBMModelBase):
raise LGBMNotFittedError('No feature_importances found. Need to call fit beforehand.') raise LGBMNotFittedError('No feature_importances found. Need to call fit beforehand.')
return self.booster_.feature_importance() return self.booster_.feature_importance()
@LGBMDeprecated('Use attribute booster_ instead.')
def booster(self): def booster(self):
warnings.warn('The `booster()` method is deprecated and will be removed in next version. '
'Please use attribute `booster_` instead.', LGBMDeprecationWarning)
return self.booster_ return self.booster_
@LGBMDeprecated('Use attribute feature_importances_ instead.')
def feature_importance(self): def feature_importance(self):
warnings.warn('The `feature_importance()` method is deprecated and will be removed in next version. '
'Please use attribute `feature_importances_` instead.', LGBMDeprecationWarning)
return self.feature_importances_ return self.feature_importances_
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment