The response has been limited to 50k tokens of the smallest files in the repo. You can remove this limitation by removing the max tokens filter.
├── .gitignore
├── README.rst
├── _img
    ├── SUBSCRIBE.mp4
    ├── deeplearning.png
    ├── deeplearningcoversmall.png
    ├── deeplearningresource.png
    ├── intro.png
    ├── pythonml.png
    ├── ss.png
    ├── subscribe.gif
    ├── subscribe.png
    ├── subscribeBIG.gif
    ├── supervised.gif
    ├── teaser.gif
    ├── unsupervised.gif
    └── unsupervised.png
├── code
    ├── deep_learning
    │   ├── autoencoder
    │   │   └── ae.py
    │   ├── cnn
    │   │   ├── code
    │   │   │   ├── __init__.py
    │   │   │   ├── auxiliary
    │   │   │   │   ├── __init__.py
    │   │   │   │   ├── progress_bar.py
    │   │   │   │   └── progress_bar.py~
    │   │   │   ├── evaluation.sh
    │   │   │   ├── input_function
    │   │   │   │   ├── __init__.py
    │   │   │   │   └── input.py
    │   │   │   ├── net_structure
    │   │   │   │   ├── __init__.py
    │   │   │   │   └── net.py
    │   │   │   ├── script
    │   │   │   │   ├── evaluation.sh
    │   │   │   │   └── train.sh
    │   │   │   ├── test_classifier.py
    │   │   │   ├── train.sh
    │   │   │   ├── train_classifier.py
    │   │   │   └── train_evaluation.py
    │   │   ├── readme.rst
    │   │   └── requirements.txt
    │   ├── mlp
    │   │   ├── code
    │   │   │   ├── evaluation.sh
    │   │   │   ├── test_classifier.py
    │   │   │   ├── train.sh
    │   │   │   ├── train_mlp.ipynb
    │   │   │   └── train_mlp.py
    │   │   └── readme.rst
    │   └── rnn
    │   │   └── rnn.py
    ├── overview
    │   ├── cross-validation
    │   │   ├── holdout.py
    │   │   ├── k-fold.py
    │   │   └── leave-p-out.py
    │   ├── linear_regression
    │   │   ├── exponential_regression.py
    │   │   ├── exponential_regression_transformed.py
    │   │   ├── linearRegressionOneVariable.ipynb
    │   │   ├── linear_regression.py
    │   │   ├── linear_regression_cost.py
    │   │   ├── linear_regression_lobf.py
    │   │   └── not_linear_regression.py
    │   ├── overfitting
    │   │   └── overfitting.py
    │   └── regularization
    │   │   ├── regularization_lasso.py
    │   │   ├── regularization_linear.py
    │   │   ├── regularization_polynomial.py
    │   │   ├── regularization_quadratic.py
    │   │   └── regularization_ridge.py
    ├── supervised
    │   ├── DecisionTree
    │   │   └── decisiontrees.py
    │   ├── KNN
    │   │   └── knn.py
    │   ├── Linear_SVM
    │   │   └── linear_svm.py
    │   ├── Logistic_Regression
    │   │   └── logistic_ex1.py
    │   └── Naive_Bayes
    │   │   ├── bell_curve.py
    │   │   ├── bernoulli.py
    │   │   ├── gaussian.py
    │   │   └── multinomial.py
    └── unsupervised
    │   ├── Clustering
    │       ├── clustering_hierarchical.py
    │       └── clustering_kmeans.py
    │   └── PCA
    │       └── pca.py
└── docs
    ├── Makefile
    ├── build
        ├── doctrees
        │   ├── authorship
        │   │   └── author.doctree
        │   ├── content
        │   │   ├── deep_learning
        │   │   │   ├── autoencoder.doctree
        │   │   │   ├── cnn.doctree
        │   │   │   └── mlp.doctree
        │   │   ├── overview
        │   │   │   ├── crossvalidation.doctree
        │   │   │   ├── linear-regression.doctree
        │   │   │   ├── overfitting.doctree
        │   │   │   └── regularization.doctree
        │   │   ├── supervised
        │   │   │   ├── bayes.doctree
        │   │   │   ├── decisiontrees.doctree
        │   │   │   ├── knn.doctree
        │   │   │   ├── linear_SVM.doctree
        │   │   │   └── logistic_regression.doctree
        │   │   └── unsupervised
        │   │   │   ├── clustering.doctree
        │   │   │   └── pca.doctree
        │   ├── credentials
        │   │   ├── CODE_OF_CONDUCT.doctree
        │   │   ├── CONTRIBUTING.doctree
        │   │   └── LICENSE.doctree
        │   ├── environment.pickle
        │   ├── index.doctree
        │   └── intro
        │   │   └── intro.doctree
        └── html
        │   ├── .buildinfo
        │   ├── _images
        │       ├── Bayes.png
        │       ├── Bell_Curve.png
        │       ├── Convo_Output.png
        │       ├── Cost.png
        │       ├── Data_Set.png
        │       ├── Dec_Trees_Pruning.png
        │       ├── Error_Function.png
        │       ├── Exponential.png
        │       ├── Exponential_Transformed.png
        │       ├── Filter1.png
        │       ├── Filter2.png
        │       ├── Filter3.png
        │       ├── Filtering.png
        │       ├── Flatten.png
        │       ├── Gini_1.png
        │       ├── Gini_2.png
        │       ├── Gini_3.png
        │       ├── Gini_4.png
        │       ├── Gini_5.png
        │       ├── Gini_6.png
        │       ├── Gini_7.png
        │       ├── Gini_8.png
        │       ├── Gini_Impurity.png
        │       ├── Gini_Information_Gain.png
        │       ├── GoodFit.PNG
        │       ├── Hierarchical.png
        │       ├── Hierarchical_Step1.png
        │       ├── Hierarchical_Step2.png
        │       ├── Images.png
        │       ├── KMeans.png
        │       ├── KNN_KDTree.jpg
        │       ├── K_Means_Final.png
        │       ├── K_Means_Final_Alt.png
        │       ├── K_Means_Step2.png
        │       ├── K_Means_Step3.png
        │       ├── LOOCV.png
        │       ├── LPOCV.png
        │       ├── LR.png
        │       ├── LR_LOBF.png
        │       ├── Layers.png
        │       ├── Layers_Final.png
        │       ├── Linear_Equation.png
        │       ├── MLP_0.PNG
        │       ├── MLP_1.PNG
        │       ├── MLP_2.PNG
        │       ├── MSE_Function.png
        │       ├── Not_Linear.png
        │       ├── Overfit_small.png
        │       ├── Padding.png
        │       ├── Pooled.png
        │       ├── Possible_hyperplane.png
        │       ├── Regularization_Lasso.png
        │       ├── Regularization_Linear.png
        │       ├── Regularization_Polynomial.png
        │       ├── Regularization_Quadratic.png
        │       ├── Regularization_Ridge.png
        │       ├── SVM_Kernal.png
        │       ├── SVM_Kernel2.png
        │       ├── SVM_Outliers.png
        │       ├── Square_Error_Function.png
        │       ├── Underfit.PNG
        │       ├── WikiLogistic.svg.png
        │       ├── WikiLogisticEQ.svg
        │       ├── ae.png
        │       ├── decision_tree_1.png
        │       ├── decision_tree_2.png
        │       ├── decision_tree_3.png
        │       ├── decision_tree_4.png
        │       ├── holdout.png
        │       ├── kfold.png
        │       ├── knn.png
        │       ├── knn_output_k1.png
        │       ├── knn_output_k9.png
        │       ├── latex-lasso-eq.gif
        │       ├── latex-ridge-eq.gif
        │       ├── linear_svm_output.png
        │       ├── optimal_hyperplane.png
        │       ├── pca1.png
        │       ├── pca2.png
        │       ├── pca3.png
        │       ├── pca4.png
        │       ├── pca5.png
        │       ├── pca6.png
        │       └── shopping_table.png
        │   ├── _sources
        │       ├── authorship
        │       │   └── author.rst.txt
        │       ├── content
        │       │   ├── deep_learning
        │       │   │   ├── autoencoder.rst.txt
        │       │   │   ├── cnn.rst.txt
        │       │   │   └── mlp.rst.txt
        │       │   ├── overview
        │       │   │   ├── crossvalidation.rst.txt
        │       │   │   ├── linear-regression.rst.txt
        │       │   │   ├── overfitting.rst.txt
        │       │   │   └── regularization.rst.txt
        │       │   ├── supervised
        │       │   │   ├── bayes.rst.txt
        │       │   │   ├── decisiontrees.rst.txt
        │       │   │   ├── knn.rst.txt
        │       │   │   ├── linear_SVM.rst.txt
        │       │   │   └── logistic_regression.rst.txt
        │       │   └── unsupervised
        │       │   │   ├── clustering.rst.txt
        │       │   │   └── pca.rst.txt
        │       ├── credentials
        │       │   ├── CODE_OF_CONDUCT.rst.txt
        │       │   ├── CONTRIBUTING.rst.txt
        │       │   └── LICENSE.rst.txt
        │       ├── index.rst.txt
        │       └── intro
        │       │   └── intro.rst.txt
        │   ├── _static
        │       ├── ajax-loader.gif
        │       ├── basic.css
        │       ├── comment-bright.png
        │       ├── comment-close.png
        │       ├── comment.png
        │       ├── css
        │       │   ├── badge_only.css
        │       │   └── theme.css
        │       ├── doctools.js
        │       ├── documentation_options.js
        │       ├── down-pressed.png
        │       ├── down.png
        │       ├── file.png
        │       ├── fonts
        │       │   ├── Inconsolata-Bold.ttf
        │       │   ├── Inconsolata-Regular.ttf
        │       │   ├── Inconsolata.ttf
        │       │   ├── Lato-Bold.ttf
        │       │   ├── Lato-Regular.ttf
        │       │   ├── Lato
        │       │   │   ├── lato-bold.eot
        │       │   │   ├── lato-bold.ttf
        │       │   │   ├── lato-bold.woff
        │       │   │   ├── lato-bold.woff2
        │       │   │   ├── lato-bolditalic.eot
        │       │   │   ├── lato-bolditalic.ttf
        │       │   │   ├── lato-bolditalic.woff
        │       │   │   ├── lato-bolditalic.woff2
        │       │   │   ├── lato-italic.eot
        │       │   │   ├── lato-italic.ttf
        │       │   │   ├── lato-italic.woff
        │       │   │   ├── lato-italic.woff2
        │       │   │   ├── lato-regular.eot
        │       │   │   ├── lato-regular.ttf
        │       │   │   ├── lato-regular.woff
        │       │   │   └── lato-regular.woff2
        │       │   ├── RobotoSlab-Bold.ttf
        │       │   ├── RobotoSlab-Regular.ttf
        │       │   ├── RobotoSlab
        │       │   │   ├── roboto-slab-v7-bold.eot
        │       │   │   ├── roboto-slab-v7-bold.ttf
        │       │   │   ├── roboto-slab-v7-bold.woff
        │       │   │   ├── roboto-slab-v7-bold.woff2
        │       │   │   ├── roboto-slab-v7-regular.eot
        │       │   │   ├── roboto-slab-v7-regular.ttf
        │       │   │   ├── roboto-slab-v7-regular.woff
        │       │   │   └── roboto-slab-v7-regular.woff2
        │       │   ├── fontawesome-webfont.eot
        │       │   ├── fontawesome-webfont.svg
        │       │   ├── fontawesome-webfont.ttf
        │       │   ├── fontawesome-webfont.woff
        │       │   └── fontawesome-webfont.woff2
        │       ├── jquery-3.2.1.js
        │       ├── jquery.js
        │       ├── js
        │       │   ├── modernizr.min.js
        │       │   └── theme.js
        │       ├── language_data.js
        │       ├── minus.png
        │       ├── plus.png
        │       ├── pygments.css
        │       ├── pythonml.png
        │       ├── searchtools.js
        │       ├── underscore-1.3.1.js
        │       ├── underscore.js
        │       ├── up-pressed.png
        │       ├── up.png
        │       └── websupport.js
        │   ├── authorship
        │       └── author.html
        │   ├── content
        │       ├── deep_learning
        │       │   ├── autoencoder.html
        │       │   ├── cnn.html
        │       │   └── mlp.html
        │       ├── overview
        │       │   ├── crossvalidation.html
        │       │   ├── linear-regression.html
        │       │   ├── overfitting.html
        │       │   └── regularization.html
        │       ├── supervised
        │       │   ├── bayes.html
        │       │   ├── decisiontrees.html
        │       │   ├── knn.html
        │       │   ├── linear_SVM.html
        │       │   └── logistic_regression.html
        │       └── unsupervised
        │       │   ├── clustering.html
        │       │   └── pca.html
        │   ├── credentials
        │       ├── CODE_OF_CONDUCT.html
        │       ├── CONTRIBUTING.html
        │       └── LICENSE.html
        │   ├── genindex.html
        │   ├── index.html
        │   ├── intro
        │       └── intro.html
        │   ├── objects.inv
        │   ├── search.html
        │   └── searchindex.js
    ├── make.bat
    └── source
        ├── authorship
            └── author.rst
        ├── conf.py
        ├── content
            ├── deep_learning
            │   ├── _img
            │   │   ├── Convo_Output.png
            │   │   ├── Filter1.png
            │   │   ├── Filter2.png
            │   │   ├── Filter3.png
            │   │   ├── Filtering.png
            │   │   ├── Flatten.png
            │   │   ├── Images.png
            │   │   ├── Layers.png
            │   │   ├── Layers_Final.png
            │   │   ├── MLP_0.PNG
            │   │   ├── MLP_1.PNG
            │   │   ├── MLP_2.PNG
            │   │   ├── MLP_Node.PNG
            │   │   ├── Padding.png
            │   │   ├── Pooled.png
            │   │   └── ae.png
            │   ├── autoencoder.rst
            │   ├── cnn.rst
            │   └── mlp.rst
            ├── overview
            │   ├── _img
            │   │   ├── Cost.png
            │   │   ├── Error_Function.png
            │   │   ├── Exponential.png
            │   │   ├── Exponential_Transformed.png
            │   │   ├── GoodFit.PNG
            │   │   ├── LOOCV.png
            │   │   ├── LPOCV.png
            │   │   ├── LR.png
            │   │   ├── LR_LOBF.png
            │   │   ├── Linear_Equation.png
            │   │   ├── MSE_Function.png
            │   │   ├── Not_Linear.png
            │   │   ├── Optimal_hyperplane.PNG
            │   │   ├── Overfit.PNG
            │   │   ├── Overfit_small.png
            │   │   ├── Possible_hyperplane.png
            │   │   ├── Regularization_Lasso.png
            │   │   ├── Regularization_Linear.png
            │   │   ├── Regularization_Polynomial.png
            │   │   ├── Regularization_Quadratic.png
            │   │   ├── Regularization_Ridge.png
            │   │   ├── SVM_Kernal.png
            │   │   ├── SVM_Outliers.png
            │   │   ├── Square_Error_Function.png
            │   │   ├── Underfit.PNG
            │   │   ├── holdout.png
            │   │   ├── kfold.png
            │   │   ├── latex-lasso-eq.gif
            │   │   └── latex-ridge-eq.gif
            │   ├── crossvalidation.rst
            │   ├── linear-regression.rst
            │   ├── overfitting.rst
            │   └── regularization.rst
            ├── supervised
            │   ├── _img
            │   │   ├── Bayes.png
            │   │   ├── Bell_Curve.png
            │   │   ├── Dec_Trees_Pruning.png
            │   │   ├── Gini_1.png
            │   │   ├── Gini_2.png
            │   │   ├── Gini_3.png
            │   │   ├── Gini_4.png
            │   │   ├── Gini_5.png
            │   │   ├── Gini_6.png
            │   │   ├── Gini_7.png
            │   │   ├── Gini_8.png
            │   │   ├── Gini_Impurity.png
            │   │   ├── Gini_Information_Gain.png
            │   │   ├── KNN_KDTree.jpg
            │   │   ├── LOOCV.png
            │   │   ├── LPOCV.png
            │   │   ├── Logistic_Eq.svg
            │   │   ├── Possible_hyperplane.png
            │   │   ├── Regularization_Base.png
            │   │   ├── Regularization_Lasso.png
            │   │   ├── Regularization_Linear.png
            │   │   ├── Regularization_Polynomial.png
            │   │   ├── Regularization_Quadratic.png
            │   │   ├── Regularization_Ridge.png
            │   │   ├── SVM_Kernal.png
            │   │   ├── SVM_Kernel2.png
            │   │   ├── SVM_Outliers.png
            │   │   ├── WikiLogistic.svg.png
            │   │   ├── WikiLogisticEQ.svg
            │   │   ├── dec_trees_eq1.png
            │   │   ├── decision_tree_1.png
            │   │   ├── decision_tree_2.png
            │   │   ├── decision_tree_3.png
            │   │   ├── decision_tree_4.png
            │   │   ├── holdout.png
            │   │   ├── kfold.png
            │   │   ├── knn.png
            │   │   ├── knn_output_k1.png
            │   │   ├── knn_output_k9.png
            │   │   ├── latex-lasso-eq.gif
            │   │   ├── latex-ridge-eq.gif
            │   │   ├── linear_svm_output.png
            │   │   ├── optimal_hyperplane.png
            │   │   └── shopping_table.png
            │   ├── bayes.rst
            │   ├── decisiontrees.rst
            │   ├── knn.rst
            │   ├── linear_SVM.rst
            │   └── logistic_regression.rst
            └── unsupervised
            │   ├── _img
            │       ├── Data_Set.png
            │       ├── Hierarchical.png
            │       ├── Hierarchical_Step1.png
            │       ├── Hierarchical_Step2.png
            │       ├── KMeans.png
            │       ├── K_Means_Final.png
            │       ├── K_Means_Final_Alt.png
            │       ├── K_Means_Step2.png
            │       ├── K_Means_Step3.png
            │       ├── pca1.png
            │       ├── pca2.png
            │       ├── pca3.png
            │       ├── pca4.png
            │       ├── pca5.png
            │       └── pca6.png
            │   ├── clustering.rst
            │   └── pca.rst
        ├── credentials
            ├── CODE_OF_CONDUCT.rst
            ├── CONTRIBUTING.rst
            └── LICENSE.rst
        ├── index.rst
        ├── intro
            └── intro.rst
        └── logo
            ├── logo.png
            ├── pythonml.pdf
            └── pythonml.png


/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .vs
3 | 


--------------------------------------------------------------------------------
/_img/SUBSCRIBE.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/_img/SUBSCRIBE.mp4


--------------------------------------------------------------------------------
/_img/deeplearning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/_img/deeplearning.png


--------------------------------------------------------------------------------
/_img/deeplearningcoversmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/_img/deeplearningcoversmall.png


--------------------------------------------------------------------------------
/_img/deeplearningresource.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/_img/deeplearningresource.png


--------------------------------------------------------------------------------
/_img/intro.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/_img/intro.png


--------------------------------------------------------------------------------
/_img/pythonml.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/_img/pythonml.png


--------------------------------------------------------------------------------
/_img/ss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/_img/ss.png


--------------------------------------------------------------------------------
/_img/subscribe.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/_img/subscribe.gif


--------------------------------------------------------------------------------
/_img/subscribe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/_img/subscribe.png


--------------------------------------------------------------------------------
/_img/subscribeBIG.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/_img/subscribeBIG.gif


--------------------------------------------------------------------------------
/_img/supervised.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/_img/supervised.gif


--------------------------------------------------------------------------------
/_img/teaser.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/_img/teaser.gif


--------------------------------------------------------------------------------
/_img/unsupervised.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/_img/unsupervised.gif


--------------------------------------------------------------------------------
/_img/unsupervised.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/_img/unsupervised.png


--------------------------------------------------------------------------------
/code/deep_learning/autoencoder/ae.py:
--------------------------------------------------------------------------------
 1 | # An undercomplete autoencoder on MNIST dataset
 2 | from __future__ import division, print_function, absolute_import
 3 | import tensorflow.contrib.layers as lays
 4 | 
 5 | import tensorflow as tf
 6 | import numpy as np
 7 | import matplotlib.pyplot as plt
 8 | from skimage import transform
 9 | from tensorflow.examples.tutorials.mnist import input_data
