Spaces:
Running
Running
| import streamlit as st | |
| from pathlib import Path | |
| # Load custom CSS | |
| def load_css(): | |
| css_file = Path(__file__).parent / ".streamlit" / "style.css" | |
| if css_file.exists(): | |
| with open(css_file) as f: | |
| st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True) | |
| load_css() | |
| home_page = [ | |
| st.Page("pages/home.py", title="Welcome", icon=":material/home:", default=True), | |
| ] | |
| probability_pages = [ | |
| st.Page( | |
| "pages/probability/00_gaussian_1d.py", | |
| title="Gaussian 1D", | |
| icon=":material/science:", | |
| ), | |
| st.Page( | |
| "pages/probability/01_gaussian_2d.py", | |
| title="Gaussian 2D", | |
| icon=":material/scatter_plot:", | |
| ), | |
| st.Page( | |
| "pages/probability/02_beta_distribution.py", | |
| title="Beta Distribution", | |
| icon=":material/pie_chart:", | |
| ), | |
| st.Page( | |
| "pages/probability/03_binomial_distribution.py", | |
| title="Binomial Distribution", | |
| icon=":material/casino:", | |
| ), | |
| st.Page( | |
| "pages/probability/04_gaussian_expectation.py", | |
| title="Gaussian Expectation", | |
| icon=":material/integration_instructions:", | |
| ), | |
| st.Page( | |
| "pages/probability/05_bayes_theorem.py", | |
| title="Bayes' Theorem", | |
| icon=":material/calculate:", | |
| ), | |
| st.Page( | |
| "pages/probability/06_beta_binomial.py", | |
| title="Bayesian Coin Toss", | |
| icon=":material/monetization_on:", | |
| ), | |
| st.Page( | |
| "pages/probability/07_grid_approximation.py", | |
| title="Grid Approximation", | |
| icon=":material/grid_on:", | |
| ), | |
| st.Page( | |
| "pages/probability/08_beta_binomial_predictive.py", | |
| title="Beta-Binomial Predictive", | |
| icon=":material/query_stats:", | |
| ), | |
| ] | |
| regression_pages = [ | |
| st.Page( | |
| "pages/regression/00_curve_fitting.py", | |
| title="Curve Fitting", | |
| icon=":material/show_chart:", | |
| ), | |
| st.Page( | |
| "pages/regression/01_likelihood.py", | |
| title="What is Likelihood?", | |
| icon=":material/analytics:", | |
| ), | |
| st.Page( | |
| "pages/regression/02_mle_unbiased.py", | |
| title="MLE is Unbiased", | |
| icon=":material/balance:", | |
| ), | |
| st.Page( | |
| "pages/regression/03_bayesian_linear_regression.py", | |
| title="Bayesian Linear Regression", | |
| icon=":material/trending_up:", | |
| ), | |
| st.Page( | |
| "pages/regression/04_predictive_distribution.py", | |
| title="Predictive Distribution", | |
| icon=":material/query_stats:", | |
| ), | |
| st.Page( | |
| "pages/regression/05_regression_basis_functions.py", | |
| title="Regression with Basis Functions", | |
| icon=":material/stacked_line_chart:", | |
| ), | |
| st.Page( | |
| "pages/regression/06_model_selection.py", | |
| title="Model Selection", | |
| icon=":material/tune:", | |
| ), | |
| st.Page( | |
| "pages/regression/07_loss_likelihood.py", | |
| title="Probabilistic Interpretation of Loss", | |
| icon=":material/sync_alt:", | |
| ), | |
| st.Page( | |
| "pages/regression/08_occams_razor.py", | |
| title="Bayesian Occam's Razor", | |
| icon=":material/balance:", | |
| ), | |
| st.Page( | |
| "pages/regression/09_prior_data_effect.py", | |
| title="Effect of Prior and Data", | |
| icon=":material/tune:", | |
| ), | |
| st.Page( | |
| "pages/regression/10_heteroskedastic_noise.py", | |
| title="Heteroskedastic Noise", | |
| icon=":material/equalizer:", | |
| ), | |
| ] | |
| monte_carlo_pages = [ | |
| st.Page( | |
| "pages/monte_carlo/00_estimate_pi.py", | |
| title="Estimating π", | |
| icon=":material/casino:", | |
| ), | |
| st.Page( | |
| "pages/monte_carlo/01_rejection_sampling.py", | |
| title="Rejection Sampling", | |
| icon=":material/filter_alt:", | |
| ), | |
| st.Page( | |
| "pages/monte_carlo/02_random_walk.py", | |
| title="2D Random Walk", | |
| icon=":material/explore:", | |
| ), | |
| st.Page( | |
| "pages/monte_carlo/03_mcmc_metropolis.py", | |
| title="MCMC Metropolis-Hastings", | |
| icon=":material/hub:", | |
| ), | |
| st.Page( | |
| "pages/monte_carlo/04_mcmc_diagnostics.py", | |
| title="MCMC Diagnostics", | |
| icon=":material/monitoring:", | |
| ), | |
| st.Page( | |
| "pages/monte_carlo/05_hamiltonian_dynamics.py", | |
| title="Hamiltonian Dynamics", | |
| icon=":material/motion_photos_on:", | |
| ), | |
| st.Page( | |
| "pages/monte_carlo/06_hmc.py", | |
| title="HMC Sampling", | |
| icon=":material/rocket_launch:", | |
| ), | |
| ] | |
| gaussian_process_pages = [ | |
| st.Page( | |
| "pages/gaussian_process/00_multivariate_gaussian.py", | |
| title="Multivariate Gaussian", | |
| icon=":material/blur_on:", | |
| ), | |
| st.Page( | |
| "pages/gaussian_process/01_kernels.py", | |
| title="SE Kernel", | |
| icon=":material/waves:", | |
| ), | |
| st.Page( | |
| "pages/gaussian_process/02_gp_regression.py", | |
| title="GP Regression", | |
| icon=":material/ssid_chart:", | |
| ), | |
| st.Page( | |
| "pages/gaussian_process/03_marginal_likelihood.py", | |
| title="Marginal Likelihood", | |
| icon=":material/balance:", | |
| ), | |
| st.Page( | |
| "pages/gaussian_process/04_nngp_convergence.py", | |
| title="Neural Network → GP", | |
| icon=":material/device_hub:", | |
| ), | |
| st.Page( | |
| "pages/gaussian_process/05_conditioning_marginalization.py", | |
| title="Conditioning & Marginalization", | |
| icon=":material/call_split:", | |
| ), | |
| st.Page( | |
| "pages/gaussian_process/06_gp_joint_distribution.py", | |
| title="GP Joint Distribution", | |
| icon=":material/scatter_plot:", | |
| ), | |
| st.Page( | |
| "pages/gaussian_process/07_ml_non_identifiability.py", | |
| title="Non-Identifiability of ML", | |
| icon=":material/warning:", | |
| ), | |
| st.Page( | |
| "pages/gaussian_process/08_inducing_points.py", | |
| title="Inducing Points", | |
| icon=":material/track_changes:", | |
| ), | |
| st.Page( | |
| "pages/gaussian_process/08_sparse_gp.py", | |
| title="Sparse GP", | |
| icon=":material/compare_arrows:", | |
| ), | |
| st.Page( | |
| "pages/gaussian_process/09_gp_classification_laplace.py", | |
| title="GP Classification (Laplace)", | |
| icon=":material/bubble_chart:", | |
| ), | |
| ] | |
| linear_algebra_pages = [ | |
| st.Page( | |
| "pages/linear_algebra/00_determinant.py", | |
| title="Determinant", | |
| icon=":material/grid_on:", | |
| ), | |
| st.Page( | |
| "pages/linear_algebra/01_eigenvalues.py", | |
| title="Eigenvalues & Eigenvectors", | |
| icon=":material/open_with:", | |
| ), | |
| st.Page( | |
| "pages/linear_algebra/02_cholesky.py", | |
| title="Cholesky Decomposition", | |
| icon=":material/layers:", | |
| ), | |
| st.Page( | |
| "pages/linear_algebra/03_cholesky_solve.py", | |
| title="Solving with Cholesky", | |
| icon=":material/function:", | |
| ), | |
| ] | |
| optimization_pages = [ | |
| st.Page( | |
| "pages/optimization/00_gradient_descent.py", | |
| title="Gradient Descent", | |
| icon=":material/south_east:", | |
| ), | |
| st.Page( | |
| "pages/optimization/01_momentum.py", | |
| title="Momentum", | |
| icon=":material/speed:", | |
| ), | |
| st.Page( | |
| "pages/optimization/02_hessian.py", | |
| title="Hessian Matrix", | |
| icon=":material/grid_4x4:", | |
| ), | |
| st.Page( | |
| "pages/optimization/03_adam.py", | |
| title="Adam Optimizer", | |
| icon=":material/auto_awesome:", | |
| ), | |
| st.Page( | |
| "pages/optimization/04_sgd.py", | |
| title="Stochastic Gradient Descent", | |
| icon=":material/shuffle:", | |
| ), | |
| ] | |
| laplace_approximation_pages = [ | |
| st.Page( | |
| "pages/laplace_approximation/00_gamma_posterior.py", | |
| title="Gamma Posterior", | |
| icon=":material/blur_linear:", | |
| ), | |
| ] | |
| variational_inference_pages = [ | |
| st.Page( | |
| "pages/variational_inference/00_kl_divergence_asymmetry.py", | |
| title="KL Divergence Asymmetry", | |
| icon=":material/compare_arrows:", | |
| ), | |
| st.Page( | |
| "pages/variational_inference/01_jensens_inequality.py", | |
| title="Jensen's Inequality", | |
| icon=":material/functions:", | |
| ), | |
| st.Page( | |
| "pages/variational_inference/02_reparameterization_vs_reinforce.py", | |
| title="Reparameterization vs REINFORCE", | |
| icon=":material/insights:", | |
| ), | |
| st.Page( | |
| "pages/variational_inference/03_vi_optimization.py", | |
| title="VI Optimization", | |
| icon=":material/moving:", | |
| ), | |
| st.Page( | |
| "pages/variational_inference/04_normalizing_flow.py", | |
| title="Normalizing Flows", | |
| icon=":material/transform:", | |
| ), | |
| ] | |
| classification_pages = [ | |
| st.Page( | |
| "pages/classification/00_logistic_regression_2d.py", | |
| title="Logistic Regression 2D", | |
| icon=":material/category:", | |
| ), | |
| st.Page( | |
| "pages/classification/01_map_logistic_regression.py", | |
| title="MAP Estimation", | |
| icon=":material/my_location:", | |
| ), | |
| st.Page( | |
| "pages/classification/02_laplace_approximation.py", | |
| title="Laplace Approximation", | |
| icon=":material/blur_on:", | |
| ), | |
| st.Page( | |
| "pages/classification/03_variational_inference.py", | |
| title="Variational Inference", | |
| icon=":material/settings_suggest:", | |
| ), | |
| st.Page( | |
| "pages/classification/04_mcmc_inference.py", | |
| title="MCMC Inference", | |
| icon=":material/hub:", | |
| ), | |
| st.Page( | |
| "pages/classification/05_naive_bayes.py", | |
| title="Naive Bayes", | |
| icon=":material/domain:", | |
| ), | |
| ] | |
| bayesian_inference_pages = [ | |
| st.Page( | |
| "pages/bayesian_inference/00_uncertainty_decomposition.py", | |
| title="Uncertainty Decomposition", | |
| icon=":material/device_thermostat:", | |
| ), | |
| st.Page( | |
| "pages/bayesian_inference/01_online_learning_bnn.py", | |
| title="Online Learning (BNN)", | |
| icon=":material/update:", | |
| ), | |
| st.Page( | |
| "pages/bayesian_inference/02_doobs_consistency.py", | |
| title="Doob's Consistency", | |
| icon=":material/autorenew:", | |
| ), | |
| ] | |
| generative_models_pages = [ | |
| st.Page( | |
| "pages/generative_models/00_pca_2d.py", | |
| title="PCA in 2D", | |
| icon=":material/compress:", | |
| ), | |
| st.Page( | |
| "pages/generative_models/01_ppca.py", | |
| title="Probabilistic PCA", | |
| icon=":material/blur_circular:", | |
| ), | |
| st.Page( | |
| "pages/generative_models/02_gmm_em.py", | |
| title="GMM with EM", | |
| icon=":material/scatter_plot:", | |
| ), | |
| st.Page( | |
| "pages/generative_models/03_vae_pure_vi.py", | |
| title="VAE: Pure VI", | |
| icon=":material/auto_awesome:", | |
| ), | |
| st.Page( | |
| "pages/generative_models/04_vae_amortized.py", | |
| title="VAE: Amortized", | |
| icon=":material/model_training:", | |
| ), | |
| st.Page( | |
| "pages/generative_models/05_cvae.py", | |
| title="VAE: Conditional", | |
| icon=":material/tune:", | |
| ), | |
| st.Page( | |
| "pages/generative_models/06_elbo_visualization.py", | |
| title="ELBO Visualization", | |
| icon=":material/sync_alt:", | |
| ), | |
| ] | |
| deep_learning_pages = [ | |
| st.Page( | |
| "pages/deep_learning/00_mnist_classification.py", | |
| title="MNIST Classification (BNN)", | |
| icon=":material/neurology:", | |
| ), | |
| ] | |
| neural_network_pages = [ | |
| st.Page( | |
| "pages/neural_networks/00_weight_to_function_space.py", | |
| title="Weight → Function Space", | |
| icon=":material/neurology:", | |
| ), | |
| st.Page( | |
| "pages/neural_networks/01_active_learning_bnn.py", | |
| title="Active Learning (BALD)", | |
| icon=":material/science:", | |
| ), | |
| ] | |
| pg = st.navigation( | |
| { | |
| "Home": home_page, | |
| "Probability and Statistics": probability_pages, | |
| "Linear Algebra": linear_algebra_pages, | |
| "Regression": regression_pages, | |
| "Classification": classification_pages, | |
| "Neural Networks": neural_network_pages, | |
| "Bayesian Inference": bayesian_inference_pages, | |
| "Generative Models": generative_models_pages, | |
| # "Deep Learning": deep_learning_pages, | |
| "Monte Carlo": monte_carlo_pages, | |
| "Gaussian Processes": gaussian_process_pages, | |
| "Optimization": optimization_pages, | |
| "Laplace Approximation": laplace_approximation_pages, | |
| "Variational Inference": variational_inference_pages, | |
| }, | |
| position="sidebar", | |
| ) | |
| st.set_page_config( | |
| layout="wide", | |
| initial_sidebar_state="collapsed", | |
| page_icon=":material/menu_book:", | |
| page_title="ASI Demo", | |
| ) | |
| pg.run() | |