diff --git a/src/aind_behavior_dynamic_foraging/task_logic/utils/calculate_bias.py b/src/aind_behavior_dynamic_foraging/task_logic/utils/calculate_bias.py index 3442641..32965c1 100644 --- a/src/aind_behavior_dynamic_foraging/task_logic/utils/calculate_bias.py +++ b/src/aind_behavior_dynamic_foraging/task_logic/utils/calculate_bias.py @@ -67,12 +67,12 @@ def calculate_bias(outcomes: List[TrialOutcome]) -> float: logger.warning("No choices in the last %d trials. Returning bias of 0.", trial_window_length) return 0 if n_right_choice == 0: - logger.warning("No right choices in the last %d trials. Returning bias of -1.", trial_window_length) - return -1 + logger.warning("No right choices in the last %d trials. Returning bias of +1.", trial_window_length) + return 1 if n_left_choice == 0: - logger.warning("No left choices in the last %d trials. Returning bias of +1.", trial_window_length) - return 1 + logger.warning("No left choices in the last %d trials. Returning bias of -1.", trial_window_length) + return -1 logistic_reg = LogisticRegression(solver=solver, l1_ratio=l1_ratio, C=1 / regularization_strength) logistic_reg.fit(x, y) diff --git a/tests/trial_generators/test_calculate_bias.py b/tests/trial_generators/test_calculate_bias.py index 528a834..1cf6ca2 100644 --- a/tests/trial_generators/test_calculate_bias.py +++ b/tests/trial_generators/test_calculate_bias.py @@ -42,7 +42,7 @@ def test_uniform_choices_returns_nan(self): """All same choice and reward should return nan since bias is undefined.""" outcomes = make_outcomes(100, 1, 1) bias = calculate_bias(outcomes) - self.assertTrue(bias == 1) + self.assertTrue(bias == -1) def test_ignored_trials_excluded(self): """Adding ignored trials should not change the result."""