-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redefine
n_factors
as the number of uninformed factors
- Loading branch information
Showing
3 changed files
with
19 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,23 @@ | ||
from muvi import MuVI | ||
|
||
|
||
def test_fewer_n_factors(pandas_input): | ||
model = MuVI( | ||
pandas_input["observations"], | ||
pandas_input["masks"], | ||
pandas_input["covariates"], | ||
n_factors=pandas_input["n_factors"] - 2, | ||
view_names=pandas_input["view_names"], | ||
device="cpu", | ||
) | ||
|
||
assert model.n_factors == pandas_input["n_factors"] | ||
|
||
|
||
def test_more_n_factors(pandas_input): | ||
n_dense = 2 | ||
n_factors = 2 | ||
|
||
model = MuVI( | ||
pandas_input["observations"], | ||
pandas_input["masks"], | ||
pandas_input["covariates"], | ||
n_factors=pandas_input["n_factors"] + n_dense, | ||
n_factors=n_factors, | ||
view_names=pandas_input["view_names"], | ||
device="cpu", | ||
) | ||
|
||
assert model.n_factors == pandas_input["n_factors"] + n_dense | ||
assert model.n_factors == pandas_input["n_factors"] + n_factors | ||
assert ( | ||
model.factor_names[-n_dense:] == [f"dense_{k}" for k in range(n_dense)] | ||
model.factor_names[-n_factors:] == [f"dense_{k}" for k in range(n_factors)] | ||
).all() | ||
|
||
for prior_mask in model.get_prior_masks().values(): | ||
assert prior_mask.shape[0] == model.n_factors | ||
assert prior_mask[-n_dense:, :].all() | ||
assert prior_mask[-n_factors:, :].all() |