Skip to content

Commit

Permalink
no need for staged_pred_dist if will only use last value
Browse files Browse the repository at this point in the history
  • Loading branch information
mesenrj committed Jan 23, 2024
1 parent 07734dd commit b45f7b6
Showing 1 changed file with 3 additions and 8 deletions.
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

0 comments on commit b45f7b6

Please sign in to comment.