10 | 
11 | batch_size = 500  # Number of samples in each batch
12 | epoch_num = 5     # Number of epochs to train the network
13 | lr = 0.001        # Learning rate
14 | 
15 | 
16 | def resize_batch(imgs):
17 |     # A function to resize a batch of MNIST images to (32, 32)
18 |     # Args:
19 |     #   imgs: a numpy array of size [batch_size, 28 X 28].
20 |     # Returns:
21 |     #   a numpy array of size [batch_size, 32, 32].
22 |     imgs = imgs.reshape((-1, 28, 28, 1))
23 |     resized_imgs = np.zeros((imgs.shape[0], 32, 32, 1))
24 |     for i in range(imgs.shape[0]):
25 |         resized_imgs[i, ..., 0] = transform.resize(imgs[i, ..., 0], (32, 32))
26 |     return resized_imgs
27 | 
28 | 
29 | def autoencoder(inputs):
30 |     # encoder
31 |     # 32 x 32 x 1   ->  16 x 16 x 32
32 |     # 16 x 16 x 32  ->  8 x 8 x 16
33 |     # 8 x 8 x 16    ->  2 x 2 x 8
34 |     net = lays.conv2d(inputs, 32, [5, 5], stride=2, padding='SAME')
35 |     net = lays.conv2d(net, 16, [5, 5], stride=2, padding='SAME')
36 |     net = lays.conv2d(net, 8, [5, 5], stride=4, padding='SAME')
37 |     # decoder
38 |     # 2 x 2 x 8    ->  8 x 8 x 16
39 |     # 8 x 8 x 16   ->  16 x 16 x 32
40 |     # 16 x 16 x 32  ->  32 x 32 x 1
41 |     net = lays.conv2d_transpose(net, 16, [5, 5], stride=4, padding='SAME')
42 |     net = lays.conv2d_transpose(net, 32, [5, 5], stride=2, padding='SAME')
43 |     net = lays.conv2d_transpose(net, 1, [5, 5], stride=2, padding='SAME', activation_fn=tf.nn.tanh)
44 |     return net
45 | 
46 | # read MNIST dataset
47 | mnist = input_data.read_data_sets("MNIST_data", one_hot=True)
48 | 
49 | # calculate the number of batches per epoch
50 | batch_per_ep = mnist.train.num_examples // batch_size
51 | 
52 | ae_inputs = tf.placeholder(tf.float32, (None, 32, 32, 1))  # input to the network (MNIST images)
53 | ae_outputs = autoencoder(ae_inputs)  # create the Autoencoder network
54 | 
55 | # calculate the loss and optimize the network
56 | loss = tf.reduce_mean(tf.square(ae_outputs - ae_inputs))  # claculate the mean square error loss
57 | train_op = tf.train.AdamOptimizer(learning_rate=lr).minimize(loss)
58 | 
59 | # initialize the network
60 | init = tf.global_variables_initializer()
61 | 
62 | with tf.Session() as sess:
63 |     sess.run(init)
64 |     for ep in range(epoch_num):  # epochs loop
65 |         for batch_n in range(batch_per_ep):  # batches loop
66 |             batch_img, batch_label = mnist.train.next_batch(batch_size)  # read a batch
67 |             batch_img = batch_img.reshape((-1, 28, 28, 1))               # reshape each sample to an (28, 28) image
68 |             batch_img = resize_batch(batch_img)                          # reshape the images to (32, 32)
69 |             _, c = sess.run([train_op, loss], feed_dict={ae_inputs: batch_img})
70 |             print('Epoch: {} - cost= {:.5f}'.format((ep + 1), c))
71 | 
72 |     # test the trained network
73 |     batch_img, batch_label = mnist.test.next_batch(50)
74 |     batch_img = resize_batch(batch_img)
75 |     recon_img = sess.run([ae_outputs], feed_dict={ae_inputs: batch_img})[0]
76 | 
77 |     # plot the reconstructed images and their ground truths (inputs)
78 |     plt.figure(1)
79 |     plt.title('Reconstructed Images')
80 |     for i in range(50):
81 |         plt.subplot(5, 10, i+1)
82 |         plt.imshow(recon_img[i, ..., 0], cmap='gray')
83 | 
84 |     plt.figure(2)
85 |     plt.title('Input Images')
86 |     for i in range(50):
87 |         plt.subplot(5, 10, i+1)
88 |         plt.imshow(batch_img[i, ..., 0], cmap='gray')
89 |     plt.show()
90 | 
91 | 
92 | 


--------------------------------------------------------------------------------
/code/deep_learning/cnn/code/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/code/deep_learning/cnn/code/__init__.py


--------------------------------------------------------------------------------
/code/deep_learning/cnn/code/auxiliary/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/code/deep_learning/cnn/code/auxiliary/__init__.py


--------------------------------------------------------------------------------
/code/deep_learning/cnn/code/auxiliary/progress_bar.py:
--------------------------------------------------------------------------------
 1 | import sys
 2 | 
 3 | 
 4 | def print_progress(progress, epoch_num, loss):
 5 |     """
 6 |     This function draw an active progress bar.
 7 |     :param progress: Where we are:
 8 |                        type: float
 9 |                        value: [0,1]
10 |     :param epoch_num: number of epochs for training
11 |     :param loss: The loss for the specific batch in training phase.
12 | 
13 |     :return: Progressing bar
14 |     """
15 | 
16 |     # Define the length of bar
17 |     barLength = 30
18 | 
19 |     # Ceck the input!
20 |     assert type(progress) is float, "id is not a float: %r" % id
21 |     assert 0 <= progress <= 1, "variable should be between zero and one!"
22 | 
23 |     # Empty status while processing.
24 |     status = ""
25 | 
26 |     # This part is to make a new line when the process is finished.
27 |     if progress >= 1:
28 |         progress = 1
29 |         status = "\r\n"
30 | 
31 |     # Where we are in the progress!
32 |     indicator = int(round(barLength*progress))
33 | 
34 |     # Print the appropriate progress phase!
35 |     list = [str(epoch_num), "#"*indicator , "-"*(barLength-indicator), progress*100, loss, status]
36 |     text = "\rEpoch {0[0]} {0[1]} {0[2]} %{0[3]:.2f} loss={0[4]:.3f} {0[5]}".format(list)
37 |     sys.stdout.write(text)
38 |     sys.stdout.flush()
39 | 


--------------------------------------------------------------------------------
/code/deep_learning/cnn/code/auxiliary/progress_bar.py~:
--------------------------------------------------------------------------------
 1 | import sys
 2 | 
 3 | 
 4 | def print_progress(progress, epoch_num, loss):
 5 |     """
 6 |     This function draw an active progress bar.
 7 |     :param progress: Where we are:
 8 |                        type: float
 9 |                        value: [0,1]
10 |     :param epoch_num: number of epochs for training
11 |     :param loss: The loss for the specific batch in training phase.
12 | 
13 |     :return: Progressing bar
14 |     """
15 | 
16 |     # Define the length of bar
17 |     barLength = 30
18 | 
19 |     # Ceck the input!
20 |     assert type(progress) is float, "id is not a float: %r" % id
21 |     assert 0 <= progress <= 1, "variable should be between zero and one!"
22 | 
23 |     # Empty status while processing.
24 |     status = ""
25 | 
26 |     # This part is to make a new line when the process is finished.
27 |     if progress >= 1:
28 |         progress = 1
29 |         status = "\r\n"
30 | 
31 |     # Where we are in the progress!
32 |     indicator = int(round(barLength*progress))
33 | 
34 |     # Print the appropriate progress phase!
35 |     list = [str(epoch_num), "#"*indicator , "-"*(barLength-indicator), progress*100, loss, status]
36 |     text = "\rEpoch {0[0]} {0[1]} {0[2]} %{0[3]:.2f} loss={0[4]:.3f} {0[5]}".format(list)
37 |     sys.stdout.write(text)
38 |     sys.stdout.flush()
39 | 


--------------------------------------------------------------------------------
/code/deep_learning/cnn/code/evaluation.sh:
--------------------------------------------------------------------------------
1 | 
2 | # Run training.
3 | python test_classifier.py \
4 |   --batch_size=512 \
5 |   --allow_soft_placement
6 | 
7 | 


--------------------------------------------------------------------------------
/code/deep_learning/cnn/code/input_function/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/code/deep_learning/cnn/code/input_function/__init__.py


--------------------------------------------------------------------------------
/code/deep_learning/cnn/code/input_function/input.py:
--------------------------------------------------------------------------------
  1 | import numpy as np
  2 | import collections
  3 | 
  4 | 
  5 | class DATA_OBJECT(object):
  6 |     def __init__(self,
  7 |                  images,
  8 |                  labels,
  9 |                  num_classes=0,
 10 |                  one_hot=False,
 11 |                  dtype=np.float32,
 12 |                  reshape=False):
 13 |         """Data object construction.
 14 |          images: The images of size [num_samples, rows, columns, depth].
 15 |          labels: The labels of size [num_samples,]
 16 |          num_classes: The number of classes in case one_hot labeling is desired.
 17 |          one_hot=False: Turn the labels into one_hot format.
 18 |          dtype=np.float32: The data type.
 19 |          reshape=False: Reshape in case the feature vector extraction is desired.
 20 | 
 21 |         """
 22 |         # Define the date type.
 23 |         if dtype not in (np.uint8, np.float32):
 24 |             raise TypeError('Invalid image dtype %r, expected uint8 or float32' %
 25 |                             dtype)
 26 |         assert images.shape[0] == labels.shape[0], (
 27 |             'images.shape: %s labels.shape: %s' % (images.shape, labels.shape))
 28 |         self._num_samples = images.shape[0]
 29 | 
 30 |         # [num_examples, rows, columns, depth] -> [num_examples, rows*columns]
 31 |         if reshape:
 32 |             assert images.shape[3] == 1
 33 |             images = images.reshape(images.shape[0],
 34 |                                     images.shape[1] * images.shape[2])
 35 | 
 36 |         # Conver to float if necessary
 37 |         if dtype == np.float32:
 38 |             # Convert from [0, 255] -> [0.0, 1.0].
 39 |             images = images.astype(dtype)
 40 |             images = np.multiply(images, 1.0 / 255.0)
 41 |         self._images = images
 42 |         self._labels = labels
 43 | 
 44 |         # If the one_hot flag is true, then the one_hot labeling supersedes the normal labeling.
 45 |         if one_hot:
 46 |             # If the one_hot labeling is desired, number of classes must be defined as one of the arguments of DATA_OBJECT class!
 47 |             assert num_classes != 0, (
 48 |                 'You must specify the num_classes in the DATA_OBJECT for one_hot label construction!')
 49 | 
 50 |             # Define the indexes.
 51 |             index = np.arange(self._num_samples) * num_classes
 52 |             one_hot_labels = np.zeros((self._num_samples, num_classes))
 53 |             one_hot_labels.flat[index + labels.ravel()] = 1
 54 |             self._labels = one_hot_labels
 55 | 
 56 |     @property
 57 |     def images(self):
 58 |         return self._images
 59 | 
 60 |     @property
 61 |     def labels(self):
 62 |         return self._labels
 63 | 
 64 |     @property
 65 |     def num_samples(self):
 66 |         return self._num_samples
 67 | 
 68 | 
 69 | def provide_data(mnist):
 70 |     """
 71 |     This function provide data object with desired shape.
 72 |     The attribute of data object:
 73 |         - train
 74 |         - validation
 75 |         - test
 76 |     The sub attributs of the data object attributes:
 77 |         -images
 78 |         -labels
 79 | 
 80 |     :param mnist: The downloaded MNIST dataset
 81 |     :return: data: The data object.
 82 |                    ex: data.train.images return the images of the dataset object in the training set!
 83 | 
 84 | 
 85 |     """
 86 |     ################################################
 87 |     ########## Get the images and labels############
 88 |     ################################################
 89 | 
 90 |     # Note: This setup is specific to mnist data but can be generalized for any data.
 91 |     # The ?_images(? can be train, validation or test) must have the format of [num_samples, rows, columns, depth] after extraction from data.
 92 |     # The ?_labels(? can be train, validation or test) must have the format of [num_samples,] after extraction from data.
 93 |     train_images = mnist.train.images
 94 |     train_labels = mnist.train.labels
 95 |     validation_images = mnist.validation.images
 96 |     validation_labels = mnist.validation.labels
 97 |     test_images = mnist.test.images
 98 |     test_labels = mnist.test.labels
 99 | 
100 |     # Create separate objects for train, validation & test.
101 |     train = DATA_OBJECT(train_images, train_labels, num_classes=10, one_hot=True, dtype=np.float32, reshape=False)
102 |     validation = DATA_OBJECT(validation_images, validation_labels, num_classes=10, one_hot=True, dtype=np.float32,
103 |                              reshape=False)
104 |     test = DATA_OBJECT(test_images, test_labels, num_classes=10, one_hot=True, dtype=np.float32, reshape=False)
105 | 
106 |     # Create the whole data object
107 |     DataSetObject = collections.namedtuple('DataSetObject', ['train', 'validation', 'test'])
108 |     data = DataSetObject(train=train, validation=validation, test=test)
109 | 
110 |     return data
111 | 


--------------------------------------------------------------------------------
/code/deep_learning/cnn/code/net_structure/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/code/deep_learning/cnn/code/net_structure/__init__.py


--------------------------------------------------------------------------------
/code/deep_learning/cnn/code/net_structure/net.py:
--------------------------------------------------------------------------------
 1 | #####################################
 2 | # With some tiny modification, this code is the one used by Tensorflow slim at:
 3 | # https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/slim
 4 | # Please refer to the link for further explanations.
 5 | 
 6 | ### The difference is this architecture is written in fully-convolutional fashion.
 7 | ### The advantage is that, this model can be used for larger image sizes with some average pooling in the last layer.
 8 | 
 9 | import tensorflow as tf
10 | 
11 | slim = tf.contrib.slim
12 | 
13 | 
14 | def net_architecture(images, num_classes=10, is_training=False,
15 |                      dropout_keep_prob=0.5,
16 |                      spatial_squeeze=True,
17 |                      scope='Net'):
18 |     """Creates a variant of the Net model.
19 | 
20 |     Args:
21 |       images: The batch of `Tensors`: size [batch_size, height, width, channels].
22 |       num_classes: Total number of classes.
23 |       is_training: Training/Validation.
24 |       dropout_keep_prob: The percentage of activation values: Only active in training mode!
25 |       scope: Variable_scope.
26 | 
27 |     Returns:
28 |       logits: the pre-softmax activations of size [batch_size, `num_classes`]
29 |       end_points: The dictionary for the layers outputs.
30 |     """
31 | 
32 |     # Create empty dictionary
33 |     end_points = {}
34 | 
35 |     with tf.variable_scope(scope, 'Net', [images, num_classes]) as sc:
36 |         end_points_collection = sc.name + '_end_points'
37 | 
38 |         # Collect outputs for conv2d and max_pool2d.
39 |         with tf.contrib.framework.arg_scope([tf.contrib.layers.conv2d, tf.contrib.layers.max_pool2d],
40 |                                             outputs_collections=end_points_collection):
41 |             # Layer-1
42 |             net = tf.contrib.layers.conv2d(images, 32, [5, 5], scope='conv1')
43 |             net = tf.contrib.layers.max_pool2d(net, [2, 2], 2, scope='pool1')
44 | 
45 |             # Layer-2
46 |             net = tf.contrib.layers.conv2d(net, 64, [5, 5], scope='conv2')
47 |             net = tf.contrib.layers.max_pool2d(net, [2, 2], 2, scope='pool2')
48 | 
49 |             # Layer-3
50 |             net = tf.contrib.layers.conv2d(net, 1024, [7, 7], padding='VALID', scope='fc3')
51 |             net = tf.contrib.layers.dropout(net, dropout_keep_prob, is_training=is_training,
52 |                                             scope='dropout3')
53 | 
54 |             # Last layer which is the logits for classes
55 |             logits = tf.contrib.layers.conv2d(net, num_classes, [1, 1], activation_fn=None, scope='fc4')
56 | 
57 |             # Return the collections as a dictionary
58 |             end_points = slim.utils.convert_collection_to_dict(end_points_collection)
59 | 
60 |             # Squeeze spatially to eliminate extra dimensions.(embedding layer)
61 |             if spatial_squeeze:
62 |                 logits = tf.squeeze(logits, [1, 2], name='fc4/squeezed')
63 |                 end_points[sc.name + '/fc4'] = logits
64 |             return logits, end_points
65 | 
66 | 
67 | def net_arg_scope(weight_decay=0.0005, is_training=False):
68 |     """Defines the default network argument scope.
69 | 
70 |     Args:
71 |       weight_decay: The weight decay to use for regularizing the model.
72 | 
73 |     Returns:
74 |       An `arg_scope` to use for the model.
75 |     """
76 |     if is_training:
77 |         with tf.contrib.framework.arg_scope(
78 |                 [tf.contrib.layers.conv2d],
79 |                 padding='SAME',
80 |                 weights_regularizer=slim.l2_regularizer(weight_decay),
81 |                 weights_initializer=tf.contrib.layers.variance_scaling_initializer(factor=1.0, mode='FAN_AVG',
82 |                                                                                    uniform=False, seed=None,
83 |                                                                                    dtype=tf.float32),
84 |                 activation_fn=tf.nn.relu) as sc:
85 |             return sc
86 | 
87 |     else:
88 |         with tf.contrib.framework.arg_scope(
89 |                 [tf.contrib.layers.conv2d],
90 |                 padding='SAME',
91 |                 activation_fn=tf.nn.relu) as sc:
92 |             return sc
93 | 
94 | 


--------------------------------------------------------------------------------
/code/deep_learning/cnn/code/script/evaluation.sh:
--------------------------------------------------------------------------------
 1 | # Where the logs will be saved to.
 2 | test_dir=/home/sina/GITHUB/Tensorflow-Turorials/NeuralNetworks/convolutional-neural-network/code/test_logs
 3 | 
 4 | # Where the checkpoints is saved to.
 5 | checkpoint_dir=/home/sina/GITHUB/Tensorflow-Turorials/NeuralNetworks/convolutional-neural-network/code/checkpoints
 6 | 
 7 | 
 8 | # Run training.
 9 | python test_classifier.py \
10 |   --test_dir=${test_dir} \
11 |   --checkpoint_dir=${checkpoint_dir} \
12 |   --batch_size=512 \
13 |   --num_epochs=2 \
14 |   --allow_soft_placement
15 | 
16 | 


--------------------------------------------------------------------------------
/code/deep_learning/cnn/code/script/train.sh:
--------------------------------------------------------------------------------
 1 | # Where the logs will be saved to.
 2 | train_dir=/home/sina/GITHUB/Tensorflow-Turorials/NeuralNetworks/convolutional-neural-network/code/train_logs
 3 | 
 4 | # Where the checkpoints is saved to.
 5 | checkpoint_dir=/home/sina/GITHUB/Tensorflow-Turorials/NeuralNetworks/convolutional-neural-network/code/checkpoints
 6 | 
 7 | 
 8 | # Run training.
 9 | python train_classifier.py \
10 |   --train_dir=${train_dir} \
11 |   --checkpoint_dir=${checkpoint_dir} \
12 |   --batch_size=512 \
13 |   --num_epochs=20 \
14 |   --max_num_checkpoint=10 \
15 |   --is_training \
16 |   --allow_soft_placement
17 | 
18 | 


--------------------------------------------------------------------------------
/code/deep_learning/cnn/code/train.sh:
--------------------------------------------------------------------------------
 1 | 
 2 | # Run training.
 3 | python train_classifier.py \
 4 |   --batch_size=512 \
 5 |   --max_num_checkpoint=10 \
 6 |   --num_classes=10 \
 7 |   --num_epochs=1 \
 8 |   --initial_learning_rate=0.001 \
 9 |   --num_epochs_per_decay=1 \
10 |   --is_training=True \
11 |   --allow_soft_placement=True \
12 |   --fine_tuning=False \
13 |   --online_test=True \
14 |   --log_device_placement=False
15 | 
16 | 


--------------------------------------------------------------------------------
/code/deep_learning/cnn/readme.rst:
--------------------------------------------------------------------------------
 1 | ==============================
 2 | Convolutional Neural Network
 3 | ==============================
 4 | 
 5 | This is the code repository for the blog post `Train a Convolutional Neural Network as a Classifier`__.
 6 | 
 7 | .. _cnn_classifier_post: https://machinelearningmindset.com/train-a-convolutional-neural-network-as-a-classifier/
 8 | __ cnn_classifier_post_
 9 | 
