Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
d22de3c2
Commit
d22de3c2
authored
Jan 26, 2018
by
Nikita Titov
Committed by
Guolin Ke
Jan 26, 2018
Browse files
fixed imports (#1220)
parent
0a9725b2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
13 deletions
+6
-13
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+1
-1
python-package/lightgbm/libpath.py
python-package/lightgbm/libpath.py
+0
-1
python-package/lightgbm/sklearn.py
python-package/lightgbm/sklearn.py
+5
-11
No files found.
python-package/lightgbm/basic.py
View file @
d22de3c2
...
...
@@ -15,7 +15,7 @@ import scipy.sparse
from
.compat
import
(
DataFrame
,
Series
,
integer_types
,
json
,
json_default_with_numpy
,
numeric_types
,
range_
,
string_type
,
LGBMDeprecationWarning
)
string_type
)
from
.libpath
import
find_lib_path
...
...
python-package/lightgbm/libpath.py
View file @
d22de3c2
# coding: utf-8
"""Find the path to lightgbm dynamic library files."""
import
os
import
sys
def
find_lib_path
():
...
...
python-package/lightgbm/sklearn.py
View file @
d22de3c2
...
...
@@ -4,19 +4,13 @@
from
__future__
import
absolute_import
import
numpy
as
np
import
warnings
try
:
import
pandas
as
pd
_IS_PANDAS_INSTALLED
=
True
except
ImportError
:
_IS_PANDAS_INSTALLED
=
False
from
.basic
import
Dataset
,
LightGBMError
from
.compat
import
(
SKLEARN_INSTALLED
,
_LGBMClassifierBase
,
LGBMNotFittedError
,
_LGBMLabelEncoder
,
_LGBMModelBase
,
_LGBMRegressorBase
,
_LGBMCheckXY
,
_LGBMCheckArray
,
_LGBMCheckConsistentLength
,
_LGBMCheckClassificationTargets
,
_LGBMComputeSampleWeight
,
argc_
,
range_
,
LGBMDeprecationWarning
)
argc_
,
range_
,
DataFrame
)
from
.engine
import
train
...
...
@@ -414,7 +408,7 @@ class LGBMModel(_LGBMModelBase):
feval
=
None
params
[
'metric'
]
=
eval_metric
if
not
_IS_PANDAS_INSTALLED
or
not
isinstance
(
X
,
pd
.
DataFrame
):
if
not
isinstance
(
X
,
DataFrame
):
X
,
y
=
_LGBMCheckXY
(
X
,
y
,
accept_sparse
=
True
,
force_all_finite
=
False
,
ensure_min_samples
=
2
)
_LGBMCheckConsistentLength
(
X
,
y
,
sample_weight
)
...
...
@@ -504,7 +498,7 @@ class LGBMModel(_LGBMModelBase):
"""
if
self
.
_n_features
is
None
:
raise
LGBMNotFittedError
(
"Estimator not fitted, call `fit` before exploiting the model."
)
if
not
_IS_PANDAS_INSTALLED
or
not
isinstance
(
X
,
pd
.
DataFrame
):
if
not
isinstance
(
X
,
DataFrame
):
X
=
_LGBMCheckArray
(
X
,
accept_sparse
=
True
,
force_all_finite
=
False
)
n_features
=
X
.
shape
[
1
]
if
self
.
_n_features
!=
n_features
:
...
...
@@ -531,7 +525,7 @@ class LGBMModel(_LGBMModelBase):
"""
if
self
.
_n_features
is
None
:
raise
LGBMNotFittedError
(
"Estimator not fitted, call `fit` before exploiting the model."
)
if
not
_IS_PANDAS_INSTALLED
or
not
isinstance
(
X
,
pd
.
DataFrame
):
if
not
isinstance
(
X
,
DataFrame
):
X
=
_LGBMCheckArray
(
X
,
accept_sparse
=
True
,
force_all_finite
=
False
)
n_features
=
X
.
shape
[
1
]
if
self
.
_n_features
!=
n_features
:
...
...
@@ -708,7 +702,7 @@ class LGBMClassifier(LGBMModel, _LGBMClassifierBase):
"""
if
self
.
_n_features
is
None
:
raise
LGBMNotFittedError
(
"Estimator not fitted, call `fit` before exploiting the model."
)
if
not
_IS_PANDAS_INSTALLED
or
not
isinstance
(
X
,
pd
.
DataFrame
):
if
not
isinstance
(
X
,
DataFrame
):
X
=
_LGBMCheckArray
(
X
,
accept_sparse
=
True
,
force_all_finite
=
False
)
n_features
=
X
.
shape
[
1
]
if
self
.
_n_features
!=
n_features
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment