def test_gcp_random_effect_independent_per_person(self): expected_case_one_gcp = 66.66369405 expected_case_two_gcp = 51.34845213 self._test_case_one._randomEffects["gcp"] = 5 gcp_model = GCPModel() actual_case_one_gcp = gcp_model.get_risk_for_person( self._test_case_one, test=True) actual_case_two_gcp = gcp_model.get_risk_for_person( self._test_case_two, test=True) self.assertAlmostEqual(expected_case_one_gcp, actual_case_one_gcp, places=1) self.assertAlmostEqual(expected_case_two_gcp, actual_case_two_gcp, places=1)
def init_vectorized_population_dataframe(person_list: List[Person], *, with_base_gcp=False): if with_base_gcp: gcp_model = GCPModel() for p in person_list: if len(p._gcp) == 0: base_gcp = gcp_model.get_risk_for_person(p) p._gcp.append(base_gcp) people = pd.Series(person_list) population = Population(people) return population.get_people_current_state_and_summary_as_dataframe()