10 | 
11 | 
12 | 
13 | --------
14 | Training
15 | --------
16 | 
17 | **Train:**
18 | 
19 | The training can be run using the **train.sh** `bash script` file using the following command:
20 | 
21 | .. code-block:: bash
22 | 
23 |    ./train.sh
24 | 
25 | The bash script is as below:
26 | 
27 | 
28 | .. code-block:: bash
29 | 
30 |    python train_classifier.py \
31 |      --batch_size=512 \
32 |      --max_num_checkpoint=10 \
33 |      --num_classes=10 \
34 |      --num_epochs=1 \
35 |      --initial_learning_rate=0.001 \
36 |      --num_epochs_per_decay=1 \
37 |      --is_training=True \
38 |      --allow_soft_placement=True \
39 |      --fine_tuning=False \
40 |      --online_test=True \
41 |      --log_device_placement=False
42 | 
43 | **helper:**
44 | 
45 | In order to realize that what are the parameters as input running the following command is recommended:
46 | 
47 | .. code-block:: bash
48 | 
49 |    python train_classifier.py --help
50 | 
51 | 
52 | In which `train_classifier.py` is the main file for running the training. The result of the above command will be as below:
53 | 
54 | .. code-block:: bash
55 | 
56 |   --train_dir TRAIN_DIR
57 |                         Directory where event logs are written to.
58 |   --checkpoint_dir CHECKPOINT_DIR
59 |                         Directory where checkpoints are written to.
60 |   --max_num_checkpoint MAX_NUM_CHECKPOINT
61 |                         Maximum number of checkpoints that TensorFlow will
62 |                         keep.
63 |   --num_classes NUM_CLASSES
64 |                         Number of model clones to deploy.
65 |   --batch_size BATCH_SIZE
66 |                         Number of model clones to deploy.
67 |   --num_epochs NUM_EPOCHS
68 |                         Number of epochs for training.
69 |   --initial_learning_rate INITIAL_LEARNING_RATE
70 |                         Initial learning rate.
71 |   --learning_rate_decay_factor LEARNING_RATE_DECAY_FACTOR
72 |                         Learning rate decay factor.
73 |   --num_epochs_per_decay NUM_EPOCHS_PER_DECAY
74 |                         Number of epoch pass to decay learning rate.
75 |   --is_training [IS_TRAINING]
76 |                         Training/Testing.
77 |   --fine_tuning [FINE_TUNING]
78 |                         Fine tuning is desired or not?.
79 |   --online_test [ONLINE_TEST]
80 |                         Fine tuning is desired or not?.
81 |   --allow_soft_placement [ALLOW_SOFT_PLACEMENT]
82 |                         Automatically put the variables on CPU if there is no
83 |                         GPU support.
84 |   --log_device_placement [LOG_DEVICE_PLACEMENT]
85 |                         Demonstrate which variables are on what device.
86 | 
87 | 
88 | -----------
89 | Evaluation
90 | -----------
91 | 
92 | The evaluation will be run using the **evaluation.sh** `bash script` file using the following command:
93 | 
94 | .. code-block:: bash
95 | 
96 |    ./evaluation.sh
97 | 
98 | 
99 | 


--------------------------------------------------------------------------------
/code/deep_learning/cnn/requirements.txt:
--------------------------------------------------------------------------------
1 | - TensorFLow 1.0
2 | - numpy
3 | 


--------------------------------------------------------------------------------
/code/deep_learning/mlp/code/evaluation.sh:
--------------------------------------------------------------------------------
1 | 
2 | # Run training.
3 | python test_classifier.py \
4 |   --batch_size=512 \
5 |   --allow_soft_placement
6 | 
7 | 


--------------------------------------------------------------------------------
/code/deep_learning/mlp/code/train.sh:
--------------------------------------------------------------------------------
 1 | 
 2 | # Run training.
 3 | python train_mlp.py \
 4 |   --batch_size=512 \
 5 |   --max_num_checkpoint=10 \
 6 |   --num_classes=10 \
 7 |   --num_epochs=1 \
 8 |   --initial_learning_rate=0.001 \
 9 |   --num_epochs_per_decay=1 \
10 |   --is_training=True \
11 |   --allow_soft_placement=True \
12 |   --fine_tuning=False \
13 |   --online_test=True \
14 |   --log_device_placement=False
15 | 
16 | 


--------------------------------------------------------------------------------
/code/deep_learning/mlp/readme.rst:
--------------------------------------------------------------------------------
 1 | =========================
 2 | Multi Layer Perceptron
 3 | =========================
 4 | 
 5 | This code is developed for training a ``Multi Layer Perceptron`` architecture in which the input will be feed-forwarded to the network that contains some hidden layers.
 6 | 
 7 | .. figure:: https://github.com/astorfi/TensorFlow-World/blob/master/docs/_img/3-neural_network/multi-layer-perceptron/neural-network.png
 8 |    :scale: 50 %
 9 |    :align: center
10 |    
11 | 
12 | --------
13 | Training
14 | --------
15 | 
16 | **Train:**
17 | 
18 | The training can be run using the **train.sh** `bash script` file using the following command:
19 | 
20 | .. code-block:: bash
21 | 
22 |    ./train.sh
23 | 
24 | The bash script is as below:
25 | 
26 | 
27 | .. code-block:: bash
28 | 
29 |    python train_mlp.py \
30 |      --batch_size=512 \
31 |      --max_num_checkpoint=10 \
32 |      --num_classes=10 \
33 |      --num_epochs=1 \
34 |      --initial_learning_rate=0.001 \
35 |      --num_epochs_per_decay=1 \
36 |      --is_training=True \
37 |      --allow_soft_placement=True \
38 |      --fine_tuning=False \
39 |      --online_test=True \
40 |      --log_device_placement=False
41 | 
42 | **helper:**
43 | 
44 | In order to realize that what are the parameters as input running the following command is recommended:
45 | 
46 | .. code-block:: bash
47 | 
48 |    python train_mlp.py --help
49 | 
50 | 
51 | In which `train_mlp.py` is the main file for running the training. The result of the above command will be as below:
52 | 
53 | .. code-block:: bash
54 | 
55 |   --train_dir TRAIN_DIR
56 |                         Directory where event logs are written to.
57 |   --checkpoint_dir CHECKPOINT_DIR
58 |                         Directory where checkpoints are written to.
59 |   --max_num_checkpoint MAX_NUM_CHECKPOINT
60 |                         Maximum number of checkpoints that TensorFlow will
61 |                         keep.
62 |   --num_classes NUM_CLASSES
63 |                         Number of model clones to deploy.
64 |   --batch_size BATCH_SIZE
65 |                         Number of model clones to deploy.
66 |   --num_epochs NUM_EPOCHS
67 |                         Number of epochs for training.
68 |   --initial_learning_rate INITIAL_LEARNING_RATE
69 |                         Initial learning rate.
70 |   --learning_rate_decay_factor LEARNING_RATE_DECAY_FACTOR
71 |                         Learning rate decay factor.
72 |   --num_epochs_per_decay NUM_EPOCHS_PER_DECAY
73 |                         Number of epoch pass to decay learning rate.
74 |   --is_training [IS_TRAINING]
75 |                         Training/Testing.
76 |   --fine_tuning [FINE_TUNING]
77 |                         Fine tuning is desired or not?.
78 |   --online_test [ONLINE_TEST]
79 |                         Fine tuning is desired or not?.
80 |   --allow_soft_placement [ALLOW_SOFT_PLACEMENT]
81 |                         Automatically put the variables on CPU if there is no
82 |                         GPU support.
83 |   --log_device_placement [LOG_DEVICE_PLACEMENT]
84 |                         Demonstrate which variables are on what device.
85 | 
86 | 
87 | -----------
88 | Evaluation
89 | -----------
90 | 
91 | The evaluation will be run using the **evaluation.sh** `bash script` file using the following command:
92 | 
93 | .. code-block:: bash
94 | 
95 |    ./evaluation.sh
96 | 
97 | 
98 | 


--------------------------------------------------------------------------------
/code/deep_learning/rnn/rnn.py:
--------------------------------------------------------------------------------
  1 | import tensorflow as tf
  2 | import numpy as np
  3 | import matplotlib.pyplot as plt
  4 | import argparse
  5 | 
  6 | # Useful function for arguments.
  7 | def str2bool(v):
  8 |     return v.lower() in ("yes", "true")
  9 | 
 10 | # Parser
 11 | parser = argparse.ArgumentParser(description='Creating Classifier')
 12 | 
 13 | ######################
 14 | # Optimization Flags #
 15 | ######################
 16 | 
 17 | tf.app.flags.DEFINE_float('learning_rate', default=0.001, help='initial learning rate')
 18 | tf.app.flags.DEFINE_integer('seed', default=111, help='seed')
 19 | 
 20 | ##################
 21 | # Training Flags #
 22 | ##################
 23 | tf.app.flags.DEFINE_integer('batch_size', default=128, help='Batch size for training')
 24 | tf.app.flags.DEFINE_integer('num_epoch', default=10, help='Number of training iterations')
 25 | tf.app.flags.DEFINE_integer('batch_per_log', default=10, help='Print the log at what number of batches?')
 26 | 
 27 | ###############
 28 | # Model Flags #
 29 | ###############
 30 | tf.app.flags.DEFINE_integer('hidden_size', default=128, help='Number of neurons for RNN hodden layer')
 31 | 
 32 | # Store all elemnts in FLAG structure!
 33 | args = tf.app.flags.FLAGS
 34 | 
 35 | 
 36 | # Reset the graph set the random numbers to be the same using "seed"
 37 | tf.reset_default_graph()
 38 | tf.set_random_seed(args.seed)
 39 | np.random.seed(args.seed)
 40 | 
 41 | # Divide 28x28 images to rows of data to feed to RNN as sequantial information
 42 | step_size = 28
 43 | input_size = 28
 44 | output_size = 10
 45 | 
 46 | # Input tensors
 47 | X = tf.placeholder(tf.float32, [None, step_size, input_size])
 48 | y = tf.placeholder(tf.int32, [None])
 49 | 
 50 | # Rnn
 51 | cell = tf.nn.rnn_cell.BasicRNNCell(num_units=args.hidden_size)
 52 | output, state = tf.nn.dynamic_rnn(cell, X, dtype=tf.float32)
 53 | 
 54 | # Forward pass and loss calcualtion
 55 | logits = tf.layers.dense(state, output_size)
 56 | cross_entropy = tf.nn.sparse_softmax_cross_entropy_with_logits(labels=y, logits=logits)
 57 | loss = tf.reduce_mean(cross_entropy)
 58 | 
 59 | # optimizer
 60 | optimizer = tf.train.AdamOptimizer(learning_rate=args.learning_rate).minimize(loss)
 61 | 
 62 | # Prediction
 63 | prediction = tf.nn.in_top_k(logits, y, 1)
 64 | accuracy = tf.reduce_mean(tf.cast(prediction, tf.float32))
 65 | 
 66 | # input data
 67 | from tensorflow.examples.tutorials.mnist import input_data
 68 | mnist = input_data.read_data_sets("MNIST_data/")
 69 | 
 70 | # Process MNIST
 71 | X_test = mnist.test.images # X_test shape: [num_test, 28*28]
 72 | X_test = X_test.reshape([-1, step_size, input_size])
 73 | y_test = mnist.test.labels
 74 | 
 75 | # initialize the variables
 76 | init = tf.global_variables_initializer()
 77 | 
 78 | # Empty list for tracking
 79 | loss_train_list = []
 80 | acc_train_list = []
 81 | 
 82 | # train the model
 83 | with tf.Session() as sess:
 84 |     sess.run(init)
 85 |     n_batches = mnist.train.num_examples // args.batch_size
 86 |     for epoch in range(args.num_epoch):
 87 |         for batch in range(n_batches):
 88 |             X_train, y_train = mnist.train.next_batch(args.batch_size)
 89 |             X_train = X_train.reshape([-1, step_size, input_size])
 90 |             sess.run(optimizer, feed_dict={X: X_train, y: y_train})
 91 |         loss_train, acc_train = sess.run(
 92 |             [loss, accuracy], feed_dict={X: X_train, y: y_train})
 93 |         loss_train_list.append(loss_train)
 94 |         acc_train_list.append(acc_train)
 95 |         print('Epoch: {}, Train Loss: {:.3f}, Train Acc: {:.3f}'.format(
 96 |             epoch + 1, loss_train, acc_train))
 97 |     loss_test, acc_test = sess.run(
 98 |         [loss, accuracy], feed_dict={X: X_test, y: y_test})
 99 |     print('Test Loss: {:.3f}, Test Acc: {:.3f}'.format(loss_test, acc_test))
100 | 


--------------------------------------------------------------------------------
/code/overview/cross-validation/holdout.py:
--------------------------------------------------------------------------------
 1 | # An example of the Holdout Cross-Validation split
 2 | 
 3 | import pandas
 4 | from sklearn import datasets
 5 | from sklearn.model_selection import train_test_split
 6 | 
 7 | # The percentage (as a decimal) of our data that will be training data
 8 | TRAIN_SPLIT = 0.7
 9 | 
10 | # The diabetes dataset contains the following columns:
11 | columns = [
12 |     'age', 'sex', 'bmi', 'map', 'tc', 'ldl', 'hdl', 'tch', 'ltg', 'glu'
13 | ]
14 | 
15 | # Load the diabetes dataset
16 | dataset = datasets.load_diabetes()
17 | 
18 | # Create a pandas DataFrame from the diabetes dataset
19 | dataframe = pandas.DataFrame(dataset.data, columns=columns)
20 | 
21 | # Split via the holdout method
22 | x_train, x_test, y_train, y_test = train_test_split(
23 |     dataframe, dataset.target, train_size=TRAIN_SPLIT, test_size=1-TRAIN_SPLIT)
24 | 
25 | print("""\
26 | The holdout method removes a certain portion of the training data and uses it as test data.
27 | Ideally, the data points removed are random on each run.
28 | 
29 | The following output shows a set of sample diabetes data split into test and training data:
30 | """)
31 | 
32 | # Print our test and training data
33 | print("Total diabetes data points: {}".format(len(dataframe.index)))
34 | print("# of training data points: {} (~{}%)".format(len(x_train), TRAIN_SPLIT*100))
35 | print("# of test data points: {} (~{}%)\n".format(len(x_test), (1-TRAIN_SPLIT)*100))
36 | 
37 | print("If you'd like to see the actual data points, uncomment the print statements at the bottom of this script.")
38 | # print("Training data:\n{}\n".format(x_train))
39 | # print("Test data:\n{}".format(x_test))
40 | 


--------------------------------------------------------------------------------
/code/overview/cross-validation/k-fold.py:
--------------------------------------------------------------------------------
 1 | # An example of K-Fold Cross Validation split
 2 | 
 3 | import numpy
 4 | from sklearn.model_selection import KFold
 5 | 
 6 | # Configurable constants
 7 | NUM_SPLITS = 3
 8 | 
 9 | # Create some data to perform K-Fold CV on
10 | data = numpy.array([[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]])
11 | 
12 | # Perform a K-Fold split and print results
13 | kfold = KFold(n_splits=NUM_SPLITS)
14 | split_data = kfold.split(data)
15 | 
16 | print("""\
17 | The K-Fold method works by splitting off 'folds' of test data until every point has been used for testing.
18 | 
19 | The following output shows the result of splitting some sample data.
20 | A bar displaying the current train-test split as well as the actual data points are displayed for each split.
21 | In the bar, "-" is a training point and "T" is a test point.
22 | """)
23 | 
24 | print("Data:\n{}\n".format(data))
25 | print('K-Fold split (with n_splits = {}):\n'.format(NUM_SPLITS))
26 | 
27 | for train, test in split_data:
28 |     output_train = ''
29 |     output_test = ''
30 | 
31 |     bar = ["-"] * (len(train) + len(test))
32 | 
33 |     # Build our output for display from the resulting split
34 |     for i in train:
35 |         output_train = "{}({}: {}) ".format(output_train, i, data[i])
36 | 
37 |     for i in test:
38 |         bar[i] = "T"
39 |         output_test = "{}({}: {}) ".format(output_test, i, data[i])
40 | 
41 |     print("[ {} ]".format(" ".join(bar)))
42 |     print("Train: {}".format(output_train))
43 |     print("Test:  {}\n".format(output_test))
44 | 


--------------------------------------------------------------------------------
/code/overview/cross-validation/leave-p-out.py:
--------------------------------------------------------------------------------
 1 | # Example of LOOCV and LPOCV splitting
 2 | 
 3 | import numpy
 4 | from sklearn.model_selection import LeaveOneOut, LeavePOut
 5 | 
 6 | # Configurable constants
 7 | P_VAL = 2
 8 | 
 9 | 
10 | def print_result(split_data):
11 |     """
12 |     Prints the result of either a LPOCV or LOOCV operation
13 | 
14 |     Args:
15 |         split_data: The resulting (train, test) split data
16 |     """
17 |     for train, test in split_data:
18 |         output_train = ''
19 |         output_test = ''
20 | 
21 |         bar = ["-"] * (len(train) + len(test))
22 | 
23 |         # Build our output for display from the resulting split
24 |         for i in train:
25 |             output_train = "{}({}: {}) ".format(output_train, i, data[i])
26 | 
27 |         for i in test:
28 |             bar[i] = "T"
29 |             output_test = "{}({}: {}) ".format(output_test, i, data[i])
30 |             
31 |         print("[ {} ]".format(" ".join(bar)))
32 |         print("Train: {}".format(output_train))
33 |         print("Test:  {}\n".format(output_test))
34 | 
35 | 
36 | # Create some data to split with
37 | data = numpy.array([[1, 2], [3, 4], [5, 6], [7, 8]])
38 | 
39 | # Our two methods
40 | loocv = LeaveOneOut()
41 | lpocv = LeavePOut(p=P_VAL)
42 | 
43 | split_loocv = loocv.split(data)
44 | split_lpocv = lpocv.split(data)
45 | 
46 | print("""\
47 | The Leave-P-Out method works by using every combination of P points as test data.
48 | 
49 | The following output shows the result of splitting some sample data by Leave-One-Out and Leave-P-Out methods.
50 | A bar displaying the current train-test split as well as the actual data points are displayed for each split.
51 | In the bar, "-" is a training point and "T" is a test point.
52 | """)
53 | 
54 | print("Data:\n{}\n".format(data))
55 | 
56 | print("Leave-One-Out:\n")
57 | print_result(split_loocv)
58 | 
59 | print("Leave-P-Out (where p = {}):\n".format(P_VAL))
60 | print_result(split_lpocv)
61 | 


--------------------------------------------------------------------------------
/code/overview/linear_regression/exponential_regression.py:
--------------------------------------------------------------------------------
 1 | import matplotlib.pyplot as plt
 2 | import seaborn as sns
 3 | import numpy as np
 4 | from sklearn import datasets, linear_model
 5 | from sklearn.datasets import make_regression
 6 | from sklearn.model_selection import train_test_split
 7 | 
 8 | # Create a data set for analysis
 9 | x, y = make_regression(n_samples=500, n_features = 1, noise=25, random_state=0)
10 | y = np.exp((y + abs(y.min())) / 75)
11 | 
12 | # Split the data set into testing and training data
13 | x_train, x_test, y_train, y_test = train_test_split(x, y, random_state=0)
14 | 
15 | # Plot the data
16 | sns.set_style("darkgrid")
17 | sns.regplot(x_test, y_test, fit_reg=False)
18 | 
19 | # Remove ticks from the plot
20 | plt.xticks([])
21 | plt.yticks([])
22 | 
23 | plt.tight_layout()
24 | plt.show()
25 | 


--------------------------------------------------------------------------------
/code/overview/linear_regression/exponential_regression_transformed.py:
--------------------------------------------------------------------------------
 1 | import matplotlib.pyplot as plt
 2 | import seaborn as sns
 3 | import numpy as np
 4 | from sklearn import datasets, linear_model
 5 | from sklearn.datasets import make_regression
 6 | from sklearn.model_selection import train_test_split
 7 | 
 8 | # Create a data set for analysis
 9 | x, y = make_regression(n_samples=500, n_features = 1, noise=25, random_state=0)
10 | y = np.exp((y + abs(y.min())) / 75)
11 | # Transform data so that it looks linear
12 | y = np.log(y)
13 | 
14 | # Split the data set into testing and training data
15 | x_train, x_test, y_train, y_test = train_test_split(x, y, random_state=0)
16 | 
17 | # Plot the data
18 | sns.set_style("darkgrid")
19 | sns.regplot(x_test, y_test, fit_reg=False)
20 | 
21 | # Remove ticks from the plot
22 | plt.xticks([])
23 | plt.yticks([])
24 | 
25 | plt.tight_layout()
26 | plt.show()
27 | 


--------------------------------------------------------------------------------
/code/overview/linear_regression/linear_regression.py:
--------------------------------------------------------------------------------
 1 | import matplotlib.pyplot as plt
 2 | import seaborn as sns
 3 | from sklearn import datasets, linear_model
 4 | from sklearn.datasets import make_regression
 5 | from sklearn.model_selection import train_test_split
 6 | 
 7 | # Create a data set for analysis
 8 | x, y = make_regression(n_samples=500, n_features = 1, noise=25, random_state=0)
 9 | 
10 | # Split the data set into testing and training data
11 | x_train, x_test, y_train, y_test = train_test_split(x, y, random_state=0)
12 | 
13 | # Plot the data
14 | sns.set_style("darkgrid")
15 | sns.regplot(x_test, y_test, fit_reg=False)
16 | 
17 | # Remove ticks from the plot
18 | plt.xticks([])
19 | plt.yticks([])
20 | 
21 | plt.tight_layout()
22 | plt.show()
23 | 


--------------------------------------------------------------------------------
/code/overview/linear_regression/linear_regression_cost.py:
--------------------------------------------------------------------------------
 1 | import matplotlib.pyplot as plt
 2 | import seaborn as sns
 3 | from sklearn import datasets, linear_model
 4 | from sklearn.datasets import make_regression
 5 | from sklearn.model_selection import train_test_split
 6 | 
 7 | # Create a data set for analysis
 8 | x, y = make_regression(n_samples=500, n_features = 1, noise=25, random_state=0)
 9 | 
