Skip to content

Commit

Permalink
Add batchnorm test
Browse files Browse the repository at this point in the history
  • Loading branch information
jules-samaran committed Feb 26, 2024
1 parent a787320 commit ba26a71
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ cd scconfluence
pip install .
```

### Test your installation (optional)
### Test your development installation (optional)

```bash
pip install pytest
Expand Down
2 changes: 2 additions & 0 deletions tests/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def run_unimodal_ae(
n_hidden,
n_latent,
batch_key,
**ae_kwargs,
):
adata = create_synthetic_adata(
n_obs=n_obs, n_features=n_features, n_batch=n_batch, dim_pca=dim_pca
Expand All @@ -96,6 +97,7 @@ def run_unimodal_ae(
n_latent=n_latent,
batch_key=batch_key,
type_loss=type_loss,
**ae_kwargs,
)
ae.fit(save_path=path, use_cuda=False, ratio_val=0.2, batch_size=32, max_epochs=2)
adata.obsm["latent_embeddings"] = (
Expand Down
18 changes: 18 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,24 @@ def test_binary_ae(tmp_path):
)


def test_batchnorm_ae(tmp_path):
run_unimodal_ae(
path=tmp_path,
n_obs=100,
n_features=200,
n_batch=3,
dim_pca=20,
rep_in="X_pca",
rep_out="binary",
type_loss="binary",
n_hidden=15,
n_latent=10,
batch_key="batches",
use_batch_norm_enc="standard",
use_batch_norm_dec="ds",
)


def test_2modalities(tmp_path):
dic_obs = {"mod1": 100, "mod2": 150}
dic_features = {"mod1": 30, "mod2": 300}
Expand Down

0 comments on commit ba26a71

Please sign in to comment.