COSMIT Mimimal refactoring of gradient_boosting.py
@@ -1190,19 +1190,11 @@ class BaseGradientBoosting(six.with_metaclass(ABCMeta, BaseEnsemble)):
# no inplace multiplication!
sample_weight = sample_weight * sample_mask.astype(np.float64)
- if X_csc is not None:
- tree.fit(X_csc, residual, sample_weight=sample_weight,
- check_input=False, X_idx_sorted=X_idx_sorted)
- else:
+ X = X_csr if X_csr is not None else X
tree.fit(X, residual, sample_weight=sample_weight,
check_input=False, X_idx_sorted=X_idx_sorted)
# update tree leaves
- if X_csr is not None:
- loss.update_terminal_regions(tree.tree_, X_csr, y, residual, y_pred,
- sample_weight, sample_mask,
- self.learning_rate, k=k)
- else:
loss.update_terminal_regions(tree.tree_, X, y, residual, y_pred,
sample_weight, sample_mask,
self.learning_rate, k=k)