10 | # Split the data set into testing and training data
11 | x_train, x_test, y_train, y_test = train_test_split(x, y, random_state=0)
12 | 
13 | # Create a linear regression object
14 | regression = linear_model.LinearRegression()
15 | 
16 | # Train the model using the training set
17 | regression.fit(x_train, y_train)
18 | 
19 | # Make predictions using the testing set
20 | y_predictions = regression.predict(x_test)
21 | 
22 | # Grab a sample pair of points to analyze cost
23 | point_number = 2
24 | x_sample = [x_test[point_number].item(), x_test[point_number].item()]
25 | y_sample = [y_test[point_number].item(), y_predictions[point_number].item()]
26 | 
27 | # Plot the data
28 | sns.set_style("darkgrid")
29 | sns.regplot(x_test, y_test, fit_reg=False)
30 | plt.plot(x_test, y_predictions, color='black')
31 | plt.plot(x_sample, y_sample, color='red', label="cost", marker='o')
32 | 
33 | # Add a legend
34 | n = ['actual value', 'prediction']
35 | for i, txt in enumerate(n):
36 |     plt.annotate(txt, (x_sample[i], y_sample[i]), xytext=(10, -10),
37 |                  textcoords='offset pixels', fontsize=20)
38 | plt.legend(fontsize=20)
39 | 
40 | # Remove ticks from the plot
41 | plt.xticks([])
42 | plt.yticks([])
43 | 
44 | plt.tight_layout()
45 | plt.show()
46 | 


--------------------------------------------------------------------------------
/code/overview/linear_regression/linear_regression_lobf.py:
--------------------------------------------------------------------------------
 1 | import matplotlib.pyplot as plt
 2 | import seaborn as sns
 3 | from sklearn import datasets, linear_model
 4 | from sklearn.datasets import make_regression
 5 | from sklearn.model_selection import train_test_split
 6 | 
 7 | # Create a data set for analysis
 8 | x, y = make_regression(n_samples=500, n_features = 1, noise=25, random_state=0)
 9 | 
10 | # Split the data set into testing and training data
11 | x_train, x_test, y_train, y_test = train_test_split(x, y, random_state=0)
12 | 
13 | # Create a linear regression object
14 | regression = linear_model.LinearRegression()
15 | 
16 | # Train the model using the training set
17 | regression.fit(x_train, y_train)
18 | 
19 | # Make predictions using the testing set
20 | y_predictions = regression.predict(x_test)
21 | 
22 | # Plot the data
23 | sns.set_style("darkgrid")
24 | sns.regplot(x_test, y_test, fit_reg=False)
25 | plt.plot(x_test, y_predictions, color='black')
26 | 
27 | # Remove ticks from the plot
28 | plt.xticks([])
29 | plt.yticks([])
30 | 
31 | plt.tight_layout()
32 | plt.show()
33 | 


--------------------------------------------------------------------------------
/code/overview/linear_regression/not_linear_regression.py:
--------------------------------------------------------------------------------
 1 | import matplotlib.pyplot as plt
 2 | import seaborn as sns
 3 | from sklearn import datasets, linear_model
 4 | from sklearn.datasets import make_regression
 5 | from sklearn.model_selection import train_test_split
 6 | 
 7 | # Create a data set for analysis
 8 | x, y = make_regression(n_samples=500, n_features = 1, noise=25, random_state=0)
 9 | y = y ** 2
10 | 
11 | # Split the data set into testing and training data
12 | x_train, x_test, y_train, y_test = train_test_split(x, y, random_state=0)
13 | 
14 | # Plot the data
15 | sns.set_style("darkgrid")
16 | sns.regplot(x_test, y_test, fit_reg=False)
17 | 
18 | # Remove ticks from the plot
19 | plt.xticks([])
20 | plt.yticks([])
21 | 
22 | plt.tight_layout()
23 | plt.show()
24 | 


--------------------------------------------------------------------------------
/code/overview/overfitting/overfitting.py:
--------------------------------------------------------------------------------
 1 | import matplotlib.pyplot as plt
 2 | 
 3 | def real_funct(x):
 4 |     return [-(i**2) for i in x]
 5 | 
 6 | def over_funct(x):
 7 |     return [-0.5*(i**3) - (i**2) for i in x]
 8 | 
 9 | def under_funct(x):
10 |     return [6*i + 9 for i in x]
11 | 
12 | #create x values, and run them through each function
13 | x = range(-3, 4, 1)
14 | real_y = real_funct(x)
15 | over_y = over_funct(x)
16 | under_y = under_funct(x)
17 | 
18 | #Use matplotlib to plot the functions so they can be visually compared.
19 | plt.plot(x, real_y, 'k', label='Real function')
20 | plt.plot(x, over_y, 'r', label='Overfit function')
21 | plt.plot(x, under_y, 'b', label='Underfit function')
22 | plt.legend()
23 | plt.show()
24 | 
25 | #Output the data in a well formatted way, for the more numerically inclined.
26 | print("An underfit model may output something like this:")
27 | for i in range(0, 7):
28 |     print("x: "+ str(x[i]) + ", real y: " + str(real_y[i]) + ", y: " + str(under_y[i]))
29 | 
30 | print("An overfit model may look a little like this")
31 | for i in range(0, 7):
32 |     print("x: "+ str(x[i]) + ", real y: " + str(real_y[i]) + ", y: " + str(over_y[i]))
33 | 


--------------------------------------------------------------------------------
/code/overview/regularization/regularization_lasso.py:
--------------------------------------------------------------------------------
 1 | import matplotlib.pyplot as plt
 2 | import seaborn as sns
 3 | from sklearn.preprocessing import PolynomialFeatures
 4 | from sklearn.datasets import make_regression
 5 | from sklearn.linear_model import LinearRegression, Lasso
 6 | from sklearn.pipeline import Pipeline
 7 | import numpy as np
 8 | 
 9 | # Create a data set for analysis
10 | x, y = make_regression(n_samples=100, n_features = 1, noise=15, random_state=0)
11 | y = y ** 2
12 | 
13 | # Pipeline lets us set the steps for our modeling
14 | # We are comparing a standard polynomial model against one with lasso
15 | model = Pipeline([('poly', PolynomialFeatures(degree=10)), \
16 | ('linear', LinearRegression(fit_intercept=False))])
17 | regModel = Pipeline([('poly', PolynomialFeatures(degree=10)), \
18 | ('lasso', Lasso(alpha=5, max_iter=1000000))])
19 | 
20 | # Now we train on our data
21 | model = model.fit(x, y)
22 | regModel = regModel.fit(x, y)
23 | # Now we pridict
24 | x_plot = np.linspace(min(x)[0], max(x)[0], 100)
25 | x_plot = x_plot[:, np.newaxis]
26 | y_plot = model.predict(x_plot)
27 | yReg_plot = regModel.predict(x_plot)
28 | 
29 | # Plot data
30 | sns.set_style("darkgrid")
31 | plt.plot(x_plot, y_plot, color='black')
32 | plt.plot(x_plot, yReg_plot, color='red')
33 | plt.scatter(x, y, marker='o')
34 | plt.xticks(())
35 | plt.yticks(())
36 | plt.tight_layout()
37 | plt.show()
38 | 


--------------------------------------------------------------------------------
/code/overview/regularization/regularization_linear.py:
--------------------------------------------------------------------------------
 1 | import matplotlib.pyplot as plt
 2 | import seaborn as sns
 3 | from sklearn.preprocessing import PolynomialFeatures
 4 | from sklearn.datasets import make_regression
 5 | from sklearn.linear_model import LinearRegression
 6 | from sklearn.pipeline import Pipeline
 7 | import numpy as np
 8 | 
 9 | # Create a data set for analysis
10 | x, y = make_regression(n_samples=100, n_features = 1, noise=15, random_state=0)
11 | y = y ** 2
12 | 
13 | # Pipeline lets us set the steps for our modeling
14 | # We are using a simple linear model here
15 | model = Pipeline([('poly', PolynomialFeatures(degree=1)), \
16 | ('linear', LinearRegression(fit_intercept=False))])
17 | 
18 | # Now we train on our data
19 | model = model.fit(x, y)
20 | # Now we pridict
21 | y_predictions = model.predict(x)
22 | 
23 | # Plot data
24 | sns.set_style("darkgrid")
25 | plt.plot(x, y_predictions, color='black')
26 | plt.scatter(x, y, marker='o')
27 | plt.xticks(())
28 | plt.yticks(())
29 | plt.tight_layout()
30 | plt.show()
31 | 


--------------------------------------------------------------------------------
/code/overview/regularization/regularization_polynomial.py:
--------------------------------------------------------------------------------
 1 | import matplotlib.pyplot as plt
 2 | import seaborn as sns
 3 | from sklearn.preprocessing import PolynomialFeatures
 4 | from sklearn.datasets import make_regression
 5 | from sklearn.linear_model import LinearRegression
 6 | from sklearn.pipeline import Pipeline
 7 | import numpy as np
 8 | 
 9 | # Create a data set for analysis
10 | x, y = make_regression(n_samples=100, n_features = 1, noise=15, random_state=0)
11 | y = y ** 2
12 | 
13 | # Pipeline lets us set the steps for our modeling
14 | # We are using a polynomial model here (polynomial with degree 10)
15 | model = Pipeline([('poly', PolynomialFeatures(degree=10)), \
16 | ('linear', LinearRegression(fit_intercept=False))])
17 | 
18 | # Now we train on our data
19 | model = model.fit(x, y)
20 | # Now we pridict
21 | # The next two lines are used to model input for our prediction graph
22 | x_plot = np.linspace(min(x)[0], max(x)[0], 100)
23 | x_plot = x_plot[:, np.newaxis]
24 | y_predictions = model.predict(x_plot)
25 | 
26 | # Plot data
27 | sns.set_style("darkgrid")
28 | plt.plot(x_plot, y_predictions, color='black')
29 | plt.scatter(x, y, marker='o')
30 | plt.xticks(())
31 | plt.yticks(())
32 | plt.tight_layout()
33 | plt.show()
34 | 


--------------------------------------------------------------------------------
/code/overview/regularization/regularization_quadratic.py:
--------------------------------------------------------------------------------
 1 | import matplotlib.pyplot as plt
 2 | import seaborn as sns
 3 | from sklearn.preprocessing import PolynomialFeatures
 4 | from sklearn.datasets import make_regression
 5 | from sklearn.linear_model import LinearRegression
 6 | from sklearn.pipeline import Pipeline
 7 | import numpy as np
 8 | 
 9 | # Create a data set for analysis
10 | x, y = make_regression(n_samples=100, n_features = 1, noise=15, random_state=0)
11 | y = y ** 2
12 | 
13 | # Pipeline lets us set the steps for our modeling
14 | # We are using a quadratic model here (polynomial with degree 2)
15 | model = Pipeline([('poly', PolynomialFeatures(degree=2)), \
16 | ('linear', LinearRegression(fit_intercept=False))])
17 | 
18 | # Now we train on our data
19 | model = model.fit(x, y)
20 | # Now we pridict
21 | # The next two lines are used to model input for our prediction graph
22 | x_plot = np.linspace(min(x)[0], max(x)[0], 100)
23 | x_plot = x_plot[:, np.newaxis]
24 | y_predictions = model.predict(x_plot)
25 | 
26 | # Plot data
27 | sns.set_style("darkgrid")
28 | plt.plot(x_plot, y_predictions, color='black')
29 | plt.scatter(x, y, marker='o')
30 | plt.xticks(())
31 | plt.yticks(())
32 | plt.tight_layout()
33 | plt.show()
34 | 


--------------------------------------------------------------------------------
/code/overview/regularization/regularization_ridge.py:
--------------------------------------------------------------------------------
 1 | import matplotlib.pyplot as plt
 2 | import seaborn as sns
 3 | from sklearn.preprocessing import PolynomialFeatures
 4 | from sklearn.datasets import make_regression
 5 | from sklearn.linear_model import LinearRegression, Ridge
 6 | from sklearn.pipeline import Pipeline
 7 | import numpy as np
 8 | 
 9 | # Create a data set for analysis
10 | x, y = make_regression(n_samples=100, n_features = 1, noise=15, random_state=0)
11 | y = y ** 2
12 | 
13 | # Pipeline lets us set the steps for our modeling
14 | # We are comparing a standard polynomial model against one with ridge
15 | model = Pipeline([('poly', PolynomialFeatures(degree=10)), \
16 | ('linear', LinearRegression(fit_intercept=False))])
17 | regModel = Pipeline([('poly', PolynomialFeatures(degree=10)), \
18 | ('ridge', Ridge(alpha=5.0))])
19 | 
20 | # Now we train on our data
21 | model = model.fit(x, y)
22 | regModel = regModel.fit(x, y)
23 | # Now we pridict
24 | # The next four lines are used to model input for our prediction graph
25 | x_plot = np.linspace(min(x)[0], max(x)[0], 100)
26 | x_plot = x_plot[:, np.newaxis]
27 | y_plot = model.predict(x_plot)
28 | yReg_plot = regModel.predict(x_plot)
29 | 
30 | # Plot data
31 | sns.set_style("darkgrid")
32 | plt.plot(x_plot, y_plot, color='black')
33 | plt.plot(x_plot, yReg_plot, color='red')
34 | plt.scatter(x, y, marker='o')
35 | plt.xticks(())
36 | plt.yticks(())
37 | plt.tight_layout()
38 | plt.show()
39 | 


--------------------------------------------------------------------------------
/code/supervised/DecisionTree/decisiontrees.py:
--------------------------------------------------------------------------------
 1 | import graphviz
 2 | import itertools
 3 | import random 
 4 | from sklearn.tree import DecisionTreeClassifier, export_graphviz
 5 | from sklearn.preprocessing import OneHotEncoder
 6 | 
 7 | # The possible values for each class 
 8 | classes = {
 9 |     'supplies': ['low', 'med', 'high'],
10 |     'weather':  ['raining', 'cloudy', 'sunny'],
11 |     'worked?':  ['yes', 'no']
12 | }
13 | 
14 | # Our example data from the documentation
15 | data = [
16 |     ['low',  'sunny',   'yes'],
17 |     ['high', 'sunny',   'yes'],
18 |     ['med',  'cloudy',  'yes'],
19 |     ['low',  'raining', 'yes'],
20 |     ['low',  'cloudy',  'no' ],
21 |     ['high', 'sunny',   'no' ],
22 |     ['high', 'raining', 'no' ],
23 |     ['med',  'cloudy',  'yes'],
24 |     ['low',  'raining', 'yes'],
25 |     ['low',  'raining', 'no' ],
26 |     ['med',  'sunny',   'no' ],
27 |     ['high', 'sunny',   'yes']
28 | ]
29 | 
30 | # Our target variable, whether someone went shopping
31 | target = ['yes', 'no', 'no', 'no', 'yes', 'no', 'no', 'no', 'no', 'yes', 'yes', 'no']
32 | 
33 | # Scikit learn can't handle categorical data, so form numeric representations of the above data
34 | # Categorical data support may be added in the future: https://github.com/scikit-learn/scikit-learn/pull/4899
35 | categories = [classes['supplies'], classes['weather'], classes['worked?']]
36 | encoder = OneHotEncoder(categories=categories)
37 | 
38 | x_data = encoder.fit_transform(data)
39 | 
40 | # Form and fit our decision tree to the now-encoded data
41 | classifier = DecisionTreeClassifier()
42 | tree = classifier.fit(x_data, target)
43 | 
44 | # Now that we have our decision tree, let's predict some outcomes from random data
45 | # This goes through each class and builds a random set of 5 data points
46 | prediction_data = []
47 | for _ in itertools.repeat(None, 5):
48 |     prediction_data.append([
49 |         random.choice(classes['supplies']),
50 |         random.choice(classes['weather']),
51 |         random.choice(classes['worked?'])
52 |     ])
53 | 
54 | # Use our tree to predict the outcome of the random values
55 | prediction_results = tree.predict(encoder.transform(prediction_data))
56 | 
57 | 
58 | 
59 | # =============================================================================
60 | # Output code
61 | 
62 | def format_array(arr):
63 |     return "".join(["| {:<10}".format(item) for item in arr])
64 | 
65 | def print_table(data, results):
66 |     line = "day  " + format_array(list(classes.keys()) + ["went shopping?"])
67 |     print("-" * len(line))
68 |     print(line)
69 |     print("-" * len(line))
70 | 
71 |     for day, row in enumerate(data):
72 |         print("{:<5}".format(day + 1) + format_array(row + [results[day]]))
73 |     print("")
74 | 
75 | feature_names = (
76 |     ['supplies-' + x for x in classes["supplies"]] +
77 |     ['weather-' + x for x in classes["weather"]] +
78 |     ['worked-' + x for x in classes["worked?"]]
79 | )
80 | 
81 | # Shows a visualization of the decision tree using graphviz
82 | # Note that sklearn is unable to generate non-binary trees, so these are based on individual options in each class
83 | dot_data = export_graphviz(tree, filled=True, proportion=True, feature_names=feature_names) 
84 | graph = graphviz.Source(dot_data)
85 | graph.render(filename='decision_tree', cleanup=True, view=True)
86 | 
87 | # Display out training and prediction data and results
88 | print("Training Data:")
89 | print_table(data, target)
90 | 
91 | print("Predicted Random Results:")
92 | print_table(prediction_data, prediction_results)
93 | 


--------------------------------------------------------------------------------
/code/supervised/KNN/knn.py:
--------------------------------------------------------------------------------
 1 | # All the libraries we need for KNN
 2 | import numpy as np
 3 | import matplotlib.pyplot as plt
 4 | 
 5 | from sklearn.neighbors import KNeighborsClassifier
 6 | # This is used for our dataset
 7 | from sklearn.datasets import load_breast_cancer
 8 | 
 9 | 
10 | # =============================================================================
11 | # We are using sklearn datasets to create the set of data points about breast cancer
12 | # Data is the set data points
13 | # target is the classification of those data points. 
14 | # More information can be found at:
15 | #https://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_breast_cancer.html#sklearn.datasets.load_breast_cancer
16 | # =============================================================================
17 | dataCancer = load_breast_cancer()
18 | 
19 | # The data[:, x:n] gets two features for the data given. 
20 | # The : part gets all the rows in the matrix. And 0:2 gets the first 2 columns 
21 | # If you want to get a different two features you can replace 0:2 with 1:3, 2:4,... 28:30, 
22 | # there are 30 features in the set so it can only go up to 30.
23 | # If we wanted to plot a 3 dimensional plot then the difference between x and n needs to be 3 instead of two
24 | data = dataCancer.data[:, 0:2]
25 | target = dataCancer.target
26 | 
27 | # =============================================================================
28 | # This creates the KNN classifier and specifies the algorithm being used and the k
29 | # nearest neighbors used for the algorithm. more information can about KNeighborsClassifier
30 | # can be found at: https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html
31 | #
32 | # Then it trains the model using the breast cancer dataset. 
33 | # =============================================================================
34 | model = KNeighborsClassifier(n_neighbors = 9, algorithm = 'auto')
35 | model.fit(data, target)
36 | 
37 | 
38 | # plots the points 
39 | plt.scatter(data[:, 0], data[:, 1], c=target, s=30, cmap=plt.cm.prism)
40 | 
41 | # Creates the axis bounds for the grid
42 | axis = plt.gca()
43 | x_limit = axis.get_xlim()
44 | y_limit = axis.get_ylim()
45 | 
46 | # Creates a grid to evaluate model
47 | x = np.linspace(x_limit[0], x_limit[1])
48 | y = np.linspace(y_limit[0], y_limit[1])
49 | X, Y = np.meshgrid(x, y)
50 | xy = np.c_[X.ravel(), Y.ravel()]
51 | 
52 | # Creates the line that will separate the data
53 | boundary = model.predict(xy)
54 | boundary = boundary.reshape(X.shape)
55 | 
56 | 
57 | # Plot the decision boundary
58 | axis.contour(X, Y,  boundary, colors = 'k')
59 |          
60 | # Shows the graph
61 | plt.show()
62 | 
63 | 
64 | 


--------------------------------------------------------------------------------
/code/supervised/Linear_SVM/linear_svm.py:
--------------------------------------------------------------------------------
 1 | # All the libraries we need for linear SVM
 2 | import numpy as np
 3 | import matplotlib.pyplot as plt
 4 | from sklearn import svm
 5 | # This is used for our dataset
 6 | from sklearn.datasets import load_breast_cancer
 7 | 
 8 | 
 9 | # =============================================================================
