Skip to content

Commit

Permalink
Fix stereoscope tutorial (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkim0 authored Dec 7, 2023
1 parent 84636ee commit a14225b
Showing 1 changed file with 12 additions and 27 deletions.
39 changes: 12 additions & 27 deletions spatial/stereoscope_heart_LV_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -488,15 +488,12 @@
},
"outputs": [],
"source": [
"train = True\n",
"if train:\n",
" sc_model = RNAStereoscope(sc_adata)\n",
" sc_model.train(max_epochs=100)\n",
" sc_model.history[\"elbo_train\"][10:].plot()\n",
" sc_model.save(\"scmodel\", overwrite=True)\n",
"else:\n",
" sc_model = RNAStereoscope.load(\"scmodel\", adata=sc_adata)\n",
" print(\"Loaded RNA model from file!\")"
"sc_model_path = os.path.join(save_dir.name, \"sc_model\")\n",
"\n",
"sc_model = RNAStereoscope(sc_adata)\n",
"sc_model.train(max_epochs=100)\n",
"sc_model.history[\"elbo_train\"][10:].plot()\n",
"sc_model.save(sc_model_path, overwrite=True)"
]
},
{
Expand Down Expand Up @@ -546,15 +543,12 @@
},
"outputs": [],
"source": [
"train = True\n",
"if train:\n",
" spatial_model = SpatialStereoscope.from_rna_model(st_adata, sc_model)\n",
" spatial_model.train(max_epochs=2000)\n",
" spatial_model.history[\"elbo_train\"][10:].plot()\n",
" spatial_model.save(\"stmodel\", overwrite=True)\n",
"else:\n",
" spatial_model = SpatialStereoscope.load(\"stmodel\", adata=st_adata)\n",
" print(\"Loaded Spatial model from file!\")"
"spatial_model_path = os.path.join(save_dir.name, \"spatial_model\")\n",
"\n",
"spatial_model = SpatialStereoscope.from_rna_model(st_adata, sc_model)\n",
"spatial_model.train(max_epochs=2000)\n",
"spatial_model.history[\"elbo_train\"][10:].plot()\n",
"spatial_model.save(spatial_model_path, overwrite=True)"
]
},
{
Expand Down Expand Up @@ -619,15 +613,6 @@
" color_map=\"inferno\",\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "WfEk_qy0f2tA"
},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit a14225b

Please sign in to comment.