Skip to content

Commit

Permalink
cast to np.array before prediction (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
allispaul authored Jun 4, 2024
1 parent 7bb8fa4 commit a956573
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ISLP/bart/bart.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def predict(self,

for trees in self.trees_sample_:
for tree in trees:
tree_fit = np.array([tree.predict_out_of_sample(x) for x in X])
tree_fit = np.array([tree.predict_out_of_sample(x) for x in np.asarray(X)])
output += tree_fit
output = output / nsample
return self._inverse(output)
Expand All @@ -122,7 +122,7 @@ def staged_predict(self,

for nstep, trees in enumerate(trees_sample_):
for tree in trees:
tree_fit = np.array([tree.predict_out_of_sample(x) for x in X])
tree_fit = np.array([tree.predict_out_of_sample(x) for x in np.asarray(X)])
output[nstep] += tree_fit

output = np.cumsum(output, 0) / (np.arange(nsample) + 1)[:,None]
Expand Down

0 comments on commit a956573

Please sign in to comment.