Skip to content
Draft

dev #111

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
22 changes: 15 additions & 7 deletions src/aind_dynamic_foraging_basic_analysis/metrics/trial_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,21 @@ def compute_side_bias(nwb):
C.append(np.nan)
elif len(unique) == 2:
# Fit model
out = model.fit_logistic_regression(
choice, reward, n_trial_back=n_trials_back, cv=cv, fit_exponential=False
)
bias.append(out["df_beta"].loc["bias"]["bootstrap_mean"].values[0])
ci_lower.append(out["df_beta"].loc["bias"]["bootstrap_CI_lower"].values[0])
ci_upper.append(out["df_beta"].loc["bias"]["bootstrap_CI_upper"].values[0])
C.append(out["C"])
try:
out = model.fit_logistic_regression(
choice, reward, n_trial_back=n_trials_back, cv=cv, fit_exponential=False
)
bias.append(out["df_beta"].loc["bias"]["bootstrap_mean"].values[0])
ci_lower.append(out["df_beta"].loc["bias"]["bootstrap_CI_lower"].values[0])
ci_upper.append(out["df_beta"].loc["bias"]["bootstrap_CI_upper"].values[0])
C.append(out["C"])

except:
print('error computing logistic')
bias.append(np.nan)
ci_lower.append(-BIAS_LIMIT)
ci_upper.append(BIAS_LIMIT)
C.append(np.nan)
elif unique[0] == 0:
# only left choices, report bias confidence as (-inf, 0)
bias.append(-1)
Expand Down
Loading