-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
132 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# pylint: disable=invalid-name, exec-used | ||
"""Convert README.md to README.rst for PyPI""" | ||
|
||
from pypandoc import convert | ||
|
||
read_md = convert('python-package/README.md', 'rst') | ||
with open('python-package/README.rst', 'w') as rst_file: | ||
rst_file.write(read_md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# coding: utf-8 | ||
# pylint: disable=unused-import, invalid-name | ||
"""For compatibility""" | ||
|
||
from __future__ import absolute_import | ||
|
||
import sys | ||
|
||
|
||
PY3 = (sys.version_info[0] == 3) | ||
|
||
if PY3: | ||
# pylint: disable=invalid-name, redefined-builtin | ||
STRING_TYPES = str, | ||
else: | ||
# pylint: disable=invalid-name | ||
STRING_TYPES = basestring, | ||
|
||
# pandas | ||
try: | ||
from pandas import DataFrame | ||
PANDAS_INSTALLED = True | ||
except ImportError: | ||
|
||
class DataFrame(object): | ||
""" dummy for pandas.DataFrame """ | ||
pass | ||
|
||
PANDAS_INSTALLED = False | ||
|
||
# sklearn | ||
try: | ||
from sklearn.base import BaseEstimator | ||
from sklearn.base import RegressorMixin, ClassifierMixin | ||
from sklearn.preprocessing import LabelEncoder | ||
SKLEARN_INSTALLED = True | ||
|
||
XGBModelBase = BaseEstimator | ||
XGBRegressorBase = RegressorMixin | ||
XGBClassifierBase = ClassifierMixin | ||
except ImportError: | ||
SKLEARN_INSTALLED = False | ||
|
||
# used for compatiblity without sklearn | ||
XGBModelBase = object | ||
XGBClassifierBase = object | ||
XGBRegressorBase = object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters