intro.md~ 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. ---
  2. jupytext:
  3. cell_metadata_filter: -all
  4. formats: md:myst
  5. text_representation:
  6. extension: .md
  7. format_name: myst
  8. kernelspec:
  9. display_name: Python 3
  10. language: python
  11. name: python3
  12. ---
  13. (ch:intro)=
  14. # Introduction
  15. In this chapter, we do blah.
  16. Specifically
  17. - foo
  18. - bar.
  19. - baz
  20. For more details, see
  21. {ref}`ch:hmm` and {cite}`Sarkka13`.
  22. ## What are state space models?
  23. ## Python
  24. We\'re now ready to start coding.
  25. ```{code-cell}
  26. from matplotlib import rcParams, cycler
  27. import matplotlib.pyplot as plt
  28. import numpy as np
  29. plt.ion()
  30. ```
  31. ```{code-cell}
  32. # Fixing random state for reproducibility
  33. np.random.seed(19680801)
  34. N = 10
  35. data = [np.logspace(0, 1, 100) + np.random.randn(100) + ii for ii in range(N)]
  36. data = np.array(data).T
  37. cmap = plt.cm.coolwarm
  38. rcParams['axes.prop_cycle'] = cycler(color=cmap(np.linspace(0, 1, N)))
  39. from matplotlib.lines import Line2D
  40. custom_lines = [Line2D([0], [0], color=cmap(0.), lw=4),
  41. Line2D([0], [0], color=cmap(.5), lw=4),
  42. Line2D([0], [0], color=cmap(1.), lw=4)]
  43. fig, ax = plt.subplots(figsize=(10, 5))
  44. lines = ax.plot(data)
  45. ax.legend(custom_lines, ['Cold', 'Medium', 'Hot']);
  46. ```
  47. ```{code-cell}
  48. import matplotlib.pyplot as plt
  49. import numpy as np
  50. import jax
  51. import jax.numpy as jnp
  52. print(jax.devices())
  53. ```
  54. ## Images
  55. <!---
  56. ![](https://myst-parser.readthedocs.io/en/latest/_static/logo-wide.svg)
  57. --->
  58. <img src="https://github.com/probml/probml-notebooks/blob/main/images/cat_dog.jpg"
  59. style="height:200">
  60. ```{figure} /images/cat_dog.jpg
  61. :scale: 50%
  62. :name: cat_dog
  63. A photo of a cat and a dog.
  64. ```
  65. ```{figure} /images/cat_dog.jpg
  66. :scale: 50%
  67. :name: cat_dog2
  68. Another photo of a cat and a dog.
  69. ```
  70. In {numref}`Figure %s <cat_dog>` we show catdog.
  71. In {numref}`Figure %s <cat_dog2>` we show catdog2, its twin.
  72. ## Math
  73. We have $E= mc^2$, and also
  74. ```{math}
  75. :label: foo
  76. a x^2 + bx+ c = 0
  77. ```
  78. From {eq}`foo`, it follows that
  79. $$
  80. \begin{align}
  81. 0 &= a x^2 + bx+ c \\
  82. 0 &= a x^2 + bx+ c
  83. \end{align}
  84. $$