<jupyter_start><jupyter_text>Figure 1.1:     Three types of iris flowers: setosa, versicolor and virginica. Used with kind permission of <NAME> and SIGNA.<jupyter_code>#@title Setup { display-mode: "form" }
%%time
# If you run this for the first time it would take ~25/30 seconds
!git clone https://github.com/probml/pyprobml /pyprobml &> /dev/null && git clone https://github.com/probml/colab_powertoys.git &> /dev/null 
!pip3 install nbimporter -qqq 
%cd -q /content/colab_powertoys 
from colab_powertoys.probml_toys import probml_toys as pmlt
%cd -q /pyprobml/scripts

pmlt.show_image("/pyprobml/book1/figures/images/Figure_1.1_A.png")
pmlt.show_image("/pyprobml/book1/figures/images/Figure_1.1_B.png")
pmlt.show_image("/pyprobml/book1/figures/images/Figure_1.1_C.png")<jupyter_output><empty_output><jupyter_text>Figure 1.2:     (a) An image of a flower as seen by a human. (b) What the computer sees. The array of numbers represents pixel intensities in the highlighted box. This illustrates the difficulty of learning models that work with image data. From [Mar82] . Used with kind permission of MIT Press.<jupyter_code>#@title Setup { display-mode: "form" }
%%time
# If you run this for the first time it would take ~25/30 seconds
!git clone https://github.com/probml/pyprobml /pyprobml &> /dev/null && git clone https://github.com/probml/colab_powertoys.git &> /dev/null 
!pip3 install nbimporter -qqq 
%cd -q /content/colab_powertoys 
from colab_powertoys.probml_toys import probml_toys as pmlt
%cd -q /pyprobml/scripts

