Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
probml
GitHub Repository: probml/pyprobml
Path: blob/master/notebooks/misc/Superimport_broken.ipynb
1192 views
Kernel: Python 3

Open In Colab

Superimport demo that does not fully work

The superimport library is explained in this colab.

Unfortunately sometimes when you call a script it fails to run, because inspecting the call stack raises an exception (which is caught by superimport, which prints the error message 'Error importing. Please re-run the cell.' Re-running the same cell usually fixes the error but is annoying.

!pip install superimport -qqq !pip install deimport -qqq
Building wheel for superimport (setup.py) ... done Building wheel for deimport (setup.py) ... done
import superimport from deimport.deimport import deimport
!git clone --depth 1 https://github.com/probml/pyprobml /pyprobml &> /dev/null %cd -q /pyprobml/scripts
deimport(superimport) %run linreg_residuals_plot.py
saving image to /pyprobml/scripts/../figures/linregResidualsNoBars.pdf
Image in a Jupyter notebook
saving image to /pyprobml/scripts/../figures/linregResidualsBars.pdf
Image in a Jupyter notebook
deimport(superimport) %run linreg_poly_vs_degree.py
saving image to /pyprobml/scripts/../figures/polyfitVsDegree.pdf
Image in a Jupyter notebook
saving image to /pyprobml/scripts/../figures/polyfitDegree20.pdf
Image in a Jupyter notebook
saving image to /pyprobml/scripts/../figures/polyfitDegree20Residuals.pdf
Image in a Jupyter notebook
saving image to /pyprobml/scripts/../figures/polyfitDegree20FitVsActualTrain.pdf
Image in a Jupyter notebook
saving image to /pyprobml/scripts/../figures/polyfitDegree20FitVsActualTest.pdf
Image in a Jupyter notebook
deimport(superimport) %run iris_kmeans.py
Error importing. Please re-run the cell.
deimport(superimport) %run iris_kmeans.py
Image in a Jupyter notebookImage in a Jupyter notebook