10 | # We are using sklearn datasets to create the set of data points about breast cancer
11 | # Data is the set data points
12 | # target is the classification of those data points. 
13 | # More information can be found athttps://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_breast_cancer.html#sklearn.datasets.load_breast_cancer
14 | # =============================================================================
15 | dataCancer = load_breast_cancer()
16 | 
17 | # The data[:, x:n] gets two features for the data given. 
18 | # The : part gets all the rows in the matrix. And 0:2 gets the first 2 columns 
19 | # If you want to get a different two features you can replace 0:2 with 1:3, 2:4,... 28:30, 
20 | # there are 30 features in the set so it can only go up to 30.
21 | # If we wanted to plot a 3 dimensional plot then the difference between x and n needs to be 3 instead of two
22 | data = dataCancer.data[:, 0:2]
23 | target = dataCancer.target
24 | 
25 | # =============================================================================
26 | # Creates the linear svm model and fits it to our data points
27 | # The optional parameter will be default other than these two,
28 | # You can find the other parameters at https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html
29 | # =============================================================================
30 | model = svm.SVC(kernel = 'linear', C = 10000)
31 | model.fit(data, target)
32 | 
33 | 
34 | # plots the points 
35 | plt.scatter(data[:, 0], data[:, 1], c=target, s=30, cmap=plt.cm.prism)
36 | 
37 | # Creates the axis bounds for the grid
38 | axis = plt.gca()
39 | x_limit = axis.get_xlim()
40 | y_limit = axis.get_ylim()
41 | 
42 | # Creates a grid to evaluate model
43 | x = np.linspace(x_limit[0], x_limit[1], 50)
44 | y = np.linspace(y_limit[0], y_limit[1], 50)
45 | X, Y = np.meshgrid(x, y)
46 | xy = np.c_[X.ravel(), Y.ravel()]
47 | 
48 | # Creates the decision line for the data points, use model.predict if you are classifying more than two 
49 | decision_line = model.decision_function(xy).reshape(Y.shape)
50 | 
51 | 
52 | # Plot the decision line and the margins
53 | axis.contour(X, Y,  decision_line, colors = 'k',  levels=[0], 
54 |            linestyles=['-'])
55 | # Shows the support vectors that determine the desision line
56 | axis.scatter(model.support_vectors_[:, 0], model.support_vectors_[:, 1], s=100,
57 |            linewidth=1, facecolors='none', edgecolors='k')
58 | 
59 | # Shows the graph
60 | plt.show()
61 | 
62 | 
63 | 


--------------------------------------------------------------------------------
/code/supervised/Logistic_Regression/logistic_ex1.py:
--------------------------------------------------------------------------------
 1 | from sklearn.linear_model import LogisticRegression
 2 | import numpy as np
 3 | import random
 4 | 
 5 | #defines the classification for the training data.
 6 | def true_classifier(i):
 7 |     if i >= 700:
 8 |         return 1
 9 |     return 0
10 | 
11 | #Generate a random dataset which includes random scores from 0 to 1000.
12 | x = np.array([ random.randint(0,1000) for i in range(0,1000) ])
13 | 
14 | #The model will expect a 2D array, so we must reshape
15 | #For the model, the 2D array must have rows equal to the number of samples,
16 | #and columns equal to the number of features.
17 | #For this example, we have 1000 samples and 1 feature.
18 | x = x.reshape((-1, 1))
19 | 
20 | #For each point, y is a pass/fail for the grade. The simple threshold is arbitrary,
21 | #and can be changed as you would like. Classes are 1 for success and 0 for failure
22 | y = [ true_classifier(x[i][0]) for i in range(0,1000) ]
23 | 
24 | 
25 | #Again, we need a numpy array, so we convert.
26 | y = np.array(y)
27 | 
28 | #Our goal will be to train a logistic regression model to do pass/fail to the same threshold.
29 | model = LogisticRegression(solver='liblinear')
30 | 
31 | #The fit method actually fits the model to our training data
32 | model = model.fit(x,y)
33 | 
34 | #Create 100 random samples to try against our model as test data
35 | samples = [random.randint(0,1000) for i in range(0,100)]
36 | #Once again, we need a 2d Numpy array
37 | samples = np.array(samples)
38 | samples = samples.reshape(-1, 1)
39 | 
40 | #Now we use our model against the samples.  output is the probability, and _class is the class.
41 | _class = model.predict(samples)
42 | proba = model.predict_proba(samples)
43 | 
44 | num_accurate = 0
45 | 
46 | #Finally, output the results, formatted for nicer viewing.
47 | #The format is [<sample value>]: Class <class number>, probability [ <probability for class 0> <probability for class 1>]
48 | #So, the probability array is the probability of failure, followed by the probability of passing.
49 | #In an example run, [7]: Class 0, probability [  9.99966694e-01   3.33062825e-05]
50 | #Means that for value 7, the class is 0 (failure) and the probability of failure is 99.9%
51 | for i in range(0,100):
52 |     if (true_classifier(samples[i])) == (_class[i] == 1):
53 |         num_accurate = num_accurate + 1
54 |     print("" + str(samples[i]) + ": Class " + str(_class[i]) + ", probability " + str(proba[i]))
55 | #skip a line to separate overall result from sample output
56 | print("")
57 | print(str(num_accurate) +" out of 100 correct.")
58 | 


--------------------------------------------------------------------------------
/code/supervised/Naive_Bayes/bell_curve.py:
--------------------------------------------------------------------------------
 1 | import numpy as np
 2 | from scipy.stats import norm
 3 | import matplotlib.pyplot as plt
 4 | import seaborn as sns
 5 | 
 6 | # Create a bell curve plot using numpy and stats
 7 | x = np.linspace(norm.ppf(0.01), norm.ppf(0.99), 100)
 8 | sns.set_style("darkgrid")
 9 | plt.plot(x, norm.pdf(x))
10 | 
11 | # Remove ticks from the plot
12 | plt.xticks([])
13 | plt.yticks([])
14 | 
15 | plt.tight_layout()
16 | plt.show()
17 | 


--------------------------------------------------------------------------------
/code/supervised/Naive_Bayes/bernoulli.py:
--------------------------------------------------------------------------------
 1 | import numpy as np
 2 | from sklearn.naive_bayes import BernoulliNB
 3 | 
 4 | # The features in X are broken down as follows:
 5 | # [Walks like a duck, Talks like a duck, Is small]
 6 | #
 7 | # Walks like a duck: 0 = False, 1 = True
 8 | # Talks like a duck: 0 = False, 1 = True
 9 | # Is small: 0 = False, 1 = True
10 | 
11 | # Some data is created to train with
12 | X = np.array([[1, 1, 0], [0, 0, 1], [1, 0, 0]])
13 | # These are our target values (Classes: Duck or Not a duck)
14 | y = np.array(['Duck', 'Not a Duck', 'Not a Duck'])
15 | 
16 | # This is the code we need for the Bernoulli model
17 | clf = BernoulliNB()
18 | # We train the model on our data
19 | clf.fit(X, y)
20 | 
21 | # Now we can make a prediction on what class new data belongs to
22 | print("Our data set represents things that are and aren't ducks.\n")
23 | print("We have trained a Bernoulli model on our data set.\n")
24 | print(("Let's consider a new input that:\n"
25 |        "   Walks like a duck\n"
26 |        "   Talks like a duck\n"
27 |        "   Is large\n"))
28 | print("What does our model think this should be?")
29 | print("Answer: %s!" % clf.predict([[1, 1, 1]])[0])
30 | 


--------------------------------------------------------------------------------
/code/supervised/Naive_Bayes/gaussian.py:
--------------------------------------------------------------------------------
 1 | import numpy as np
 2 | from sklearn.naive_bayes import GaussianNB
 3 | 
 4 | # The features in X are broken down as follows:
 5 | # [Red %, Green %, Blue %]
 6 | 
 7 | # Some data is created to train with
 8 | X = np.array([[.5, 0, .5], [1, 1, 0], [0, 0, 0]])
 9 | # These are our target values (Classes: Purple, Yellow, or Black)
10 | y = np.array(['Purple', 'Yellow', 'Black'])
11 | 
12 | # This is the code we need for the Gaussian model
13 | clf = GaussianNB()
14 | # We train the model on our data
15 | clf.fit(X, y)
16 | 
17 | # Now we can make a prediction on what class new data belongs to
18 | print("Our data set represents RGB triples and their associated colors.\n")
19 | print("We have trained a Gaussian model on our data set.\n")
20 | print("Let's consider a new input with 100% red, 0% green, and 100% blue.\n")
21 | print("What color does our model think this should be?")
22 | print("Answer: %s!" % clf.predict([[1, 0, 1]])[0])
23 | 


--------------------------------------------------------------------------------
/code/supervised/Naive_Bayes/multinomial.py:
--------------------------------------------------------------------------------
 1 | import numpy as np
 2 | from sklearn.naive_bayes import MultinomialNB
 3 | 
 4 | # The features in X are broken down as follows:
 5 | # [Size, Weight, Color]
 6 | #
 7 | # Size: 0 = Small, 1 = Moderate, 2 = Large
 8 | # Weight: 0 = Light, 1 = Moderate, 2 = Heavy
 9 | # Color: 0 = Red, 1 = Blue, 2 = Brown
10 | 
11 | # Some data is created to train with
12 | X = np.array([[1, 1, 0], [0, 0, 1], [2, 2, 2]])
13 | # These are our target values (Classes: Apple, Blueberry, or Coconut)
14 | y = np.array(['Apple', 'Blueberry', 'Coconut'])
15 | 
16 | # This is the code we need for the Multinomial model
17 | clf = MultinomialNB()
18 | # We train the model on our data
19 | clf.fit(X, y)
20 | 
21 | # Now we can make a prediction on what class new data belongs to
22 | print("Our data set represents fruits and their characteristics.\n")
23 | print("We have trained a Multinomial model on our data set.\n")
24 | print("Let's consider a new input that is moderately sized, heavy, and red.\n")
25 | print("What fruit does our model think this should be?")
26 | print("Answer: %s!" % clf.predict([[1, 2, 0]])[0])
27 | 


--------------------------------------------------------------------------------
/code/unsupervised/Clustering/clustering_hierarchical.py:
--------------------------------------------------------------------------------
 1 | import matplotlib.pyplot as plt
 2 | import seaborn as sns
 3 | import numpy as np
 4 | from sklearn.cluster import AgglomerativeClustering
 5 | from collections import defaultdict
 6 | from scipy.spatial import ConvexHull
 7 | 
 8 | # This data set represents a toy manufacturer's product data
 9 | #
10 | # The first value in the pair represents a toy:
11 | #    0-2: Action Figures
12 | #    3-5: Building Blocks
13 | #    6-8: Cars
14 | #
15 | # The second value is the age group that buys the most of that toy:
16 | #    0: 5 year-olds
17 | #    1: 6 year-olds
18 | #    2: 7 year-olds
19 | #    3: 8 year-olds
20 | #    4: 9 year-olds
21 | #    5: 10 year-olds
22 | x = np.array([[0,4], [1,3], [2,5], [3,2], [4,0], [5,1], [6,4], [7,5], [8,3]])
23 | 
24 | # Set up hierarchical clustering and stop at 3 clusters
25 | num_clusters = 3
26 | hierarchical = AgglomerativeClustering(n_clusters=num_clusters).fit(x)
27 | 
28 | # Plot the data
29 | sns.set_style("darkgrid")
30 | colors = plt.get_cmap("winter")
31 | points = plt.scatter(x[:, 0], x[:, 1], c=hierarchical.labels_,
32 |             cmap=colors)
33 | 
34 | # Draw in the cluster regions
35 | regions = defaultdict(list)
36 | # Split points based on cluster
37 | for index, label in enumerate(hierarchical.labels_):
38 |     regions[label].append(list(x[index]))
39 | 
40 | # If a cluster has more than 2 points, find the convex hull for the region
41 | # Otherwise just draw a connecting line
42 | for key in regions:
43 |     cluster = np.array(regions[key])
44 |     if len(cluster) > 2:
45 |         hull = ConvexHull(cluster)
46 |         vertices = hull.vertices
47 |         vertices = np.append(vertices, hull.vertices[0])
48 |         plt.plot(cluster[vertices, 0], cluster[vertices, 1],
49 |                  color=points.to_rgba(key))
50 |     else:
51 |         np.append(cluster, cluster[0])
52 |         x_region, y_region = zip(*cluster)
53 |         plt.plot(x_region, y_region, color=points.to_rgba(key))
54 | 
55 | # Remove ticks from the plot
56 | plt.xticks([])
57 | plt.yticks([])
58 | 
59 | plt.tight_layout()
60 | plt.show()
61 | 


--------------------------------------------------------------------------------
/code/unsupervised/Clustering/clustering_kmeans.py:
--------------------------------------------------------------------------------
 1 | import matplotlib.pyplot as plt
 2 | import seaborn as sns
 3 | import numpy as np
 4 | from sklearn.cluster import KMeans
 5 | from scipy.spatial import Voronoi, voronoi_plot_2d
 6 | 
 7 | # This data set represents a toy manufacturer's product data
 8 | #
 9 | # The first value in the pair represents a toy:
10 | #    0-2: Action Figures
11 | #    3-5: Building Blocks
12 | #    6-8: Cars
13 | #
14 | # The second value is the age group that buys the most of that toy:
15 | #    0: 5 year-olds
16 | #    1: 6 year-olds
17 | #    2: 7 year-olds
18 | #    3: 8 year-olds
19 | #    4: 9 year-olds
20 | #    5: 10 year-olds
21 | x = np.array([[0,4], [1,3], [2,5], [3,2], [4,0], [5,1], [6,4], [7,5], [8,3]])
22 | 
23 | # Set up K-Means clustering with a fixed start and stop at 3 clusters
24 | kmeans = KMeans(n_clusters=3, random_state=0).fit(x)
25 | 
26 | # Plot the data
27 | sns.set_style("darkgrid")
28 | plt.scatter(x[:, 0], x[:, 1], c=kmeans.labels_, cmap=plt.get_cmap("winter"))
29 | 
30 | # Save the axes limits of the current figure
31 | x_axis = plt.gca().get_xlim()
32 | y_axis = plt.gca().get_ylim()
33 | 
34 | # Draw cluster boundaries and centers
35 | centers = kmeans.cluster_centers_
36 | plt.scatter(centers[:, 0], centers[:, 1], marker='x')
37 | vor = Voronoi(centers)
38 | voronoi_plot_2d(vor, ax=plt.gca(), show_points=False, show_vertices=False)
39 | 
40 | # Resize figure as needed
41 | plt.gca().set_xlim(x_axis)
42 | plt.gca().set_ylim(y_axis)
43 | 
44 | # Remove ticks from the plot
45 | plt.xticks([])
46 | plt.yticks([])
47 | 
48 | plt.tight_layout()
49 | plt.show()
50 | 


--------------------------------------------------------------------------------
/code/unsupervised/PCA/pca.py:
--------------------------------------------------------------------------------
 1 | from sklearn.decomposition import PCA
 2 | import matplotlib.pyplot as plt
 3 | import numpy as np
 4 | 
 5 | # A value we picked to always display the same results
 6 | # Feel free to change this to any value greater than 0 view different random value outcomes
 7 | seed = 9000
 8 | 
 9 | # We're using a seeded random state so we always get the same outcome
10 | seeded_state = np.random.RandomState(seed=seed)
11 | 
12 | # Returns a random 150 points (x, y pairs) in a gaussian distribution,
13 | # IE most of the points fall close to the average with a few outliers
14 | rand_points = seeded_state.randn(150, 2)
15 | 
16 | # The @ operator performs matrix multiplication, and serves to bring
17 | # our gaussian distribution points closer together
18 | points = rand_points @ seeded_state.rand(2, 2)
19 | x = points[:, 0]
20 | y = points[:, 1]
21 | 
22 | # Now we have a sample dataset of 150 points to perform PCA on, so
23 | # go ahead and display this in a plot.
24 | plt.scatter(x, y, alpha=0.5)
25 | plt.title("Sample Dataset")
26 | 
27 | print("Plotting our created dataset...\n")
28 | print("Points:")
29 | for p in points[:10, :]:
30 |     print("({:7.4f}, {:7.4f})".format(p[0], p[1]))
31 | print("...\n")
32 | 
33 | plt.show()
34 | 
35 | # Find two principal components from our given dataset
36 | pca = PCA(n_components = 2)
37 | pca.fit(points)
38 | 
39 | # Once we are fitted, we have access to inner mean_, components_, and explained_variance_ variables
40 | # Use these to add some arrows to our plot
41 | plt.scatter(x, y, alpha=0.5)
42 | plt.title("Sample Dataset with Principal Component Lines")
43 | for var, component in zip(pca.explained_variance_, pca.components_):
44 |     plt.annotate(
45 |         "",
46 |         component * np.sqrt(var) * 2 + pca.mean_,
47 |         pca.mean_,
48 |         arrowprops = {
49 |             "arrowstyle": "->",
50 |             "linewidth": 2
51 |         }
52 |     )
53 | 
54 | print("Plotting our calculated principal components...\n")
55 | 
56 | plt.show()
57 | 
58 | # Reduce the dimensionality of our data using a PCA transformation
59 | pca = PCA(n_components = 1)
60 | transformed_points = pca.fit_transform(points)
61 | 
62 | # Note that all the inverse transformation does is transforms the data to its original space.
63 | # In practice, this is unnecessary. For this example, all data would be along the x axis.
64 | # We use it here for visualization purposes
65 | inverse = pca.inverse_transform(transformed_points)
66 | t_x = inverse[:, 0]
67 | t_y = inverse[:, 0]
68 | 
69 | # Plot the original and transformed data sets
70 | plt.scatter(x, y, alpha=0.3)
71 | plt.scatter(t_x, t_y, alpha=0.7)
72 | plt.title("Sample Dataset (Blue) and Transformed Dataset (Orange)")
73 | 
74 | print("Plotting our dataset with a dimensionality reduction...")
75 | 
76 | plt.show()
77 | 


--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
 1 | # Minimal makefile for Sphinx documentation
 2 | #
 3 | 
 4 | # You can set these variables from the command line.
 5 | SPHINXOPTS    =
 6 | SPHINXBUILD   = python -msphinx
 7 | SPHINXPROJ    = MachineLearningCourse
 8 | SOURCEDIR     = source
 9 | BUILDDIR      = build
10 | 
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | 	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 | 
15 | .PHONY: help Makefile
16 | 
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | 	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)


--------------------------------------------------------------------------------
/docs/build/doctrees/authorship/author.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/authorship/author.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/content/deep_learning/autoencoder.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/content/deep_learning/autoencoder.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/content/deep_learning/cnn.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/content/deep_learning/cnn.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/content/deep_learning/mlp.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/content/deep_learning/mlp.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/content/overview/crossvalidation.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/content/overview/crossvalidation.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/content/overview/linear-regression.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/content/overview/linear-regression.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/content/overview/overfitting.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/content/overview/overfitting.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/content/overview/regularization.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/content/overview/regularization.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/content/supervised/bayes.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/content/supervised/bayes.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/content/supervised/decisiontrees.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/content/supervised/decisiontrees.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/content/supervised/knn.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/content/supervised/knn.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/content/supervised/linear_SVM.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/content/supervised/linear_SVM.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/content/supervised/logistic_regression.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/content/supervised/logistic_regression.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/content/unsupervised/clustering.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/content/unsupervised/clustering.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/content/unsupervised/pca.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/content/unsupervised/pca.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/credentials/CODE_OF_CONDUCT.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/credentials/CODE_OF_CONDUCT.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/credentials/CONTRIBUTING.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/credentials/CONTRIBUTING.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/credentials/LICENSE.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/credentials/LICENSE.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/environment.pickle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/environment.pickle


--------------------------------------------------------------------------------
/docs/build/doctrees/index.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/index.doctree


--------------------------------------------------------------------------------
/docs/build/doctrees/intro/intro.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/doctrees/intro/intro.doctree


--------------------------------------------------------------------------------
/docs/build/html/.buildinfo:
--------------------------------------------------------------------------------
1 | # Sphinx build info version 1
2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3 | config: be226aaae6a52163ec5827a21b64a2c1
4 | tags: 645f666f9bcd5a90fca523b33c5a78b7
5 | 


--------------------------------------------------------------------------------
/docs/build/html/_images/Bayes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Bayes.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Bell_Curve.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Bell_Curve.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Convo_Output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Convo_Output.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Cost.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Cost.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Data_Set.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Data_Set.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Dec_Trees_Pruning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Dec_Trees_Pruning.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Error_Function.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Error_Function.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Exponential.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Exponential.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Exponential_Transformed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Exponential_Transformed.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Filter1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Filter1.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Filter2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Filter2.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Filter3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Filter3.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Filtering.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Filtering.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Flatten.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Flatten.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Gini_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Gini_1.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Gini_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Gini_2.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Gini_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Gini_3.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Gini_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Gini_4.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Gini_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Gini_5.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Gini_6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Gini_6.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Gini_7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Gini_7.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Gini_8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Gini_8.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Gini_Impurity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Gini_Impurity.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Gini_Information_Gain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Gini_Information_Gain.png


