Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions collab/foraging/toolkit/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,9 @@ def evaluate_performance(
fig.suptitle("Model evaluation", fontsize=16)

plt.show()
else:
return {
"coverage": coverage,
"mae": mae,
"rsquared": rsquared,
}
2 changes: 1 addition & 1 deletion collab/foraging/toolkit/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def run_svi_inference(
loss.backward()
losses.append(loss.item())
adam.step()
if (step % 200 == 0) or (step == 1) & verbose:
if verbose and ((step % 200 == 0) or (step == 1)):
print("[iteration %04d] loss: %.4f" % (step, loss))

if plot:
Expand Down
3 changes: 2 additions & 1 deletion collab/foraging/toolkit/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def update(frame):
return foragers_scat, *predictors_scat_list

# Create the animation
print(num_frames)
print(f"Animation generation complete. Generated {num_frames} frames.")
ani = animation.FuncAnimation(
fig,
update,
Expand All @@ -211,4 +211,5 @@ def update(frame):
interval=500,
repeat_delay=3500,
)
plt.close(fig) # Close the figure to prevent displaying the static plot
return ani