"git@developer.sourcefind.cn:tianlh/lightgbm-dcu.git" did not exist on "da44387176316632f126114182f6754a68a1d557"
Commit 2c5409ba authored by Nikita Titov's avatar Nikita Titov Committed by Guolin Ke
Browse files

removed deprecated code (#1677)

parent 9f9f9106
......@@ -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)
......
......@@ -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."""
......
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