--------------------------------------------------------------------------------
/docs/build/html/_images/GoodFit.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/GoodFit.PNG


--------------------------------------------------------------------------------
/docs/build/html/_images/Hierarchical.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Hierarchical.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Hierarchical_Step1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Hierarchical_Step1.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Hierarchical_Step2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Hierarchical_Step2.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Images.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Images.png


--------------------------------------------------------------------------------
/docs/build/html/_images/KMeans.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/KMeans.png


--------------------------------------------------------------------------------
/docs/build/html/_images/KNN_KDTree.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/KNN_KDTree.jpg


--------------------------------------------------------------------------------
/docs/build/html/_images/K_Means_Final.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/K_Means_Final.png


--------------------------------------------------------------------------------
/docs/build/html/_images/K_Means_Final_Alt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/K_Means_Final_Alt.png


--------------------------------------------------------------------------------
/docs/build/html/_images/K_Means_Step2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/K_Means_Step2.png


--------------------------------------------------------------------------------
/docs/build/html/_images/K_Means_Step3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/K_Means_Step3.png


--------------------------------------------------------------------------------
/docs/build/html/_images/LOOCV.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/LOOCV.png


--------------------------------------------------------------------------------
/docs/build/html/_images/LPOCV.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/LPOCV.png


--------------------------------------------------------------------------------
/docs/build/html/_images/LR.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/LR.png


--------------------------------------------------------------------------------
/docs/build/html/_images/LR_LOBF.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/LR_LOBF.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Layers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Layers.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Layers_Final.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Layers_Final.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Linear_Equation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Linear_Equation.png


--------------------------------------------------------------------------------
/docs/build/html/_images/MLP_0.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/MLP_0.PNG


--------------------------------------------------------------------------------
/docs/build/html/_images/MLP_1.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/MLP_1.PNG


--------------------------------------------------------------------------------
/docs/build/html/_images/MLP_2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/MLP_2.PNG


--------------------------------------------------------------------------------
/docs/build/html/_images/MSE_Function.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/MSE_Function.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Not_Linear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Not_Linear.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Overfit_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Overfit_small.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Padding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Padding.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Pooled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Pooled.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Possible_hyperplane.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Possible_hyperplane.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Regularization_Lasso.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Regularization_Lasso.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Regularization_Linear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Regularization_Linear.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Regularization_Polynomial.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Regularization_Polynomial.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Regularization_Quadratic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Regularization_Quadratic.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Regularization_Ridge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Regularization_Ridge.png


--------------------------------------------------------------------------------
/docs/build/html/_images/SVM_Kernal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/SVM_Kernal.png


--------------------------------------------------------------------------------
/docs/build/html/_images/SVM_Kernel2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/SVM_Kernel2.png


--------------------------------------------------------------------------------
/docs/build/html/_images/SVM_Outliers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/SVM_Outliers.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Square_Error_Function.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Square_Error_Function.png


--------------------------------------------------------------------------------
/docs/build/html/_images/Underfit.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/Underfit.PNG


--------------------------------------------------------------------------------
/docs/build/html/_images/WikiLogistic.svg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/WikiLogistic.svg.png


--------------------------------------------------------------------------------
/docs/build/html/_images/ae.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/ae.png


--------------------------------------------------------------------------------
/docs/build/html/_images/decision_tree_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/decision_tree_1.png


--------------------------------------------------------------------------------
/docs/build/html/_images/decision_tree_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/decision_tree_2.png


--------------------------------------------------------------------------------
/docs/build/html/_images/decision_tree_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/decision_tree_3.png


--------------------------------------------------------------------------------
/docs/build/html/_images/decision_tree_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/decision_tree_4.png


--------------------------------------------------------------------------------
/docs/build/html/_images/holdout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/holdout.png


--------------------------------------------------------------------------------
/docs/build/html/_images/kfold.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/kfold.png


--------------------------------------------------------------------------------
/docs/build/html/_images/knn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/knn.png


--------------------------------------------------------------------------------
/docs/build/html/_images/knn_output_k1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/knn_output_k1.png


--------------------------------------------------------------------------------
/docs/build/html/_images/knn_output_k9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/knn_output_k9.png


--------------------------------------------------------------------------------
/docs/build/html/_images/latex-lasso-eq.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/latex-lasso-eq.gif


--------------------------------------------------------------------------------
/docs/build/html/_images/latex-ridge-eq.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/latex-ridge-eq.gif


--------------------------------------------------------------------------------
/docs/build/html/_images/linear_svm_output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/linear_svm_output.png


--------------------------------------------------------------------------------
/docs/build/html/_images/optimal_hyperplane.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/optimal_hyperplane.png


--------------------------------------------------------------------------------
/docs/build/html/_images/pca1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/pca1.png


--------------------------------------------------------------------------------
/docs/build/html/_images/pca2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/pca2.png


--------------------------------------------------------------------------------
/docs/build/html/_images/pca3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/pca3.png


--------------------------------------------------------------------------------
/docs/build/html/_images/pca4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/pca4.png


--------------------------------------------------------------------------------
/docs/build/html/_images/pca5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/pca5.png


--------------------------------------------------------------------------------
/docs/build/html/_images/pca6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/pca6.png


--------------------------------------------------------------------------------
/docs/build/html/_images/shopping_table.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_images/shopping_table.png


--------------------------------------------------------------------------------
/docs/build/html/_sources/authorship/author.rst.txt:
--------------------------------------------------------------------------------
 1 | ***************
 2 | Authorship
 3 | ***************
 4 | 
 5 | **Creator**: Machine Learning Mindset [`Blog
 6 | <https://machinelearningmindset.com/blog/>`_, `GitHub
 7 | <https://github.com/machinelearningmindset>`_, `Twitter
 8 | <https://twitter.com/machinemindset>`_]
 9 | 
10 | **Supervisor**: Amirsina Torfi [`GitHub
11 | <https://github.com/astorfi>`_, `Personal Website
12 | <https://astorfi.github.io/>`_, `Linkedin
13 | <https://www.linkedin.com/in/amirsinatorfi/>`_ ]
14 | 
15 | **Developers**: Brendan Sherman\*, James E Hopkins\* [`Linkedin <https://www.linkedin.com/in/jhopk>`_], Zac Smith [`Linkedin <https://www.linkedin.com/in/zac-smith-a7bb60185/i>`_]
16 | 
17 | **NOTE**: This project has been developed as a capstone project offered by [`CS 4624 Multimedia/ Hypertext course at Virginia Tech <https://vtechworks.lib.vt.edu/handle/10919/90655>`_] and
18 | Supervised and supported by [`Machine Learning Mindset <https://machinelearningmindset.com/>`_].
19 | 
20 | \*: equally contributed
21 | 


--------------------------------------------------------------------------------
/docs/build/html/_sources/content/overview/overfitting.rst.txt:
--------------------------------------------------------------------------------
  1 | ================================
  2 | Overfitting and Underfitting
  3 | ================================
  4 | 
  5 | .. contents::
  6 |   :local:
  7 |   :depth: 3
  8 | 
  9 | ----------------------------
 10 | Overview
 11 | ----------------------------
 12 | When using machine learning, there are many ways to go wrong.
 13 | Some of the most common issues in machine learning are **overfitting** and **underfitting**.
 14 | To understand these concepts, let's imagine a machine learning model that is
 15 | trying to learn to classify numbers, and has access to a training set of data and a testing set of data.
 16 | 
 17 | ----------------------------
 18 | Overfitting
 19 | ----------------------------
 20 | 
 21 | A model suffers from **Overfitting** when it has learned too much from the
 22 | training data, and does not perform well in practice as a result.
 23 | This is usually caused by the model having too much exposure to the training data.
 24 | For the number classification example, if the model is overfit in this way, it
 25 | may be picking up on tiny details that are misleading, like stray marks as an indication of a specific number.
 26 | 
 27 | The estimate looks pretty good when you look at the middle of the graph, but the edges have large error.
 28 | In practice, this error isn't always at edge cases and can pop up anywhere.
 29 | The noise in training can cause error as seen in the graph below.
 30 | 
 31 | .. figure:: _img/Overfit_small.png
 32 |    :scale: 100 %
 33 |    :alt: Overfit
 34 | (Created using https://www.desmos.com/calculator/dffnj2jbow)
 35 | 
 36 | In this example, the data is overfit by a polynomial degree.
 37 | The points indicated are true to the function y = x^2, but does not approximate the function well outside of those points.
 38 | 
 39 | ----------------------------
 40 | Underfitting
 41 | ----------------------------
 42 | 
 43 | A model suffers from **Underfitting** when it has not learned enough from the
 44 | training data, and does not perform well in practice as a result.
 45 | As a direct contrast to the previous idea, this issue is caused by not letting
 46 | the model learn enough from training data.
 47 | In the number classification example, if the training set is too small or the
 48 | model has not had enough attempts to learn from it, then it will not be able to pick out key features of the numbers.
 49 | 
 50 | 
 51 | The issue with this estimate is clear to the human eye, the model should be
 52 | nonlinear, and is instead just a simple line.
 53 | In machine learning, this could be a result of underfitting, the model has not
 54 | had enough exposure to training data to adapt to it, and is currently in a simple state.
 55 | 
 56 | .. figure:: _img/Underfit.PNG
 57 |    :scale: 100 %
 58 |    :alt: Underfit
 59 | (Created using Wolfram Alpha)
 60 | 
 61 | ----------------------------
 62 | Motivation
 63 | ----------------------------
 64 | 
 65 | Finding a good fit is one of the central problems in machine learning.
 66 | Gaining a good grasp of how to avoid fitting problems before even worrying
 67 | about specific methods can keep models on track.
 68 | The mindset of hunting for a good fit, rather than throwing more learning
 69 | time at a model is very important to have.
 70 | 
 71 | ----------------------------
 72 | Code
 73 | ----------------------------
 74 | 
 75 | The example code for overfitting shows some basic examples based in polynomial
 76 | interpolation, trying to find the equation of a graph.
 77 | The overfitting.py_ file, you can see that there is a true function being
 78 | modeled, as well as some estimates that are shown to not be accurate.
 79 | 
 80 | .. _overfitting.py: https://github.com/machinelearningmindset/machine-learning-course/blob/master/code/overview/overfitting/overfitting.py
 81 | 
 82 | The estimates are representations of overfitting and underfitting.
 83 | For overfitting, a higher degree polynomial is used (x cubed instead of squared).
 84 | While the data is relatively close for the chosen points, there are some artifacts outside of them.
 85 | The example of underfitting, however, does not even achieve accuracy at many of the points.
 86 | Underfitting is similar to having a linear model when trying to model a quadratic function.
 87 | The model does well on the point(s) it trained on, in this case the point used
 88 | for the linear estimate, but poorly otherwise.
 89 | 
 90 | 
 91 | ----------------------------
 92 | Conclusion
 93 | ----------------------------
 94 | 
 95 | Check out the cross-validation and regularization sections for information on
 96 | how to avoid overfitting in machine learning models.
 97 | Ideally, a good fit looks something like this:
 98 | 
 99 | .. figure:: _img/GoodFit.PNG
100 |    :scale: 100 %
101 |    :alt: Underfit
102 | (Created using Wolfram Alpha)
103 | 
104 | 
105 | When using machine learning in any capacity, issues such as overfitting
106 | frequently come up, and having a grasp of the concept is very important.
107 | The modules in this section are among the most important in the whole repository,
108 | since regardless of the implementation, machine learning always includes these fundamentals.
109 | 
110 | 
111 | ----------
112 | References
113 | ----------
114 | 
115 | 1. https://machinelearningmastery.com/overfitting-and-underfitting-with-machine-learning-algorithms/
116 | 2. https://medium.com/greyatom/what-is-underfitting-and-overfitting-in-machine-learning-and-how-to-deal-with-it-6803a989c76
117 | 3. https://towardsdatascience.com/overfitting-vs-underfitting-a-conceptual-explanation-d94ee20ca7f9
118 | 
119 | 


--------------------------------------------------------------------------------
/docs/build/html/_sources/credentials/CODE_OF_CONDUCT.rst.txt:
--------------------------------------------------------------------------------
 1 | Contributor Covenant Code of Conduct
 2 | ====================================
 3 | 
 4 | Our Pledge
 5 | ----------
 6 | 
 7 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
 8 | 
 9 | Our Standards
10 | -------------
11 | 
12 | Examples of behavior that contributes to creating a positive environment include:
13 | 
14 | * Using welcoming and inclusive language
15 | * Being respectful of differing viewpoints and experiences
16 | * Gracefully accepting constructive criticism
17 | * Focusing on what is best for the community
18 | * Showing empathy towards other community members
19 | 
20 | Examples of unacceptable behavior by participants include:
21 | 
22 | * The use of sexualized language or imagery and unwelcome sexual attention or advances
23 | * Trolling, insulting/derogatory comments, and personal or political attacks
24 | * Public or private harassment
25 | * Publishing others' private information, such as a physical or electronic address, without explicit permission
26 | * Other conduct which could reasonably be considered inappropriate in a professional setting
27 | 
28 | Our Responsibilities
29 | --------------------
30 | 
31 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
32 | 
33 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
34 | 
35 | Scope
36 | -----
37 | 
38 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
39 | 
40 | Enforcement
41 | -----------
42 | 
43 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at amirsina.torfi@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
44 | 
45 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
46 | 
47 | Attribution
48 | ------------
49 | 
50 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
51 | 
52 | [homepage]: http://contributor-covenant.org
53 | [version]: http://contributor-covenant.org/version/1/4/
54 | 


--------------------------------------------------------------------------------
/docs/build/html/_sources/credentials/CONTRIBUTING.rst.txt:
--------------------------------------------------------------------------------
 1 | 
 2 | *************
 3 | Contributing
 4 | *************
 5 | 
 6 | *For typos, please do not create a pull request. Instead, declare them in issues or email the repository owner*. Please note we have a code of conduct, please follow it in all your interactions with the project.
 7 | 
 8 | ====================
 9 | Pull Request Process
10 | ====================
11 | 
12 | Please consider the following criterions in order to help us in a better way:
13 | 
14 | 1. The pull request is mainly expected to be a link suggestion.
15 | 2. Please make sure your suggested resources are not obsolete or broken.
16 | 3. Ensure any install or build dependencies are removed before the end of the layer when doing a
17 |    build and creating a pull request.
18 | 4. Add comments with details of changes to the interface, this includes new environment
19 |    variables, exposed ports, useful file locations and container parameters.
20 | 5. You may merge the Pull Request in once you have the sign-off of at least one other developer, or if you
21 |    do not have permission to do that, you may request the owner to merge it for you if you believe all checks are passed.
22 | 
23 | ============
24 | Final Note
25 | ============
26 | 
27 | We are looking forward to your kind feedback. Please help us to improve this open source project and make our work better.
28 | For contribution, please create a pull request and we will investigate it promptly. Once again, we appreciate
29 | your kind feedback and elaborate code inspections.
30 | 


--------------------------------------------------------------------------------
/docs/build/html/_sources/credentials/LICENSE.rst.txt:
--------------------------------------------------------------------------------
 1 | LICENSE
 2 | ========
 3 | 
 4 | MIT License
 5 | 
 6 | Copyright (c) 2019 Amirsina Torfi
 7 | 
 8 | Permission is hereby granted, free of charge, to any person obtaining a copy
 9 | of this software and associated documentation files (the "Software"), to deal
10 | in the Software without restriction, including without limitation the rights
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | copies of the Software, and to permit persons to whom the Software is
13 | furnished to do so, subject to the following conditions:
14 | 
15 | The above copyright notice and this permission notice shall be included in all
16 | copies or substantial portions of the Software.
17 | 
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | SOFTWARE.
25 | 


--------------------------------------------------------------------------------
/docs/build/html/_sources/index.rst.txt:
--------------------------------------------------------------------------------
 1 | .. TensoFlow-World-Resources documentation master file, created by
 2 |    sphinx-quickstart on Wed Jul  5 16:28:45 2017.
 3 |    You can adapt this file completely to your liking, but it should at least
 4 |    contain the root `toctree` directive.
 5 | 
 6 | Welcome to Python Machine Learning course!
 7 | =====================================================
 8 | 
 9 | .. toctree::
10 |    :maxdepth: 3
11 |    :caption: Table of Content
12 | 
13 |    authorship/author
14 | 
15 | .. toctree::
16 |    :maxdepth: 3
17 |    :caption: Foreword
18 | 
19 |    intro/intro
20 | 
21 | .. toctree::
22 |    :maxdepth: 3
23 |    :caption: Core Concepts
24 | 
25 |    content/overview/crossvalidation
26 |    content/overview/linear-regression
27 |    content/overview/overfitting
28 |    content/overview/regularization
29 | 
30 | .. toctree::
31 |   :maxdepth: 3
32 |   :caption: Supervised Learning
33 | 
34 |   content/supervised/logistic_regression
35 |   content/supervised/bayes
36 |   content/supervised/decisiontrees
37 |   content/supervised/knn
38 |   content/supervised/linear_SVM
39 | 
40 | .. toctree::
41 |   :maxdepth: 3
42 |   :caption: Unsupervised Learning
43 | 
44 |   content/unsupervised/clustering
45 |   content/unsupervised/pca
46 | 
47 | .. toctree::
48 |   :maxdepth: 3
49 |   :caption: Deep Learning
50 | 
51 |   content/deep_learning/mlp
52 |   content/deep_learning/cnn
53 |   content/deep_learning/autoencoder
54 | 
55 | .. toctree::
56 |    :maxdepth: 3
57 |    :caption: Document Credentials
58 | 
59 |    credentials/LICENSE
60 | 


--------------------------------------------------------------------------------
/docs/build/html/_sources/intro/intro.rst.txt:
--------------------------------------------------------------------------------
 1 | ***************
 2 | Introduction
 3 | ***************
 4 | 
 5 | The purpose of this project is to provide a comprehensive and yet simple course in Machine Learning using Python.
 6 | 
 7 | 
 8 | ====================================
 9 | Machine Learning Overview
10 | ====================================
11 | 
12 | ------------------------------------------------------------
13 | How was the advent and evolution of machine learning?
14 | ------------------------------------------------------------
15 | 
16 | You can argue that the start of modern machine learning comes from Alan Turing’s “Turing Test” of 1950. The Turing Test aimed to find out if a computer is brilliant (or at least smart enough to fool a human into thinking it is). Machine learning continued to develop with game playing computers. The games these computers play have grown more complicated over the years from checkers to chess to Go. Machine learning was also used to model pattern recognition systems in nature such as neural networks. But machine learning didn’t just stay confined to large computers stuck in rooms. Robots were designed that could use machine learning to navigate around obstacles automatically. We continue to see this concept in the self-driving cars of today. Machine learning eventually began to be used to analyze large sets of data to conclude. This allowed for humans to be able to digest large, complex systems through the use of machine learning. This was an advantageous result for those involved in marketing and advertisement as well as those concerned with complex data. Machine learning was also used for image and video recognition. Machine learning allowed for the classification of objects in pictures and videos as well as identification of specific landmarks of interest. Machine learning tools are now available through the Cloud and on large scale distributed systems.
17 | 
18 | 
19 | ------------------------------------------------------------
20 | Why is machine learning important?
21 | ------------------------------------------------------------
22 | 
23 | Machine learning has practical applications for a range of common business problems. By using machine learning, organizations can complete tasks in less time and more efficiently. One example could be preprocessing a set of data for a future stage that requires human intervention. Tasks that would have previously required lots of user input can now be automated to some degree. The saved resources can then be put towards something else that needs to be done. Beyond task automation, machine learning can be used to analyze large quantities of complex data to make predictions. Data analysis is an essential task for many businesses. For example, a company could analyze sales data to find out where profitable opportunities are or to find out where it risks losing money. Using machine learning can potentially allow for real-time analysis of complex data. Such an ability might be required for mission-critical systems. Machine learning is also an important topic for research and continued development. Currently, machine learning still has a lot of limitations and isn’t close to replacing the need for a live person. Machine learning’s constant evolution could offer solutions for hard problems that might take up too many resources now to even consider.
24 | 
25 | ------------------------------------------------------------------
26 | Who is using ML and why (government, healthcare system, etc.)?
27 | ------------------------------------------------------------------
28 | 
29 | Machine learning stands to impact most industries in some way so many managers and higher-ups are trying to at least learn what it is if not what it can do for them. Machine learning models are expected to get better at prediction when supplied with more information. Nowadays, it is effortless to obtain large amounts of information that can be used to train very accurate models. The computers of today are also stronger than those available in the past and offer options such as cloud solutions and distributed processing to tackle hard machine learning problems. Many of these options are readily available to almost anyone can use machine learning. We can see examples of machine learning in self-driving cars, recommendation systems, linguistic analysis, credit scoring, and security to name a few. Financial services can use machine learning to provide insights about client data and to predict areas of risk. Government agencies with access to large quantities of data and an interest in streamlining or at least speeding up parts of their services can utilize machine learning. Health care providers with cabinets full of patient data can use machine learning to aid in diagnosis as well as identifying health risks. Shopping services can use customers’ purchase histories and machine learning techniques to make personalized recommendations and gauge dangerous products. Anyone with a large amount of data stands to profit from using machine learning.
30 | 
31 | 
32 | ------------------------------------------------------------
33 | Further Reading
34 | ------------------------------------------------------------
35 | 
36 | * https://www.forbes.com/sites/bernardmarr/2016/02/19/a-short-history-of-machine-learning-every-manager-should-read/#15f4059615e7
37 | * https://www.interactions.com/blog/technology/machine-learning-important/
38 | * https://www.sas.com/en_us/insights/analytics/machine-learning.html
39 | * https://www.simplilearn.com/what-is-machine-learning-and-why-it-matters-article
40 | 


--------------------------------------------------------------------------------
/docs/build/html/_static/ajax-loader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/ajax-loader.gif


--------------------------------------------------------------------------------
/docs/build/html/_static/comment-bright.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/comment-bright.png


--------------------------------------------------------------------------------
/docs/build/html/_static/comment-close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/comment-close.png


--------------------------------------------------------------------------------
/docs/build/html/_static/comment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/comment.png


--------------------------------------------------------------------------------
/docs/build/html/_static/css/badge_only.css:
--------------------------------------------------------------------------------
1 | .fa:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-weight:normal;font-style:normal;src:url("../fonts/fontawesome-webfont.eot");src:url("../fonts/fontawesome-webfont.eot?#iefix") format("embedded-opentype"),url("../fonts/fontawesome-webfont.woff") format("woff"),url("../fonts/fontawesome-webfont.ttf") format("truetype"),url("../fonts/fontawesome-webfont.svg#FontAwesome") format("svg")}.fa:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .fa{display:inline-block;text-decoration:inherit}li .fa{display:inline-block}li .fa-large:before,li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-0.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before,ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before{content:""}.icon-book:before{content:""}.fa-caret-down:before{content:""}.icon-caret-down:before{content:""}.fa-caret-up:before{content:""}.icon-caret-up:before{content:""}.fa-caret-left:before{content:""}.icon-caret-left:before{content:""}.fa-caret-right:before{content:""}.icon-caret-right:before{content:""}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#2980B9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27AE60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book{float:left}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#E74C3C;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#F1C40F;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge .fa-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book{float:left}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}
2 | 


