From a1df85915ec7f9494821f61f64e4ce43de24e57d Mon Sep 17 00:00:00 2001 From: Gibraan Rahman Date: Mon, 18 Sep 2023 15:01:52 -0700 Subject: [PATCH] Add SingleFeature NB LME --- .gitignore | 1 + birdman/default_models.py | 3 ++- tests/test_model.py | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3d1a5c4..d8d94db 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ birdman/templates/negative_binomial birdman/templates/multinomial birdman/templates/negative_binomial_single birdman/templates/negative_binomial_lme +birdman/templates/negative_binomial_lme_single tests/custom_model *__pycache__/ diff --git a/birdman/default_models.py b/birdman/default_models.py index bd95d4f..19916e9 100644 --- a/birdman/default_models.py +++ b/birdman/default_models.py @@ -410,7 +410,8 @@ def __init__( "inv_disp_sd": inv_disp_sd, "A": A, "subj_ids": samp_subj_map, - "u_p": group_var_prior + "u_p": group_var_prior, + "S": len(self.groups) } self.add_parameters(param_dict) diff --git a/tests/test_model.py b/tests/test_model.py index 48a76d6..55829b9 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -73,6 +73,9 @@ def test_single_feat(self, table_biom, metadata): def test_lme_single_feat(self, table_biom, metadata): md = metadata.copy() + np.random.seed(42) + md["group"] = np.random.randint(low=0, high=3, size=md.shape[0]) + md["group"] = "G" + md["group"].astype(str) for fid in table_biom.ids(axis="observation"): nb = NegativeBinomialLMESingle( table=table_biom,