pmlt.show_image("/pyprobml/book1/figures/images/Figure_1.2_A.png")
pmlt.show_image("/pyprobml/book1/figures/images/Figure_1.2_B.png")<jupyter_output><empty_output><jupyter_text>Figure 1.3:     Visualization of the Iris data as a pairwise scatter plot. On the diagonal we plot the marginal distribution of each feature for each class. The off-diagonals contain scatterplots of all possible pairs of features.  Figure(s) generated by [iris_plot.py](https://github.com/probml/pyprobml/blob/master/scripts/iris_plot.py)<jupyter_code>#@title Setup { display-mode: "form" }
%%time
# If you run this for the first time it would take ~25/30 seconds
!git clone https://github.com/probml/pyprobml /pyprobml &> /dev/null && git clone https://github.com/probml/colab_powertoys.git &> /dev/null 
!pip3 install nbimporter -qqq 
%cd -q /content/colab_powertoys 
from colab_powertoys.probml_toys import probml_toys as pmlt
%cd -q /pyprobml/scripts

pmlt.show_and_run("/pyprobml/scripts/iris_plot.py")<jupyter_output><empty_output><jupyter_text>Figure 1.4:     Example of a decision tree of depth 2 applied to the Iris data, using just the petal length and petal width features. Leaf nodes are color coded according to the predicted class. The number of training samples that pass from the root to a node is shown inside each box; we show how many values of each class fall into this node. This vector of counts can be normalized to get a distribution over class labels for each node. We can then pick the majority class. Adapted from Figures 6.1 and 6.2 of [Aur19] .  To reproduce this figure, click the open in colab button:<jupyter_code>#@title Setup { display-mode: "form" }
%%time
# If you run this for the first time it would take ~25/30 seconds
!git clone https://github.com/probml/pyprobml /pyprobml &> /dev/null && git clone https://github.com/probml/colab_powertoys.git &> /dev/null 
!pip3 install nbimporter -qqq 
%cd -q /content/colab_powertoys 
from colab_powertoys.probml_toys import probml_toys as pmlt
%cd -q /pyprobml/scripts

pmlt.show_image("/pyprobml/book1/figures/images/Figure_1.4_A.png")
pmlt.show_image("/pyprobml/book1/figures/images/Figure_1.4_B.png")<jupyter_output><empty_output><jupyter_text>Figure 1.5:     (a) Linear regression on some 1d data. (b) The vertical lines denote the residuals between the observed output value for each input (blue circle) and its predicted value (red cross). The goal of least squares regression is to pick a line that minimizes the sum of squared residuals.  Figure(s) generated by [linreg_residuals_plot.py](https://github.com/probml/pyprobml/blob/master/scripts/linreg_residuals_plot.py)<jupyter_code>#@title Setup { display-mode: "form" }
%%time
# If you run this for the first time it would take ~25/30 seconds
!git clone https://github.com/probml/pyprobml /pyprobml &> /dev/null && git clone https://github.com/probml/colab_powertoys.git &> /dev/null 
!pip3 install nbimporter -qqq 
%cd -q /content/colab_powertoys 
from colab_powertoys.probml_toys import probml_toys as pmlt
%cd -q /pyprobml/scripts

pmlt.show_and_run("/pyprobml/scripts/linreg_residuals_plot.py")<jupyter_output><empty_output><jupyter_text>Figure 1.6:     Linear and polynomial regression applied to 2d data. Vertical axis is temperature, horizontal axes are location within a room. Data was collected by some remote sensing motes at Intel's lab in Berkeley, CA (data courtesy of <NAME>). (a) The fitted plane has the form $ f (\mathbf  x ) = w_0 + w_1 x_1 + w_2 x_2$. (b) Temperature data is fitted with a quadratic of the form $ f (\mathbf  x ) = w_0 + w_1 x_1 + w_2 x_2 + w_3 x_1^2 + w_4 x_2^2$.  Figure(s) generated by [linreg_2d_surface_demo.py](https://github.com/probml/pyprobml/blob/master/scripts/linreg_2d_surface_demo.py)<jupyter_code>#@title Setup { display-mode: "form" }
%%time
# If you run this for the first time it would take ~25/30 seconds
!git clone https://github.com/probml/pyprobml /pyprobml &> /dev/null && git clone https://github.com/probml/colab_powertoys.git &> /dev/null 
!pip3 install nbimporter -qqq 
%cd -q /content/colab_powertoys 
from colab_powertoys.probml_toys import probml_toys as pmlt
%cd -q /pyprobml/scripts

pmlt.show_and_run("/pyprobml/scripts/linreg_2d_surface_demo.py")<jupyter_output><empty_output><jupyter_text>Figure 1.7:     (a-c) Polynomials of degrees 2, 14 and 20 fit to 21 datapoints (the same data as in \cref  fig:linreg ). (d) MSE vs degree.  Figure(s) generated by [linreg_poly_vs_degree.py](https://github.com/probml/pyprobml/blob/master/scripts/linreg_poly_vs_degree.py)<jupyter_code>#@title Setup { display-mode: "form" }
%%time
# If you run this for the first time it would take ~25/30 seconds
!git clone https://github.com/probml/pyprobml /pyprobml &> /dev/null && git clone https://github.com/probml/colab_powertoys.git &> /dev/null 
!pip3 install nbimporter -qqq 
%cd -q /content/colab_powertoys 
from colab_powertoys.probml_toys import probml_toys as pmlt
%cd -q /pyprobml/scripts

pmlt.show_and_run("/pyprobml/scripts/linreg_poly_vs_degree.py")<jupyter_output><empty_output><jupyter_text>Figure 1.8:     (a) A scatterplot of the petal features from the iris dataset. (b) The result of unsupervised clustering using $K=3$.  Figure(s) generated by [iris_kmeans.py](https://github.com/probml/pyprobml/blob/master/scripts/iris_kmeans.py)<jupyter_code>#@title Setup { display-mode: "form" }
%%time
# If you run this for the first time it would take ~25/30 seconds
!git clone https://github.com/probml/pyprobml /pyprobml &> /dev/null && git clone https://github.com/probml/colab_powertoys.git &> /dev/null 
!pip3 install nbimporter -qqq 
%cd -q /content/colab_powertoys 
from colab_powertoys.probml_toys import probml_toys as pmlt
%cd -q /pyprobml/scripts

pmlt.show_and_run("/pyprobml/scripts/iris_kmeans.py")<jupyter_output><empty_output><jupyter_text>Figure 1.9:     (a) Scatterplot of iris data (first 3 features). Points are color coded by class. (b) We fit a 2d linear subspace to the 3d data using PCA. The class labels are ignored. Red dots are the original data, black dots are points generated from the model using $ \mathbf  x   = \mathbf  W \mathbf  z + \boldsymbol  \mu  $, where $\mathbf  z $ are latent points on the underlying inferred 2d linear manifold.  Figure(s) generated by [iris_pca.py](https://github.com/probml/pyprobml/blob/master/scripts/iris_pca.py)<jupyter_code>#@title Setup { display-mode: "form" }
%%time
# If you run this for the first time it would take ~25/30 seconds
!git clone https://github.com/probml/pyprobml /pyprobml &> /dev/null && git clone https://github.com/probml/colab_powertoys.git &> /dev/null 
!pip3 install nbimporter -qqq 
%cd -q /content/colab_powertoys 
from colab_powertoys.probml_toys import probml_toys as pmlt
%cd -q /pyprobml/scripts

pmlt.show_and_run("/pyprobml/scripts/iris_pca.py")<jupyter_output><empty_output><jupyter_text>Figure 1.10:     Examples of some control problems. (a) Space Invaders Atari game. From   https://gym.openai.com/envs/SpaceInvaders-v0/ . (b) Controlling a humanoid robot in the MuJuCo simulator so it walks as fast as possible without falling over. From   https://gym.openai.com/envs/Humanoid-v2/ .<jupyter_code>#@title Setup { display-mode: "form" }
%%time
# If you run this for the first time it would take ~25/30 seconds
!git clone https://github.com/probml/pyprobml /pyprobml &> /dev/null && git clone https://github.com/probml/colab_powertoys.git &> /dev/null 
!pip3 install nbimporter -qqq 
%cd -q /content/colab_powertoys 
from colab_powertoys.probml_toys import probml_toys as pmlt
%cd -q /pyprobml/scripts

pmlt.show_image("/pyprobml/book1/figures/images/Figure_1.10_A.png")
pmlt.show_image("/pyprobml/book1/figures/images/Figure_1.10_B.png")<jupyter_output><empty_output><jupyter_text>Figure 1.11:     The three types of machine learning visualized as layers of a chocolate cake. This figure (originally from   https://bit.ly/2m65Vs1 ) was used in a talk by <NAME> at NIPS'16, and is used with his kind permission.<jupyter_code>#@title Setup { display-mode: "form" }
%%time
# If you run this for the first time it would take ~25/30 seconds
!git clone https://github.com/probml/pyprobml /pyprobml &> /dev/null && git clone https://github.com/probml/colab_powertoys.git &> /dev/null 
!pip3 install nbimporter -qqq 
%cd -q /content/colab_powertoys 
from colab_powertoys.probml_toys import probml_toys as pmlt
%cd -q /pyprobml/scripts

pmlt.show_image("/pyprobml/book1/figures/images/Figure_1.11.png")<jupyter_output><empty_output><jupyter_text>Figure 1.12:     (a) Visualization of the first 25 digits from the  \bf MNIST  dataset [LeC+98],Yadav19 . Each image is $28 \times 28$. There are 60k training examples and 10k test examples.  Figure(s) generated by [mnist_viz_tf.py](https://github.com/probml/pyprobml/blob/master/scripts/mnist_viz_tf.py) [fashion_viz_tf.py](https://github.com/probml/pyprobml/blob/master/scripts/fashion_viz_tf.py)<jupyter_code>#@title Setup { display-mode: "form" }
%%time
# If you run this for the first time it would take ~25/30 seconds
!git clone https://github.com/probml/pyprobml /pyprobml &> /dev/null && git clone https://github.com/probml/colab_powertoys.git &> /dev/null 
!pip3 install nbimporter -qqq 
%cd -q /content/colab_powertoys 
from colab_powertoys.probml_toys import probml_toys as pmlt
%cd -q /pyprobml/scripts

pmlt.show_and_run("/pyprobml/scripts/mnist_viz_tf.py")
pmlt.show_and_run("/pyprobml/scripts/fashion_viz_tf.py")<jupyter_output><empty_output><jupyter_text>Figure 1.13:     Some images from the  \bf CIFAR-10  dataset [AG09] . Each image is $32 \times 32 \times 3$, where the final dimension of size 3 refers to RGB. There are 50k training examples and 10k test examples. There are 10 classes: plane, car, bird, cat, deer, dog, frog, horse, ship, and truck. We show the first 25 images from the training set.  Figure(s) generated by [cifar_viz_tf.py](https://github.com/probml/pyprobml/blob/master/scripts/cifar_viz_tf.py)<jupyter_code>#@title Setup { display-mode: "form" }
%%time
# If you run this for the first time it would take ~25/30 seconds
!git clone https://github.com/probml/pyprobml /pyprobml &> /dev/null && git clone https://github.com/probml/colab_powertoys.git &> /dev/null 
!pip3 install nbimporter -qqq 
%cd -q /content/colab_powertoys 
from colab_powertoys.probml_toys import probml_toys as pmlt
%cd -q /pyprobml/scripts

pmlt.show_and_run("/pyprobml/scripts/cifar_viz_tf.py")<jupyter_output><empty_output><jupyter_text>Figure 1.14:     (a) Sample images from the  \bf ImageNet  dataset [Rus+15] . This subset consists of 1.3M color training images, each of which is $256 \times 256$ pixels in size. There are 1000 possible labels, one per image, and the task is to minimize the top-5 error rate, i.e., to ensure the correct label is within the 5 most probable predictions. Below each image we show the true label, and a distribution over the top 5 predicted labels. If the true label is in the top 5, its probability bar is colored red. Predictions are generated by a convolutional neural network (CNN) called ``AlexNet'' (\cref  sec:alexNet ). From Figure 4 of [KSH12] . Used with kind permission of <NAME>. (b) Misclassification rate (top 5) on the ImageNet competition over time. Used with kind permission of <NAME>.<jupyter_code>#@title Setup { display-mode: "form" }
%%time
# If you run this for the first time it would take ~25/30 seconds
!git clone https://github.com/probml/pyprobml /pyprobml &> /dev/null && git clone https://github.com/probml/colab_powertoys.git &> /dev/null 
!pip3 install nbimporter -qqq 
%cd -q /content/colab_powertoys 
from colab_powertoys.probml_toys import probml_toys as pmlt
%cd -q /pyprobml/scripts

pmlt.show_image("/pyprobml/book1/figures/images/Figure_1.14_A.png")
pmlt.show_image("/pyprobml/book1/figures/images/Figure_1.14_B.png")<jupyter_output><empty_output><jupyter_text>Figure 1.15:     Example of a term-document matrix, where raw counts have been replaced by their TF-IDF values (see \cref  sec:tfidf ). Darker cells are larger values. From   https://bit.ly/2kByLQI . Used with kind permission of <NAME>.<jupyter_code>#@title Setup { display-mode: "form" }
%%time
# If you run this for the first time it would take ~25/30 seconds
!git clone https://github.com/probml/pyprobml /pyprobml &> /dev/null && git clone https://github.com/probml/colab_powertoys.git &> /dev/null 
!pip3 install nbimporter -qqq 
%cd -q /content/colab_powertoys 
from colab_powertoys.probml_toys import probml_toys as pmlt
%cd -q /pyprobml/scripts

pmlt.show_image("/pyprobml/book1/figures/images/Figure_1.15.png")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1101371412413403, 'fraction_numerical': 0.01845044535557755, 'mean_word_length': 4.661064425770308, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 97, 'https://': 43, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '15', 'dir': 'jupyter-structured-clean-dedup', 'id': '100882', 'license': 'MIT', 'n_tokens_mistral': 5185, 'n_tokens_neox': 4970, 'n_words': 1455, 'path': 'book1/figures/chapter1_introduction_figures.ipynb', 'repo_name': 'shivaditya-meduri/pyprobml', 'size': '14196'}