--------------------------------------------------------------------------------
/docs/build/html/_static/documentation_options.js:
--------------------------------------------------------------------------------
 1 | var DOCUMENTATION_OPTIONS = {
 2 |     URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
 3 |     VERSION: '1.0',
 4 |     LANGUAGE: 'en',
 5 |     COLLAPSE_INDEX: false,
 6 |     FILE_SUFFIX: '.html',
 7 |     HAS_SOURCE: true,
 8 |     SOURCELINK_SUFFIX: '.txt',
 9 |     NAVIGATION_WITH_KEYS: false,
10 | };


--------------------------------------------------------------------------------
/docs/build/html/_static/down-pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/down-pressed.png


--------------------------------------------------------------------------------
/docs/build/html/_static/down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/down.png


--------------------------------------------------------------------------------
/docs/build/html/_static/file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/file.png


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Inconsolata-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Inconsolata-Bold.ttf


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Inconsolata-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Inconsolata-Regular.ttf


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Inconsolata.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Inconsolata.ttf


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato-Bold.ttf


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato-Regular.ttf


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato/lato-bold.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato/lato-bold.eot


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato/lato-bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato/lato-bold.ttf


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato/lato-bold.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato/lato-bold.woff


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato/lato-bold.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato/lato-bold.woff2


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato/lato-bolditalic.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato/lato-bolditalic.eot


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato/lato-bolditalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato/lato-bolditalic.ttf


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff2


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato/lato-italic.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato/lato-italic.eot


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato/lato-italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato/lato-italic.ttf


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato/lato-italic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato/lato-italic.woff


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato/lato-italic.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato/lato-italic.woff2


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato/lato-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato/lato-regular.eot


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato/lato-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato/lato-regular.ttf


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato/lato-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato/lato-regular.woff


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/Lato/lato-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/Lato/lato-regular.woff2


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/RobotoSlab-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/RobotoSlab-Bold.ttf


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/RobotoSlab-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/RobotoSlab-Regular.ttf


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/fontawesome-webfont.eot


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/fontawesome-webfont.ttf


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/fontawesome-webfont.woff


--------------------------------------------------------------------------------
/docs/build/html/_static/fonts/fontawesome-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/fonts/fontawesome-webfont.woff2


