Skip to content

Commit c11960b

Browse files
scottgigante-immunaicanergengithub-actions[bot]
authored
Changes in destVI code (#826) (#827)
* Changes in destVI code (#826) Co-authored-by: Scott Gigante <84813314+scottgigante-immunai@users.noreply.github.com> * pre-commit --------- Co-authored-by: Can Ergen <canergen.ac@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Former-commit-id: 05a4c72
1 parent 301f0b7 commit c11960b

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

  • openproblems/tasks/spatial_decomposition/methods

openproblems/tasks/spatial_decomposition/methods/destvi.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def destvi(
2626
max_epochs_sp = max_epochs_sp or 10
2727
max_epochs_sc = max_epochs_sc or 10
2828
else: # pragma: nocover
29-
max_epochs_sc = max_epochs_sc or 300
30-
max_epochs_sp = max_epochs_sp or 2500
29+
max_epochs_sc = max_epochs_sc or 500
30+
max_epochs_sp = max_epochs_sp or 10000
3131

3232
adata_sc, adata = split_sc_and_sp(adata)
3333

@@ -36,15 +36,17 @@ def destvi(
3636
sc_model.train(
3737
max_epochs=max_epochs_sc,
3838
early_stopping=True,
39-
early_stopping_monitor="reconstruction_loss_train",
39+
train_size=0.9,
40+
validation_size=0.1,
41+
early_stopping_monitor="elbo_validation",
4042
)
4143
DestVI.setup_anndata(adata)
4244

4345
st_model = DestVI.from_rna_model(adata, sc_model)
4446
st_model.train(
4547
max_epochs=max_epochs_sp,
46-
early_stopping=True,
47-
early_stopping_monitor="reconstruction_loss_train",
48+
batch_size=min(int(adata.n_obs / 20 + 3), 128),
49+
plan_kwargs={"min_kl_weight": 3.0, "max_kl_weight": 3},
4850
)
4951
adata.obsm["proportions_pred"] = st_model.get_proportions().to_numpy()
5052
adata.uns["method_code_version"] = check_version("scvi-tools")

0 commit comments

Comments
 (0)