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
2c5409ba
"git@developer.sourcefind.cn:tianlh/lightgbm-dcu.git" did not exist on "da44387176316632f126114182f6754a68a1d557"
Commit
2c5409ba
authored
Sep 20, 2018
by
Nikita Titov
Committed by
Guolin Ke
Sep 20, 2018
Browse files
removed deprecated code (#1677)
parent
9f9f9106
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
40 deletions
+1
-40
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+1
-10
python-package/lightgbm/sklearn.py
python-package/lightgbm/sklearn.py
+0
-30
No files found.
python-package/lightgbm/basic.py
View file @
2c5409ba
...
...
@@ -2083,9 +2083,6 @@ class Booster(object):
Used only if data is string.
is_reshape : bool, optional (default=True)
If True, result is reshaped to [nrow, ncol].
pred_parameter : dict or None, optional (default=None)
Deprecated.
Other parameters for the prediction.
**kwargs : other parameters for the prediction
Returns
...
...
@@ -2093,13 +2090,7 @@ class Booster(object):
result : numpy array
Prediction result.
"""
if
pred_parameter
:
warnings
.
warn
(
"pred_parameter is deprecated and will be removed in 2.2 version.
\n
"
"Please use kwargs instead."
,
LGBMDeprecationWarning
)
pred_parameter
.
update
(
kwargs
)
else
:
pred_parameter
=
kwargs
predictor
=
self
.
_to_predictor
(
pred_parameter
)
predictor
=
self
.
_to_predictor
(
kwargs
)
if
num_iteration
is
None
:
num_iteration
=
self
.
best_iteration
return
predictor
.
predict
(
data
,
num_iteration
,
raw_score
,
pred_leaf
,
pred_contrib
,
data_has_header
,
is_reshape
)
...
...
python-package/lightgbm/sklearn.py
View file @
2c5409ba
...
...
@@ -560,36 +560,6 @@ class LGBMModel(_LGBMModelBase):
return
self
.
booster_
.
predict
(
X
,
raw_score
=
raw_score
,
num_iteration
=
num_iteration
,
pred_leaf
=
pred_leaf
,
pred_contrib
=
pred_contrib
,
**
kwargs
)
def
apply
(
self
,
X
,
num_iteration
=
0
):
"""Return the predicted leaf every tree for each sample.
Parameters
----------
X : array-like or sparse matrix of shape = [n_samples, n_features]
Input features matrix.
num_iteration : int, optional (default=0)
Limit number of iterations in the prediction; defaults to 0 (use all trees).
Returns
-------
X_leaves : array-like of shape = [n_samples, n_trees]
The predicted leaf every tree for each sample.
"""
warnings
.
warn
(
'apply method is deprecated and will be removed in 2.2 version.
\n
'
'Please use pred_leaf parameter of predict method instead.'
,
LGBMDeprecationWarning
)
if
self
.
_n_features
is
None
:
raise
LGBMNotFittedError
(
"Estimator not fitted, call `fit` before exploiting the model."
)
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
:
raise
ValueError
(
"Number of features of the model must "
"match the input. Model n_features_ is %s and "
"input n_features is %s "
%
(
self
.
_n_features
,
n_features
))
return
self
.
booster_
.
predict
(
X
,
pred_leaf
=
True
,
num_iteration
=
num_iteration
)
@
property
def
n_features_
(
self
):
"""Get the number of features of fitted model."""
...
...
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