--------------------------------------------------------------------------------
/docs/build/html/_static/js/theme.js:
--------------------------------------------------------------------------------
1 | /* sphinx_rtd_theme version 0.4.3 | MIT license */
2 | /* Built 20190212 16:02 */
3 | require=function r(s,a,l){function c(e,n){if(!a[e]){if(!s[e]){var i="function"==typeof require&&require;if(!n&&i)return i(e,!0);if(u)return u(e,!0);var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}var o=a[e]={exports:{}};s[e][0].call(o.exports,function(n){return c(s[e][1][n]||n)},o,o.exports,r,s,a,l)}return a[e].exports}for(var u="function"==typeof require&&require,n=0;n<l.length;n++)c(l[n]);return c}({"sphinx-rtd-theme":[function(n,e,i){var jQuery="undefined"!=typeof window?window.jQuery:n("jquery");e.exports.ThemeNav={navBar:null,win:null,winScroll:!1,winResize:!1,linkScroll:!1,winPosition:0,winHeight:null,docHeight:null,isRunning:!1,enable:function(e){var i=this;void 0===e&&(e=!0),i.isRunning||(i.isRunning=!0,jQuery(function(n){i.init(n),i.reset(),i.win.on("hashchange",i.reset),e&&i.win.on("scroll",function(){i.linkScroll||i.winScroll||(i.winScroll=!0,requestAnimationFrame(function(){i.onScroll()}))}),i.win.on("resize",function(){i.winResize||(i.winResize=!0,requestAnimationFrame(function(){i.onResize()}))}),i.onResize()}))},enableSticky:function(){this.enable(!0)},init:function(i){i(document);var t=this;this.navBar=i("div.wy-side-scroll:first"),this.win=i(window),i(document).on("click","[data-toggle='wy-nav-top']",function(){i("[data-toggle='wy-nav-shift']").toggleClass("shift"),i("[data-toggle='rst-versions']").toggleClass("shift")}).on("click",".wy-menu-vertical .current ul li a",function(){var n=i(this);i("[data-toggle='wy-nav-shift']").removeClass("shift"),i("[data-toggle='rst-versions']").toggleClass("shift"),t.toggleCurrent(n),t.hashChange()}).on("click","[data-toggle='rst-current-version']",function(){i("[data-toggle='rst-versions']").toggleClass("shift-up")}),i("table.docutils:not(.field-list,.footnote,.citation)").wrap("<div class='wy-table-responsive'></div>"),i("table.docutils.footnote").wrap("<div class='wy-table-responsive footnote'></div>"),i("table.docutils.citation").wrap("<div class='wy-table-responsive citation'></div>"),i(".wy-menu-vertical ul").not(".simple").siblings("a").each(function(){var e=i(this);expand=i('<span class="toctree-expand"></span>'),expand.on("click",function(n){return t.toggleCurrent(e),n.stopPropagation(),!1}),e.prepend(expand)})},reset:function(){var n=encodeURI(window.location.hash)||"#";try{var e=$(".wy-menu-vertical"),i=e.find('[href="'+n+'"]');if(0===i.length){var t=$('.document [id="'+n.substring(1)+'"]').closest("div.section");0===(i=e.find('[href="#'+t.attr("id")+'"]')).length&&(i=e.find('[href="#"]'))}0<i.length&&($(".wy-menu-vertical .current").removeClass("current"),i.addClass("current"),i.closest("li.toctree-l1").addClass("current"),i.closest("li.toctree-l1").parent().addClass("current"),i.closest("li.toctree-l1").addClass("current"),i.closest("li.toctree-l2").addClass("current"),i.closest("li.toctree-l3").addClass("current"),i.closest("li.toctree-l4").addClass("current"),i[0].scrollIntoView())}catch(o){console.log("Error expanding nav for anchor",o)}},onScroll:function(){this.winScroll=!1;var n=this.win.scrollTop(),e=n+this.winHeight,i=this.navBar.scrollTop()+(n-this.winPosition);n<0||e>this.docHeight||(this.navBar.scrollTop(i),this.winPosition=n)},onResize:function(){this.winResize=!1,this.winHeight=this.win.height(),this.docHeight=$(document).height()},hashChange:function(){this.linkScroll=!0,this.win.one("hashchange",function(){this.linkScroll=!1})},toggleCurrent:function(n){var e=n.closest("li");e.siblings("li.current").removeClass("current"),e.siblings().find("li.current").removeClass("current"),e.find("> ul li.current").removeClass("current"),e.toggleClass("current")}},"undefined"!=typeof window&&(window.SphinxRtdTheme={Navigation:e.exports.ThemeNav,StickyNav:e.exports.ThemeNav}),function(){for(var r=0,n=["ms","moz","webkit","o"],e=0;e<n.length&&!window.requestAnimationFrame;++e)window.requestAnimationFrame=window[n[e]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[n[e]+"CancelAnimationFrame"]||window[n[e]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(n,e){var i=(new Date).getTime(),t=Math.max(0,16-(i-r)),o=window.setTimeout(function(){n(i+t)},t);return r=i+t,o}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(n){clearTimeout(n)})}()},{jquery:"jquery"}]},{},["sphinx-rtd-theme"]);


--------------------------------------------------------------------------------
/docs/build/html/_static/minus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/minus.png


--------------------------------------------------------------------------------
/docs/build/html/_static/plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/plus.png


--------------------------------------------------------------------------------
/docs/build/html/_static/pygments.css:
--------------------------------------------------------------------------------
 1 | .highlight .hll { background-color: #ffffcc }
 2 | .highlight  { background: #eeffcc; }
 3 | .highlight .c { color: #408090; font-style: italic } /* Comment */
 4 | .highlight .err { border: 1px solid #FF0000 } /* Error */
 5 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */
 6 | .highlight .o { color: #666666 } /* Operator */
 7 | .highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */
 8 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
 9 | .highlight .cp { color: #007020 } /* Comment.Preproc */
10 | .highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */
11 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
12 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
13 | .highlight .gd { color: #A00000 } /* Generic.Deleted */
14 | .highlight .ge { font-style: italic } /* Generic.Emph */
15 | .highlight .gr { color: #FF0000 } /* Generic.Error */
16 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
17 | .highlight .gi { color: #00A000 } /* Generic.Inserted */
18 | .highlight .go { color: #333333 } /* Generic.Output */
19 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
20 | .highlight .gs { font-weight: bold } /* Generic.Strong */
21 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
22 | .highlight .gt { color: #0044DD } /* Generic.Traceback */
23 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
24 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
25 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
26 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */
27 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
28 | .highlight .kt { color: #902000 } /* Keyword.Type */
29 | .highlight .m { color: #208050 } /* Literal.Number */
30 | .highlight .s { color: #4070a0 } /* Literal.String */
31 | .highlight .na { color: #4070a0 } /* Name.Attribute */
32 | .highlight .nb { color: #007020 } /* Name.Builtin */
33 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
34 | .highlight .no { color: #60add5 } /* Name.Constant */
35 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */
36 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */
37 | .highlight .ne { color: #007020 } /* Name.Exception */
38 | .highlight .nf { color: #06287e } /* Name.Function */
39 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
40 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
41 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
42 | .highlight .nv { color: #bb60d5 } /* Name.Variable */
43 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
44 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */
45 | .highlight .mb { color: #208050 } /* Literal.Number.Bin */
46 | .highlight .mf { color: #208050 } /* Literal.Number.Float */
47 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */
48 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */
49 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */
50 | .highlight .sa { color: #4070a0 } /* Literal.String.Affix */
51 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */
52 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */
53 | .highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */
54 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
55 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */
56 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
57 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */
58 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
59 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */
60 | .highlight .sr { color: #235388 } /* Literal.String.Regex */
61 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */
62 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */
63 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
64 | .highlight .fm { color: #06287e } /* Name.Function.Magic */
65 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */
66 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */
67 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
68 | .highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */
69 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */


--------------------------------------------------------------------------------
/docs/build/html/_static/pythonml.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/pythonml.png


--------------------------------------------------------------------------------
/docs/build/html/_static/up-pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/up-pressed.png


--------------------------------------------------------------------------------
/docs/build/html/_static/up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/_static/up.png


--------------------------------------------------------------------------------
/docs/build/html/objects.inv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/build/html/objects.inv


--------------------------------------------------------------------------------
/docs/make.bat:
--------------------------------------------------------------------------------
 1 | @ECHO OFF
 2 | 
 3 | pushd %~dp0
 4 | 
 5 | REM Command file for Sphinx documentation
 6 | 
 7 | if "%SPHINXBUILD%" == "" (
 8 | 	set SPHINXBUILD=sphinx-build
 9 | )
10 | set SOURCEDIR=source
11 | set BUILDDIR=build
12 | set SPHINXPROJ=MachineLearningCourse
13 | 
14 | if "%1" == "" goto help
15 | 
16 | %SPHINXBUILD% >NUL 2>NUL
17 | if errorlevel 9009 (
18 | 	echo.
19 | 	echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
20 | 	echo.installed, then set the SPHINXBUILD environment variable to point
21 | 	echo.to the full path of the 'sphinx-build' executable. Alternatively you
22 | 	echo.may add the Sphinx directory to PATH.
23 | 	echo.
24 | 	echo.If you don't have Sphinx installed, grab it from
25 | 	echo.http://sphinx-doc.org/
26 | 	exit /b 1
27 | )
28 | 
29 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
30 | goto end
31 | 
32 | :help
33 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
34 | 
35 | :end
36 | popd
37 | 


--------------------------------------------------------------------------------
/docs/source/authorship/author.rst:
--------------------------------------------------------------------------------
 1 | ***************
 2 | Authorship
 3 | ***************
 4 | 
 5 | **Creator**: Machine Learning Mindset [`Blog
 6 | <https://machinelearningmindset.com/blog/>`_, `GitHub
 7 | <https://github.com/machinelearningmindset>`_, `Twitter
 8 | <https://twitter.com/machinemindset>`_]
 9 | 
10 | **Supervisor**: Amirsina Torfi [`GitHub
11 | <https://github.com/astorfi>`_, `Personal Website
12 | <https://astorfi.github.io/>`_, `Linkedin
13 | <https://www.linkedin.com/in/amirsinatorfi/>`_ ]
14 | 
15 | **Developers**: Brendan Sherman\*, James E Hopkins\* [`Linkedin <https://www.linkedin.com/in/jhopk>`_], Zac Smith [`Linkedin <https://www.linkedin.com/in/zac-smith-a7bb60185/i>`_]
16 | 
17 | **NOTE**: This project has been developed as a capstone project offered by [`CS 4624 Multimedia/ Hypertext course at Virginia Tech <https://vtechworks.lib.vt.edu/handle/10919/90655>`_] and
18 | Supervised and supported by [`Machine Learning Mindset <https://machinelearningmindset.com/>`_].
19 | 
20 | \*: equally contributed
21 | 


--------------------------------------------------------------------------------
/docs/source/conf.py:
--------------------------------------------------------------------------------
 1 | import os
 2 | import sys
 3 | 
 4 | import sphinx_rtd_theme
 5 | sys.path.insert(0, os.path.abspath('_ext'))
 6 | # from recommonmark.parser import CommonMarkParser
 7 | 
 8 | sys.path.insert(0, os.path.abspath('..'))
 9 | sys.path.append(os.path.dirname(__file__))
10 | # os.environ.setdefault("DJANGO_SETTINGS_MODULE", "readthedocs.settings.dev")
11 | 
12 | # from django.conf import settings
13 | 
14 | # import django
15 | # django.setup()
16 | 
17 | 
18 | sys.path.append(os.path.abspath('_ext'))
19 | extensions = [
20 |     'sphinx.ext.autodoc',
21 |     'sphinx.ext.intersphinx',
22 | ]
23 | templates_path = ['_templates']
24 | 
25 | edit_on_github_project = 'machinelearningmindset/machine-learning-course'
26 | 
27 | edit_on_github_branch = 'master'
28 | 
29 | source_suffix = ['.rst', '.md']
30 | # source_parsers = {
31 | #     '.md': CommonMarkParser,
32 | # }
33 | 
34 | master_doc = 'index'
35 | project = u'Machine-Learning-Course'
36 | copyright = u'2019, Amirsina Torfi'
37 | author = u'Amirsina Torfi'
38 | version = '1.0'
39 | release = '1.0'
40 | exclude_patterns = ['_build']
41 | default_role = 'obj'
42 | pygments_style = 'sphinx'
43 | # intersphinx_mapping = {
44 | #     'TensorFlow-World': ('https://github.com/astorfi/TensorFlow-World', None),
45 | # }
46 | htmlhelp_basename = 'ReadTheDocsdoc'
47 | latex_documents = [
48 |     (master_doc, 'Machine-Learning-Course.tex', u'Machine-Learning-Course Documentation',
49 |      u'Amirsina Torfi', 'manual'),
50 | ]
51 | 
52 | latex_logo = 'logo/pythonml.png'
53 | # latex_additional_files = ['flaskstyle.sty', 'logo/pythonml.pdf']
54 | 
55 | man_pages = [
56 |     (master_doc, 'Machine-Learning-Course', u'Machine-Learning-Course Documentation',
57 |      [author], 1)
58 | ]
59 | exclude_patterns = [
60 |     # 'api' # needed for ``make gettext`` to not die.
61 | ]
62 | 
63 | language = 'en'
64 | 
65 | locale_dirs = [
66 |     'locale/',
67 | ]
68 | gettext_compact = False
69 | 
70 | html_theme = 'sphinx_rtd_theme'
71 | html_static_path = ['_static']
72 | html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
73 | html_logo = 'logo/pythonml.png'
74 | html_theme_options = {
75 |     'logo_only': True,
76 |     'display_version': False,
77 | }
78 | 
79 | github_url='https://github.com/machinelearningmindset/machine-learning-course'
80 | 
81 | html_context = {
82 | "display_github": True, # Add 'Edit on Github' link instead of 'View page source'
83 | "last_updated": True,
84 | "commit": False,
85 |  'github_url': 'https://github.com/machinelearningmindset/machine-learning-course'
86 | }
87 | 
88 | 
89 | #def setup(app):
90 | #     app.add_stylesheet('custom.css')
91 | 


--------------------------------------------------------------------------------
/docs/source/content/deep_learning/_img/Convo_Output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/deep_learning/_img/Convo_Output.png


--------------------------------------------------------------------------------
/docs/source/content/deep_learning/_img/Filter1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/deep_learning/_img/Filter1.png


--------------------------------------------------------------------------------
/docs/source/content/deep_learning/_img/Filter2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/deep_learning/_img/Filter2.png


--------------------------------------------------------------------------------
/docs/source/content/deep_learning/_img/Filter3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/deep_learning/_img/Filter3.png


--------------------------------------------------------------------------------
/docs/source/content/deep_learning/_img/Filtering.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/deep_learning/_img/Filtering.png


--------------------------------------------------------------------------------
/docs/source/content/deep_learning/_img/Flatten.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/deep_learning/_img/Flatten.png


--------------------------------------------------------------------------------
/docs/source/content/deep_learning/_img/Images.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/deep_learning/_img/Images.png


--------------------------------------------------------------------------------
/docs/source/content/deep_learning/_img/Layers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/deep_learning/_img/Layers.png


--------------------------------------------------------------------------------
/docs/source/content/deep_learning/_img/Layers_Final.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/deep_learning/_img/Layers_Final.png


--------------------------------------------------------------------------------
/docs/source/content/deep_learning/_img/MLP_0.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/deep_learning/_img/MLP_0.PNG


--------------------------------------------------------------------------------
/docs/source/content/deep_learning/_img/MLP_1.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/deep_learning/_img/MLP_1.PNG


--------------------------------------------------------------------------------
/docs/source/content/deep_learning/_img/MLP_2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/deep_learning/_img/MLP_2.PNG


--------------------------------------------------------------------------------
/docs/source/content/deep_learning/_img/MLP_Node.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/deep_learning/_img/MLP_Node.PNG


--------------------------------------------------------------------------------
/docs/source/content/deep_learning/_img/Padding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/deep_learning/_img/Padding.png


--------------------------------------------------------------------------------
/docs/source/content/deep_learning/_img/Pooled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/deep_learning/_img/Pooled.png


--------------------------------------------------------------------------------
/docs/source/content/deep_learning/_img/ae.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/deep_learning/_img/ae.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Cost.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Cost.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Error_Function.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Error_Function.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Exponential.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Exponential.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Exponential_Transformed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Exponential_Transformed.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/GoodFit.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/GoodFit.PNG


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/LOOCV.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/LOOCV.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/LPOCV.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/LPOCV.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/LR.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/LR.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/LR_LOBF.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/LR_LOBF.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Linear_Equation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Linear_Equation.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/MSE_Function.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/MSE_Function.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Not_Linear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Not_Linear.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Optimal_hyperplane.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Optimal_hyperplane.PNG


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Overfit.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Overfit.PNG


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Overfit_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Overfit_small.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Possible_hyperplane.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Possible_hyperplane.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Regularization_Lasso.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Regularization_Lasso.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Regularization_Linear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Regularization_Linear.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Regularization_Polynomial.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Regularization_Polynomial.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Regularization_Quadratic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Regularization_Quadratic.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Regularization_Ridge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Regularization_Ridge.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/SVM_Kernal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/SVM_Kernal.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/SVM_Outliers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/SVM_Outliers.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Square_Error_Function.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Square_Error_Function.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/Underfit.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/Underfit.PNG


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/holdout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/holdout.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/kfold.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/kfold.png


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/latex-lasso-eq.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/latex-lasso-eq.gif


--------------------------------------------------------------------------------
/docs/source/content/overview/_img/latex-ridge-eq.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/overview/_img/latex-ridge-eq.gif


--------------------------------------------------------------------------------
/docs/source/content/overview/overfitting.rst:
--------------------------------------------------------------------------------
  1 | ================================
  2 | Overfitting and Underfitting
  3 | ================================
  4 | 
  5 | .. contents::
  6 |   :local:
  7 |   :depth: 3
  8 | 
  9 | ----------------------------
 10 | Overview
 11 | ----------------------------
 12 | When using machine learning, there are many ways to go wrong.
 13 | Some of the most common issues in machine learning are **overfitting** and **underfitting**.
 14 | To understand these concepts, let's imagine a machine learning model that is
 15 | trying to learn to classify numbers, and has access to a training set of data and a testing set of data.
 16 | 
 17 | ----------------------------
 18 | Overfitting
 19 | ----------------------------
 20 | 
 21 | A model suffers from **Overfitting** when it has learned too much from the
 22 | training data, and does not perform well in practice as a result.
 23 | This is usually caused by the model having too much exposure to the training data.
 24 | For the number classification example, if the model is overfit in this way, it
 25 | may be picking up on tiny details that are misleading, like stray marks as an indication of a specific number.
 26 | 
 27 | The estimate looks pretty good when you look at the middle of the graph, but the edges have large error.
 28 | In practice, this error isn't always at edge cases and can pop up anywhere.
 29 | The noise in training can cause error as seen in the graph below.
 30 | 
 31 | .. figure:: _img/Overfit_small.png
 32 |    :scale: 100 %
 33 |    :alt: Overfit
 34 | (Created using https://www.desmos.com/calculator/dffnj2jbow)
 35 | 
 36 | In this example, the data is overfit by a polynomial degree.
 37 | The points indicated are true to the function y = x^2, but does not approximate the function well outside of those points.
 38 | 
 39 | ----------------------------
 40 | Underfitting
 41 | ----------------------------
 42 | 
 43 | A model suffers from **Underfitting** when it has not learned enough from the
 44 | training data, and does not perform well in practice as a result.
 45 | As a direct contrast to the previous idea, this issue is caused by not letting
 46 | the model learn enough from training data.
 47 | In the number classification example, if the training set is too small or the
 48 | model has not had enough attempts to learn from it, then it will not be able to pick out key features of the numbers.
 49 | 
 50 | 
 51 | The issue with this estimate is clear to the human eye, the model should be
 52 | nonlinear, and is instead just a simple line.
 53 | In machine learning, this could be a result of underfitting, the model has not
 54 | had enough exposure to training data to adapt to it, and is currently in a simple state.
 55 | 
 56 | .. figure:: _img/Underfit.PNG
 57 |    :scale: 100 %
 58 |    :alt: Underfit
 59 | (Created using Wolfram Alpha)
 60 | 
 61 | ----------------------------
 62 | Motivation
 63 | ----------------------------
 64 | 
 65 | Finding a good fit is one of the central problems in machine learning.
 66 | Gaining a good grasp of how to avoid fitting problems before even worrying
 67 | about specific methods can keep models on track.
 68 | The mindset of hunting for a good fit, rather than throwing more learning
 69 | time at a model is very important to have.
 70 | 
 71 | ----------------------------
 72 | Code
 73 | ----------------------------
 74 | 
 75 | The example code for overfitting shows some basic examples based in polynomial
 76 | interpolation, trying to find the equation of a graph.
 77 | The overfitting.py_ file, you can see that there is a true function being
 78 | modeled, as well as some estimates that are shown to not be accurate.
 79 | 
 80 | .. _overfitting.py: https://github.com/machinelearningmindset/machine-learning-course/blob/master/code/overview/overfitting/overfitting.py
 81 | 
 82 | The estimates are representations of overfitting and underfitting.
 83 | For overfitting, a higher degree polynomial is used (x cubed instead of squared).
 84 | While the data is relatively close for the chosen points, there are some artifacts outside of them.
 85 | The example of underfitting, however, does not even achieve accuracy at many of the points.
 86 | Underfitting is similar to having a linear model when trying to model a quadratic function.
 87 | The model does well on the point(s) it trained on, in this case the point used
 88 | for the linear estimate, but poorly otherwise.
 89 | 
 90 | 
 91 | ----------------------------
 92 | Conclusion
 93 | ----------------------------
 94 | 
 95 | Check out the cross-validation and regularization sections for information on
 96 | how to avoid overfitting in machine learning models.
 97 | Ideally, a good fit looks something like this:
 98 | 
 99 | .. figure:: _img/GoodFit.PNG
100 |    :scale: 100 %
101 |    :alt: Underfit
102 | (Created using Wolfram Alpha)
103 | 
104 | 
105 | When using machine learning in any capacity, issues such as overfitting
106 | frequently come up, and having a grasp of the concept is very important.
107 | The modules in this section are among the most important in the whole repository,
108 | since regardless of the implementation, machine learning always includes these fundamentals.
109 | 
110 | 
111 | ----------
112 | References
113 | ----------
114 | 
115 | 1. https://machinelearningmastery.com/overfitting-and-underfitting-with-machine-learning-algorithms/
116 | 2. https://medium.com/greyatom/what-is-underfitting-and-overfitting-in-machine-learning-and-how-to-deal-with-it-6803a989c76
117 | 3. https://towardsdatascience.com/overfitting-vs-underfitting-a-conceptual-explanation-d94ee20ca7f9
118 | 
119 | 


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Bayes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Bayes.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Bell_Curve.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Bell_Curve.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Dec_Trees_Pruning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Dec_Trees_Pruning.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Gini_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Gini_1.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Gini_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Gini_2.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Gini_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Gini_3.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Gini_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Gini_4.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Gini_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Gini_5.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Gini_6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Gini_6.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Gini_7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Gini_7.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Gini_8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Gini_8.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Gini_Impurity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Gini_Impurity.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Gini_Information_Gain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Gini_Information_Gain.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/KNN_KDTree.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/KNN_KDTree.jpg


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/LOOCV.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/LOOCV.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/LPOCV.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/LPOCV.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Possible_hyperplane.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Possible_hyperplane.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Regularization_Base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Regularization_Base.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Regularization_Lasso.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Regularization_Lasso.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Regularization_Linear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Regularization_Linear.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Regularization_Polynomial.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Regularization_Polynomial.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Regularization_Quadratic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Regularization_Quadratic.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/Regularization_Ridge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/Regularization_Ridge.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/SVM_Kernal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/SVM_Kernal.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/SVM_Kernel2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/SVM_Kernel2.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/SVM_Outliers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/SVM_Outliers.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/WikiLogistic.svg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/WikiLogistic.svg.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/dec_trees_eq1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/dec_trees_eq1.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/decision_tree_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/decision_tree_1.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/decision_tree_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/decision_tree_2.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/decision_tree_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/decision_tree_3.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/decision_tree_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/decision_tree_4.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/holdout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/holdout.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/kfold.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/kfold.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/knn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/knn.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/knn_output_k1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/knn_output_k1.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/knn_output_k9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/knn_output_k9.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/latex-lasso-eq.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/latex-lasso-eq.gif


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/latex-ridge-eq.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/latex-ridge-eq.gif


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/linear_svm_output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/linear_svm_output.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/optimal_hyperplane.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/optimal_hyperplane.png


--------------------------------------------------------------------------------
/docs/source/content/supervised/_img/shopping_table.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/supervised/_img/shopping_table.png


--------------------------------------------------------------------------------
/docs/source/content/unsupervised/_img/Data_Set.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/unsupervised/_img/Data_Set.png


--------------------------------------------------------------------------------
/docs/source/content/unsupervised/_img/Hierarchical.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/unsupervised/_img/Hierarchical.png


--------------------------------------------------------------------------------
/docs/source/content/unsupervised/_img/Hierarchical_Step1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/unsupervised/_img/Hierarchical_Step1.png


--------------------------------------------------------------------------------
/docs/source/content/unsupervised/_img/Hierarchical_Step2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/unsupervised/_img/Hierarchical_Step2.png


--------------------------------------------------------------------------------
/docs/source/content/unsupervised/_img/KMeans.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/unsupervised/_img/KMeans.png


--------------------------------------------------------------------------------
/docs/source/content/unsupervised/_img/K_Means_Final.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/unsupervised/_img/K_Means_Final.png


--------------------------------------------------------------------------------
/docs/source/content/unsupervised/_img/K_Means_Final_Alt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/unsupervised/_img/K_Means_Final_Alt.png


--------------------------------------------------------------------------------
/docs/source/content/unsupervised/_img/K_Means_Step2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/unsupervised/_img/K_Means_Step2.png


--------------------------------------------------------------------------------
/docs/source/content/unsupervised/_img/K_Means_Step3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/unsupervised/_img/K_Means_Step3.png


--------------------------------------------------------------------------------
/docs/source/content/unsupervised/_img/pca1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/unsupervised/_img/pca1.png


--------------------------------------------------------------------------------
/docs/source/content/unsupervised/_img/pca2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/unsupervised/_img/pca2.png


--------------------------------------------------------------------------------
/docs/source/content/unsupervised/_img/pca3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/unsupervised/_img/pca3.png


--------------------------------------------------------------------------------
/docs/source/content/unsupervised/_img/pca4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/unsupervised/_img/pca4.png


--------------------------------------------------------------------------------
/docs/source/content/unsupervised/_img/pca5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/unsupervised/_img/pca5.png


--------------------------------------------------------------------------------
/docs/source/content/unsupervised/_img/pca6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/content/unsupervised/_img/pca6.png


--------------------------------------------------------------------------------
/docs/source/credentials/CODE_OF_CONDUCT.rst:
--------------------------------------------------------------------------------
 1 | Contributor Covenant Code of Conduct
 2 | ====================================
 3 | 
 4 | Our Pledge
 5 | ----------
 6 | 
 7 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
 8 | 
 9 | Our Standards
10 | -------------
11 | 
12 | Examples of behavior that contributes to creating a positive environment include:
13 | 
14 | * Using welcoming and inclusive language
15 | * Being respectful of differing viewpoints and experiences
16 | * Gracefully accepting constructive criticism
17 | * Focusing on what is best for the community
18 | * Showing empathy towards other community members
19 | 
20 | Examples of unacceptable behavior by participants include:
21 | 
22 | * The use of sexualized language or imagery and unwelcome sexual attention or advances
23 | * Trolling, insulting/derogatory comments, and personal or political attacks
24 | * Public or private harassment
25 | * Publishing others' private information, such as a physical or electronic address, without explicit permission
26 | * Other conduct which could reasonably be considered inappropriate in a professional setting
27 | 
28 | Our Responsibilities
29 | --------------------
30 | 
31 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
32 | 
33 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
34 | 
35 | Scope
36 | -----
37 | 
38 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
39 | 
40 | Enforcement
41 | -----------
42 | 
43 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at amirsina.torfi@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
44 | 
45 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
46 | 
47 | Attribution
48 | ------------
49 | 
50 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
51 | 
52 | [homepage]: http://contributor-covenant.org
53 | [version]: http://contributor-covenant.org/version/1/4/
54 | 


--------------------------------------------------------------------------------
/docs/source/credentials/CONTRIBUTING.rst:
--------------------------------------------------------------------------------
 1 | 
 2 | *************
 3 | Contributing
 4 | *************
 5 | 
 6 | *For typos, please do not create a pull request. Instead, declare them in issues or email the repository owner*. Please note we have a code of conduct, please follow it in all your interactions with the project.
 7 | 
 8 | ====================
 9 | Pull Request Process
10 | ====================
11 | 
12 | Please consider the following criterions in order to help us in a better way:
13 | 
14 | 1. The pull request is mainly expected to be a link suggestion.
15 | 2. Please make sure your suggested resources are not obsolete or broken.
16 | 3. Ensure any install or build dependencies are removed before the end of the layer when doing a
17 |    build and creating a pull request.
18 | 4. Add comments with details of changes to the interface, this includes new environment
19 |    variables, exposed ports, useful file locations and container parameters.
20 | 5. You may merge the Pull Request in once you have the sign-off of at least one other developer, or if you
21 |    do not have permission to do that, you may request the owner to merge it for you if you believe all checks are passed.
22 | 
23 | ============
24 | Final Note
25 | ============
26 | 
27 | We are looking forward to your kind feedback. Please help us to improve this open source project and make our work better.
28 | For contribution, please create a pull request and we will investigate it promptly. Once again, we appreciate
29 | your kind feedback and elaborate code inspections.
30 | 


--------------------------------------------------------------------------------
/docs/source/credentials/LICENSE.rst:
--------------------------------------------------------------------------------
 1 | LICENSE
 2 | ========
 3 | 
 4 | MIT License
 5 | 
 6 | Copyright (c) 2019 Amirsina Torfi
 7 | 
 8 | Permission is hereby granted, free of charge, to any person obtaining a copy
 9 | of this software and associated documentation files (the "Software"), to deal
10 | in the Software without restriction, including without limitation the rights
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | copies of the Software, and to permit persons to whom the Software is
13 | furnished to do so, subject to the following conditions:
14 | 
15 | The above copyright notice and this permission notice shall be included in all
16 | copies or substantial portions of the Software.
17 | 
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | SOFTWARE.
25 | 


--------------------------------------------------------------------------------
/docs/source/index.rst:
--------------------------------------------------------------------------------
 1 | .. TensoFlow-World-Resources documentation master file, created by
 2 |    sphinx-quickstart on Wed Jul  5 16:28:45 2017.
 3 |    You can adapt this file completely to your liking, but it should at least
 4 |    contain the root `toctree` directive.
 5 | 
 6 | Welcome to Python Machine Learning course!
 7 | =====================================================
 8 | 
 9 | .. toctree::
10 |    :maxdepth: 3
11 |    :caption: Table of Content
12 | 
13 |    authorship/author
14 | 
15 | .. toctree::
16 |    :maxdepth: 3
17 |    :caption: Foreword
18 | 
19 |    intro/intro
20 | 
21 | .. toctree::
22 |    :maxdepth: 3
23 |    :caption: Core Concepts
24 | 
25 |    content/overview/crossvalidation
26 |    content/overview/linear-regression
27 |    content/overview/overfitting
28 |    content/overview/regularization
29 | 
30 | .. toctree::
31 |   :maxdepth: 3
32 |   :caption: Supervised Learning
33 | 
34 |   content/supervised/logistic_regression
35 |   content/supervised/bayes
36 |   content/supervised/decisiontrees
37 |   content/supervised/knn
38 |   content/supervised/linear_SVM
39 | 
40 | .. toctree::
41 |   :maxdepth: 3
42 |   :caption: Unsupervised Learning
43 | 
44 |   content/unsupervised/clustering
45 |   content/unsupervised/pca
46 | 
47 | .. toctree::
48 |   :maxdepth: 3
49 |   :caption: Deep Learning
50 | 
51 |   content/deep_learning/mlp
52 |   content/deep_learning/cnn
53 |   content/deep_learning/autoencoder
54 | 
55 | .. toctree::
56 |    :maxdepth: 3
57 |    :caption: Document Credentials
58 | 
59 |    credentials/LICENSE
60 | 


--------------------------------------------------------------------------------
/docs/source/intro/intro.rst:
--------------------------------------------------------------------------------
 1 | ***************
 2 | Introduction
 3 | ***************
 4 | 
 5 | The purpose of this project is to provide a comprehensive and yet simple course in Machine Learning using Python.
 6 | 
 7 | 
 8 | ====================================
 9 | Machine Learning Overview
10 | ====================================
11 | 
12 | ------------------------------------------------------------
13 | How was the advent and evolution of machine learning?
14 | ------------------------------------------------------------
15 | 
16 | You can argue that the start of modern machine learning comes from Alan Turing’s “Turing Test” of 1950. The Turing Test aimed to find out if a computer is brilliant (or at least smart enough to fool a human into thinking it is). Machine learning continued to develop with game playing computers. The games these computers play have grown more complicated over the years from checkers to chess to Go. Machine learning was also used to model pattern recognition systems in nature such as neural networks. But machine learning didn’t just stay confined to large computers stuck in rooms. Robots were designed that could use machine learning to navigate around obstacles automatically. We continue to see this concept in the self-driving cars of today. Machine learning eventually began to be used to analyze large sets of data to conclude. This allowed for humans to be able to digest large, complex systems through the use of machine learning. This was an advantageous result for those involved in marketing and advertisement as well as those concerned with complex data. Machine learning was also used for image and video recognition. Machine learning allowed for the classification of objects in pictures and videos as well as identification of specific landmarks of interest. Machine learning tools are now available through the Cloud and on large scale distributed systems.
17 | 
18 | 
19 | ------------------------------------------------------------
20 | Why is machine learning important?
21 | ------------------------------------------------------------
22 | 
23 | Machine learning has practical applications for a range of common business problems. By using machine learning, organizations can complete tasks in less time and more efficiently. One example could be preprocessing a set of data for a future stage that requires human intervention. Tasks that would have previously required lots of user input can now be automated to some degree. The saved resources can then be put towards something else that needs to be done. Beyond task automation, machine learning can be used to analyze large quantities of complex data to make predictions. Data analysis is an essential task for many businesses. For example, a company could analyze sales data to find out where profitable opportunities are or to find out where it risks losing money. Using machine learning can potentially allow for real-time analysis of complex data. Such an ability might be required for mission-critical systems. Machine learning is also an important topic for research and continued development. Currently, machine learning still has a lot of limitations and isn’t close to replacing the need for a live person. Machine learning’s constant evolution could offer solutions for hard problems that might take up too many resources now to even consider.
24 | 
25 | ------------------------------------------------------------------
26 | Who is using ML and why (government, healthcare system, etc.)?
27 | ------------------------------------------------------------------
28 | 
29 | Machine learning stands to impact most industries in some way so many managers and higher-ups are trying to at least learn what it is if not what it can do for them. Machine learning models are expected to get better at prediction when supplied with more information. Nowadays, it is effortless to obtain large amounts of information that can be used to train very accurate models. The computers of today are also stronger than those available in the past and offer options such as cloud solutions and distributed processing to tackle hard machine learning problems. Many of these options are readily available to almost anyone can use machine learning. We can see examples of machine learning in self-driving cars, recommendation systems, linguistic analysis, credit scoring, and security to name a few. Financial services can use machine learning to provide insights about client data and to predict areas of risk. Government agencies with access to large quantities of data and an interest in streamlining or at least speeding up parts of their services can utilize machine learning. Health care providers with cabinets full of patient data can use machine learning to aid in diagnosis as well as identifying health risks. Shopping services can use customers’ purchase histories and machine learning techniques to make personalized recommendations and gauge dangerous products. Anyone with a large amount of data stands to profit from using machine learning.
30 | 
31 | 
32 | ------------------------------------------------------------
33 | Further Reading
34 | ------------------------------------------------------------
35 | 
36 | * https://www.forbes.com/sites/bernardmarr/2016/02/19/a-short-history-of-machine-learning-every-manager-should-read/#15f4059615e7
37 | * https://www.interactions.com/blog/technology/machine-learning-important/
38 | * https://www.sas.com/en_us/insights/analytics/machine-learning.html
39 | * https://www.simplilearn.com/what-is-machine-learning-and-why-it-matters-article
40 | 


--------------------------------------------------------------------------------
/docs/source/logo/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/logo/logo.png


--------------------------------------------------------------------------------
/docs/source/logo/pythonml.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/logo/pythonml.pdf


--------------------------------------------------------------------------------
/docs/source/logo/pythonml.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/instillai/machine-learning-course/f58093747ab4f0859a9065d75230d107ad3dc002/docs/source/logo/pythonml.png


--------------------------------------------------------------------------------