Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue causing large memory consumption in pred_dist() #344

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions ngboost/ngboost.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ def partial_fit(
# if early stopping is specified, split X,Y and sample weights (if given) into training and validation sets
# This will overwrite any X_val and Y_val values passed by the user directly.
if self.early_stopping_rounds is not None:

early_stopping_rounds = self.early_stopping_rounds

if sample_weight is None:
Expand Down Expand Up @@ -490,13 +489,9 @@ def pred_dist(self, X, max_iter=None):

X = check_array(X, accept_sparse=True)

if (
max_iter is not None
): # get prediction at a particular iteration if asked for
dist = self.staged_pred_dist(X, max_iter=max_iter)[-1]
else:
params = np.asarray(self.pred_param(X, max_iter))
dist = self.Dist(params.T)
params = np.asarray(self.pred_param(X, max_iter))
dist = self.Dist(params.T)

return dist

def staged_pred_dist(self, X, max_iter=None):
Expand Down
Loading