├── Blog Posts
├── AI, ML and Deep Learning - Are they same?
│ └── AI_vs_ML_vs_DL_Difference.ipynb
├── How to Get Started with Machine Learning
│ └── Getting_Started_with_ML.ipynb
├── Introduction to Exploratory Data Analysis(EDA)
│ ├── Introduction_to_EDA.ipynb
│ └── automobile.csv
└── README.md
├── Building a Digit Recognizer
├── README.md
├── classification_compelete.py
├── csv
│ ├── dataset4labels.csv
│ └── dataset6labels.csv
├── draw.txt
├── gen_dataset.py
├── model
│ ├── svm_4label_linear
│ ├── svm_4label_rbf
│ ├── svm_6label_linear
│ ├── svm_6label_linear_1_0.1
│ ├── svm_6label_linear_2
│ └── svm_6label_rbf
├── orig_images
│ ├── 0
│ │ ├── 0.png
│ │ ├── 1.png
│ │ ├── 10.png
│ │ ├── 11.png
│ │ ├── 12.png
│ │ ├── 13.png
│ │ ├── 14.png
│ │ ├── 15.png
│ │ ├── 16.png
│ │ ├── 17.png
│ │ ├── 18.png
│ │ ├── 19.png
│ │ ├── 2.png
│ │ ├── 20.png
│ │ ├── 21.png
│ │ ├── 22.png
│ │ ├── 23.png
│ │ ├── 24.png
│ │ ├── 25.png
│ │ ├── 26.png
│ │ ├── 27.png
│ │ ├── 28.png
│ │ ├── 29.png
│ │ ├── 3.png
│ │ ├── 30.png
│ │ ├── 31.png
│ │ ├── 32.png
│ │ ├── 33.png
│ │ ├── 34.png
│ │ ├── 35.png
│ │ ├── 36.png
│ │ ├── 37.png
│ │ ├── 38.png
│ │ ├── 39.png
│ │ ├── 4.png
│ │ ├── 5.png
│ │ ├── 6.png
│ │ ├── 7.png
│ │ ├── 8.png
│ │ └── 9.png
│ ├── 1
│ │ ├── 0.png
│ │ ├── 1.png
│ │ ├── 10.png
│ │ ├── 11.png
│ │ ├── 12.png
│ │ ├── 13.png
│ │ ├── 14.png
│ │ ├── 15.png
│ │ ├── 16.png
│ │ ├── 17.png
│ │ ├── 18.png
│ │ ├── 19.png
│ │ ├── 2.png
│ │ ├── 20.png
│ │ ├── 21.png
│ │ ├── 22.png
│ │ ├── 23.png
│ │ ├── 24.png
│ │ ├── 25.png
│ │ ├── 26.png
│ │ ├── 27.png
│ │ ├── 28.png
│ │ ├── 29.png
│ │ ├── 3.png
│ │ ├── 30.png
│ │ ├── 31.png
│ │ ├── 32.png
│ │ ├── 33.png
│ │ ├── 34.png
│ │ ├── 35.png
│ │ ├── 36.png
│ │ ├── 37.png
│ │ ├── 38.png
│ │ ├── 39.png
│ │ ├── 5.png
│ │ ├── 6.png
│ │ ├── 7.png
│ │ ├── 8.png
│ │ └── 9.png
│ ├── 2
│ │ ├── 0.png
│ │ ├── 1.png
│ │ ├── 11.png
│ │ ├── 12.png
│ │ ├── 13.png
│ │ ├── 15.png
│ │ ├── 16.png
│ │ ├── 17.png
│ │ ├── 18.png
│ │ ├── 19.png
│ │ ├── 2.png
│ │ ├── 20.png
│ │ ├── 21.png
│ │ ├── 22.png
│ │ ├── 23.png
│ │ ├── 24.png
│ │ ├── 25.png
│ │ ├── 26.png
│ │ ├── 27.png
│ │ ├── 28.png
│ │ ├── 29.png
│ │ ├── 3.png
│ │ ├── 30.png
│ │ ├── 31.png
│ │ ├── 33.png
│ │ ├── 34.png
│ │ ├── 35.png
│ │ ├── 36.png
│ │ ├── 37.png
│ │ ├── 38.png
│ │ ├── 39.png
│ │ ├── 4.png
│ │ ├── 41.png
│ │ ├── 42.png
│ │ ├── 43.png
│ │ ├── 44.png
│ │ ├── 5.png
│ │ ├── 6.png
│ │ ├── 7.png
│ │ ├── 8.png
│ │ └── 9.png
│ ├── 3
│ │ ├── 0.png
│ │ ├── 1.png
│ │ ├── 10.png
│ │ ├── 11.png
│ │ ├── 12.png
│ │ ├── 13.png
│ │ ├── 14.png
│ │ ├── 15.png
│ │ ├── 16.png
│ │ ├── 17.png
│ │ ├── 18.png
│ │ ├── 19.png
│ │ ├── 2.png
│ │ ├── 20.png
│ │ ├── 21.png
│ │ ├── 22.png
│ │ ├── 23.png
│ │ ├── 25.png
│ │ ├── 26.png
│ │ ├── 28.png
│ │ ├── 29.png
│ │ ├── 3.png
│ │ ├── 30.png
│ │ ├── 31.png
│ │ ├── 32.png
│ │ ├── 33.png
│ │ ├── 34.png
│ │ ├── 35.png
│ │ ├── 36.png
│ │ ├── 37.png
│ │ ├── 38.png
│ │ ├── 39.png
│ │ ├── 4.png
│ │ ├── 40.png
│ │ ├── 41.png
│ │ ├── 42.png
│ │ ├── 43.png
│ │ ├── 44.png
│ │ ├── 5.png
│ │ ├── 6.png
│ │ ├── 7.png
│ │ ├── 8.png
│ │ └── 9.png
│ ├── 4
│ │ ├── 0.png
│ │ ├── 1.png
│ │ ├── 10.png
│ │ ├── 11.png
│ │ ├── 13.png
│ │ ├── 14.png
│ │ ├── 15.png
│ │ ├── 16.png
│ │ ├── 17.png
│ │ ├── 18.png
│ │ ├── 19.png
│ │ ├── 2.png
│ │ ├── 20.png
│ │ ├── 21.png
│ │ ├── 22.png
│ │ ├── 23.png
│ │ ├── 24.png
│ │ ├── 25.png
│ │ ├── 26.png
│ │ ├── 27.png
│ │ ├── 28.png
│ │ ├── 29.png
│ │ ├── 3.png
│ │ ├── 31.png
│ │ ├── 32.png
│ │ ├── 33.png
│ │ ├── 34.png
│ │ ├── 35.png
│ │ ├── 38.png
│ │ ├── 4.png
│ │ ├── 40.png
│ │ ├── 41.png
│ │ ├── 42.png
│ │ ├── 43.png
│ │ ├── 44.png
│ │ ├── 5.png
│ │ ├── 6.png
│ │ ├── 7.png
│ │ ├── 8.png
│ │ └── 9.png
│ └── 5
│ │ ├── 0.png
│ │ ├── 10.png
│ │ ├── 11.png
│ │ ├── 12.png
│ │ ├── 13.png
│ │ ├── 14.png
│ │ ├── 15.png
│ │ ├── 16.png
│ │ ├── 17.png
│ │ ├── 18.png
│ │ ├── 19.png
│ │ ├── 2.png
│ │ ├── 20.png
│ │ ├── 21.png
│ │ ├── 23.png
│ │ ├── 24.png
│ │ ├── 25.png
│ │ ├── 26.png
│ │ ├── 27.png
│ │ ├── 28.png
│ │ ├── 29.png
│ │ ├── 3.png
│ │ ├── 30.png
│ │ ├── 31.png
│ │ ├── 32.png
│ │ ├── 33.png
│ │ ├── 34.png
│ │ ├── 35.png
│ │ ├── 36.png
│ │ ├── 37.png
│ │ ├── 39.png
│ │ ├── 4.png
│ │ ├── 40.png
│ │ ├── 41.png
│ │ ├── 42.png
│ │ ├── 43.png
│ │ ├── 44.png
│ │ ├── 5.png
│ │ ├── 6.png
│ │ ├── 7.png
│ │ ├── 8.png
│ │ └── 9.png
├── predictor_live.py
├── screencapture.py
├── svm_starter.py
└── temp
│ ├── segmented.png
│ └── test_orig.png
├── Building a Movie Recommendation Engine
├── .ipynb_checkpoints
│ ├── Assignment Solution-checkpoint.ipynb
│ └── Movie_Recommendation_Engine-checkpoint.ipynb
├── Assignment Solution.ipynb
├── Building_A_Movie_Recommendation_Engine.pdf
├── Movie_Recommendation_Engine.ipynb
├── README.md
├── assignment.pdf
├── cosine_similarity.py
├── movie_dataset.csv
├── movie_recommender_completed.py
└── movie_recommender_starter.py
├── Collaborative Filtering
├── Collaborative Filtering Dummy Dataset.ipynb
├── Movie Lens Collaborative Filtering.ipynb
└── dataset
│ ├── README.txt
│ ├── links.csv
│ ├── movies.csv
│ ├── ratings.csv
│ ├── tags.csv
│ └── toy_dataset.csv
├── Face Recognition Using PCA
├── README.md
├── face_data.csv
├── face_recog_completed.py
├── face_recog_starter.py
├── olivetti_faces.npy
├── olivetti_faces_target.npy
└── prep_dataset.py
├── Indeed Job Analysis
├── Data Science Job Analysis.ipynb
├── Selenium
│ ├── ai.csv
│ ├── data_analyst.csv
│ ├── datascience.csv
│ ├── datascience2.csv
│ └── machinelearning.csv
├── chromedriver_mac
├── scrape_selenium.py
└── scraper_only_bs4.py
├── K Means
├── README.md
├── dataset.csv
├── kmeans.py
└── kmeans_completed.py
├── LICENSE
├── Malaria Detection
├── Readme.md
├── csv
│ └── dataset.csv
├── gen_dataset_completed.py
└── malaria_classification_completed.py
├── Naive Bayes
├── Supervised-Machine-Learning.pdf
├── Supervised-MachineLearning-Part_2.pdf
├── home_work_dataset_ham_spam.csv
├── naive-bayes.py
└── titanic.csv
├── PCA
├── Iris.csv
├── README.md
├── pca.py
└── pca_completed.py
├── README.md
├── Reinforcement Learning
├── README.md
├── RL1 Multiarm Bandit
│ ├── README.md
│ ├── Reinforcement_Learning_Part_1.ipynb
│ ├── agents.py
│ ├── agents.pyc
│ ├── completed
│ │ ├── agents.py
│ │ ├── agents.pyc
│ │ ├── environment.py
│ │ ├── environment.pyc
│ │ └── play.py
│ ├── environment.py
│ ├── environment.pyc
│ └── play.py
├── RL2 Value Iteration
│ ├── README.md
│ ├── agents.py
│ ├── agents.pyc
│ ├── completed
│ │ ├── agents.py
│ │ ├── agents.pyc
│ │ └── play.py
│ └── play.py
└── RL3 QLearning
│ ├── Agents.py
│ ├── README.md
│ ├── completed
│ ├── Agents.py
│ ├── Agents.pyc
│ ├── crawler_env.py
│ ├── crawler_env.pyc
│ └── play.py
│ ├── crawler_env.py
│ └── play.py
└── gradient descent
├── Gradient_Descent.ipynb
├── README.md
├── complete code
└── gd_complete.py
├── slides
└── Gradient Descent for Machine Learning.pdf
└── starter code
├── gd.zip
└── student_scores.csv
/Blog Posts/AI, ML and Deep Learning - Are they same?/AI_vs_ML_vs_DL_Difference.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Artificial Intelligence, Machine Learning and Deep Learning - Are they same?\n",
8 | "\n",
9 | "\n",
10 | "\n",
11 | "The most common confusion that beginners have when they start to learn Machine Learning is- “Are Artificial Intelligence(AI), Machine Learning(ML) and Deep Learning(DL) the same thing?”\n",
12 | "\n",
13 | "And that’s a question which I personally hear a lot from so many people. So, I thought why not make a blog post to explain it?\n",
14 | "\n",
15 | "## Artificial Intelligence (AI)\n",
16 | "\n",
17 | "Artificial intelligence refers to the capability of a machines to imitate intelligent human behaviour. In other words, any device that is able to perform tasks that normally require human intelligence such as making decisions or giving (meaningful) responses in a conversation can be said to have some kind of artificial intelligence.\n",
18 | "\n",
19 | "Particularly, this is a broad area of computer science, which deals with the simulation of intelligent behavior in computers.\n",
20 | "\n",
21 | "Virtual assistants are very good examples of implementation of AI in real life. With the power of AI, virtual assistants such as Google Assistant or Siri (by Apple) can nowadays imitate human behaviours with an exceptional perfection.\n",
22 | "\n",
23 | "\n",
24 | "AI can be implemented through huge collection of explicitly programmed if-else statements, or a complex statistical model with advanced parameters. But, the end goal of AI remains same- “Simulation of human intelligence in machines”.\n",
25 | "\n",
26 | "The practice of explicitly programming if-else statements for implementing AI models is known as “Good Old-Fashioned Artificial Intelligence” (GOFAI), which was the dominant paradigm of AI research from the mid-1950s until the late 1980s.\n",
27 | "\n",
28 | "Some AI models might be termed as “weak AI” models since they only focus on getting the work done without figuring out how human reasoning works. One such example could be- bots created using Artificial Intelligence Markup Language (AIML). These bots try to give responses by simply matching some basic patterns against the input using an XML-like structure of conditions without trying to “understand” the conversation.\n",
29 | "\n",
30 | "On the other hand, AI systems which pretend to think exactly like humans do, are termed as “strong AI” models. We have already seen an example of this while discussing about Google Assistant.\n",
31 | "\n",
32 | "## Machine Learning (ML)\n",
33 | "\n",
34 | "While AI is a broad area of cognitive computing, Machine Learning is a particular subset of AI which mainly deals with the study of how machines learn.\n",
35 | "\n",
36 | "Doesn’t make sense? Let me clear that for you.\n",
37 | "\n",
38 | "Early AI researchers found some problems way much harder to solve with the early available techniques of AI (GOFAI). Hard coded algorithms were simply not useful for solving those problems.\n",
39 | "\n",
40 | "For example, how would you make a computer to distinguish between pictures of cats and dogs? Will you write hard-coded algorithms for identifying each picture individually? What happens if it sees a picture that it has never seen before? What happens if it sees a partial picture? Will it still be able to recognize it?\n",
41 | "\n",
42 | "\n",
43 | "\n",
44 | "It turns out that for solving these kind problems, instead of just imitating human behaviour, researchers started to find ways to imitate how humans learn. And that’s what gave rise to the field of Machine Learning. It is the field of study that gives computers the ability to learn without being explicitly programmed.\n",
45 | "\n",
46 | "More specifically, in case of machine learning problems, you need to give the computer some data (lots of cat and dog images in this case), tell it to “learn” from that data, and then predict the correct output for new, unseen data.\n",
47 | "\n",
48 | "Practically, this is nothing but a mathematical function (model) which maps inputs to its correct outputs. The task of Machine Learning engineers is to figure out and implement this “mathematical function” in such a way that programmers won’t need to write “hard-coded” algorithms for solving each individual problem.\n",
49 | "\n",
50 | "## Deep Learning (DL)\n",
51 | "\n",
52 | "Before we discuss anything about this, I want you to have a look at the following image:\n",
53 | "\n",
54 | "\n",
55 | "\n",
56 | "Now look at this image:\n",
57 | "\n",
58 | "\n",
59 | "\n",
60 | "What did you see? 4?\n",
61 | "\n",
62 | "Easy, right? It took you just fraction of a second to figure out that both of these images represent the number four.\n",
63 | "\n",
64 | "Even though these images don’t look exactly alike (in terms of pixel values), you still were able to recognize these images and label them as the number four. Even poor resolution was not a hurdle for you. How amazing! Let’s take a moment to appreciate our brain for doing this.\n",
65 | "\n",
66 | "But, can you explain the process, exactly how you were able to identify these images?\n",
67 | "\n",
68 | "This is one thing that you did intuitively. Using your natural instincts, you “felt” that these images are of the number four, without following any particular process for identifying them. And it goes without saying that you did a great job at doing it.\n",
69 | "\n",
70 | "So, can we implement a similar mechanism in computers to make them perform tasks that we do intuitively?\n",
71 | "\n",
72 | "Yeah, you guessed it right! This paradigm of machine learning is called Deep Learning (DL).\n",
73 | "\n",
74 | "Deep Learning is a subfield of machine learning which is concerned with algorithms inspired by the structure and function of the brain.\n",
75 | "\n",
76 | "It consists of a particular type of mathematical model that can be thought of as a collection of simple blocks, distributed across multiple layers. Each of these blocks are specialized to perform a particular task and can be adjusted to better predict the final outcome.\n",
77 | "\n",
78 | "\n",
79 | "\n",
80 | "Human brain consists of billions of neurons interconnected to each other. Each neuron receives a signal, processes the signal, and passes it on to the other neurons. This is how the information is processed in our brain.\n",
81 | "\n",
82 | "These blocks try to simulate the behaviour of neuron cells present in human brain for performing a particular task. Hence, the collection of these blocks can be referred to as Artificial Neural Network (ANN).\n",
83 | "\n",
84 | "Deep Learning is called “deep” because the composition of these blocks are stacked on top of each other forming multiple layers. The deeper you go, the more complex features are extracted.\n",
85 | "\n",
86 | "## Conclusion\n",
87 | "\n",
88 | "Although terms like artificial intelligence, machine learning and deep learning are used interchangeably but, they are not the same thing. Machine learning is the subset of artificial intelligence and deep learning is a subset of machine learning.\n",
89 | "\n",
90 | "\n",
91 | "\n",
92 | "Here, the key takeaway is:\n",
93 | "\n",
94 | "- Artificial Intelligence deals with imitating human intelligence.\n",
95 | "- Machine Learning deals with imitating how humans learn.\n",
96 | "- Deep learning deals with imitating how human brain processes data with the help of neurons.\n",
97 | "\n",
98 | "\n",
99 | "Follow our [Medium Publication](https://medium.com/code-heroku) to get regular updates on these kind of posts.\n",
100 | "\n",
101 | ">If this article was helpful to you, check out our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) Course at [Code Heroku](http://www.codeheroku.com/) for a complete guide to Machine Learning.\n",
102 | "\n",
103 | "
\n",
104 | "
\n",
105 | "
\n",
106 | "
\n",
107 | "\n",
108 | "
"
109 | ]
110 | }
111 | ],
112 | "metadata": {
113 | "kernelspec": {
114 | "display_name": "Python 3",
115 | "language": "python",
116 | "name": "python3"
117 | },
118 | "language_info": {
119 | "codemirror_mode": {
120 | "name": "ipython",
121 | "version": 3
122 | },
123 | "file_extension": ".py",
124 | "mimetype": "text/x-python",
125 | "name": "python",
126 | "nbconvert_exporter": "python",
127 | "pygments_lexer": "ipython3",
128 | "version": "3.6.7"
129 | }
130 | },
131 | "nbformat": 4,
132 | "nbformat_minor": 2
133 | }
134 |
--------------------------------------------------------------------------------
/Blog Posts/How to Get Started with Machine Learning/Getting_Started_with_ML.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# How to get started with Machine Learning\n",
8 | "
\n",
9 | "\n",
10 | "
\n",
11 | "\n",
12 | "\n",
13 | "Are you someone who is constantly trying to learn the concepts of machine learning and data science but don’t know from where to start?\n",
14 | "\n",
15 | "If your answer is “YES”, then this is the right place for you.\n",
16 | "\n",
17 | "Don’t worry, most people feel the same way as you when they first get introduced to machine learning. They have the enthusiasm to learn but, they get confused from where to start learning, which resources to follow and which prerequisites to learn at first.\n",
18 | "\n",
19 | "So, we at [Code Heroku](http://www.codeheroku.com/), felt that it’s much needed for us to write an article about getting started with machine learning so that, aspiring machine learning engineers can follow a guided path to pursue their dream :)\n",
20 | "\n",
21 | "Let’s start with the most common questions.\n",
22 | "\n",
23 | "## How much coding knowledge is required and what programming languages are best for machine learning?\n",
24 | "\n",
25 | "So, exactly how much knowledge should you have about programming?\n",
26 | "\n",
27 | "Just the basic syntax and knowledge about using libraries is enough.\n",
28 | "\n",
29 | "Why?\n",
30 | "\n",
31 | "Because, in majority of the cases, machine learning engineers don’t build their models from scratch. They would rather use some machine learning library such as Scikit Learn or TensorFlow in order to implement their models. These libraries provide well-documented high level APIs for implementing machine learning models. So, most of the hard work is already taken care by them. You just need to know how to use these libraries in order to implement your model.\n",
32 | "\n",
33 | "To answer the second part of the question, there is really no specific answer to that. While different people have different opinions over this, we still tried to compare some of the widely used programming languages for machine learning (Python, R, MATLAB) in terms of their execution speed, available libraries and ease of use.\n",
34 | "\n",
35 | "Now, let’s discuss some of the advantages and disadvantages of these languages.\n",
36 | "\n",
37 | "#### Python:\n",
38 | "\n",
39 | "
\n",
40 | "\n",
41 | "Advantages:\n",
42 | "\n",
43 | "- Multipurpose programming language. Can be used to build actual commercial products and standalone applications.\n",
44 | "- A large number of Open Source Packages and libraries available for machine learning.\n",
45 | "- Though it is 5 times slower than C, it is still much faster than R and MATLAB in terms of execution speed.\n",
46 | "- Can be easily integrated with other languages.\n",
47 | "\n",
48 | "Disadvantages:\n",
49 | "\n",
50 | "- More lines of code needs to be written as compared to R or MATLAB for performing the same operation.\n",
51 | "\n",
52 | "#### R:\n",
53 | "\n",
54 | "
\n",
55 | "\n",
56 | "Advantages:\n",
57 | "\n",
58 | "- Primarily developed for statistical computation and data analytics.\n",
59 | "- A large number of Open Source Packages and libraries available for machine learning.\n",
60 | "- Can be easily integrated with other languages such as C/C++.\n",
61 | "- It requires less number of codes to be written as compared to Python and MATLAB for performing the same task.\n",
62 | "\n",
63 | "Disadvantages:\n",
64 | "\n",
65 | "- Slow execution speed as compared to Python.\n",
66 | "- Difficult to implement interactive charts.\n",
67 | "- Limited capabilities while creating standalone applications.\n",
68 | "\n",
69 | "#### MATLAB:\n",
70 | "\n",
71 | "
\n",
72 | "\n",
73 | "Advantages:\n",
74 | "\n",
75 | "- Fastest mathematical and computational platform specially for vectorized operations, linear algebra, matrix manipulation.\n",
76 | "- Best for visualization of plots and interactive charts.\n",
77 | "\n",
78 | "Disadvantages:\n",
79 | "\n",
80 | "- Slightly less number of Open Source Packages available.\n",
81 | "- Slow execution speed as compared to Python and R.\n",
82 | "- Not a good choice for implementing standalone applications.\n",
83 | "\n",
84 | "From our point of view, we would recommend you to get started with Python if you are a beginner. Because, it’s an easy-to-learn multipurpose programming language with (comparatively) fast execution speed and wide range of open source libraries available for machine learning. We, at [Code Heroku](http://www.codeheroku.com/) also use Python to teach our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) course.\n",
85 | "\n",
86 | "## How much knowledge of mathematics is required?\n",
87 | "\n",
88 | "In majority of the cases, people get scared of machine learning when they get to know about the mathematics part. Because, students are not well informed about which part of mathematics to learn and how much to learn.\n",
89 | "\n",
90 | "So, here we have tried to provide you with a guided path of mathematical foundations for machine learning. Having a sound knowledge on the following topics is sufficient (but not limited to) for a machine learning engineer.\n",
91 | "\n",
92 | "- Linear Algebra\n",
93 | "- Analytic geometry\n",
94 | "- Matrix Decompositions\n",
95 | "- Vector Calculus\n",
96 | "- Probability and Distribution\n",
97 | "- Continuous Optimization\n",
98 | "\n",
99 | "Don’t worry, you don’t need to learn all of this at once. Here are some useful tips for getting started:\n",
100 | "\n",
101 | "- Don’t try to learn all topics at once, learn them one by one.\n",
102 | "- While exploring a particular topic of machine learning, try to learn maths related to that topic only.\n",
103 | "\n",
104 | "Our [Machine Learning Course](http://www.codeheroku.com/course?course_id=1) at [Code Heroku](http://www.codeheroku.com/) is designed in such a way that it explains the maths behind every algorithm in our syllabus. So, even if you are someone from a non-mathematical background, you will still be able to understand the concepts without any problem.\n",
105 | "\n",
106 | "## What syllabus to follow?\n",
107 | "\n",
108 | "We have tried to provide you with a simple yet powerful syllabus for machine learning which is sufficient (but not limited to) for a beginner. The same syllabus is being taught at our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) course at [Code Heroku](http://www.codeheroku.com/).\n",
109 | "\n",
110 | "**Section 1: Introduction and Getting Started**\n",
111 | "\n",
112 | "- Introduction to Machine Learning\n",
113 | "- Setup Python\n",
114 | "- Scikit-Learn and other libraries installation\n",
115 | "- An introduction to Python, Numpy, SciPy and Matplotlib\n",
116 | "\n",
117 | "**Section 2: Supervised Machine Learning**\n",
118 | "\n",
119 | "- Introduction to Supervised Learning\n",
120 | "- Linear Regression using Scikit-Learn\n",
121 | "- Naive Bayes using Scikit Learn\n",
122 | "- Understanding Recommendation Engines\n",
123 | "- Understanding Gradient Descent Optimization\n",
124 | "\n",
125 | "**Section 3: Unsupervised Machine Learning**\n",
126 | "\n",
127 | "- Understanding Support Vector Machines(SVM)\n",
128 | "- Understanding K-Means\n",
129 | "- Principal Component Analysis (PCA)\n",
130 | "- Understanding the Application of PCA\n",
131 | "- Model Selection and Boosting\n",
132 | "\n",
133 | "**Section 4: Reinforcement Learning**\n",
134 | "\n",
135 | "- Introduction to Reinforcement Learning\n",
136 | "- Introduction to Open AI Gym\n",
137 | "- Deep Reinforcement Learning and Q-Learning\n",
138 | "- Understanding the Application of Deep Reinforcement Learning\n",
139 | "\n",
140 | "**Section 5: Neural Networks**\n",
141 | "\n",
142 | "- Introduction to Neural Networks\n",
143 | "- Supervised Machine Learning using Neural Networks\n",
144 | "- Object Recognition with Neural Networks\n",
145 | "\n",
146 | "## What project ideas to follow?\n",
147 | "\n",
148 | "While learning the theory is important, it is more important to apply that knowledge and build something useful out of it. Implementing projects while learning will give you hands-on experience on the things that you will learn. We at [Code Heroku](http://www.codeheroku.com/) implement the following projects in our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) course and would recommend you to try to implement the same.\n",
149 | "\n",
150 | "Supervised Machine Learning Projects:\n",
151 | "\n",
152 | "- [Student Exam Score Prediction System](http://www.codeheroku.com/course_content?lesson_id=0&course_id=1§ion_id=1)\n",
153 | "- Email Classifier System (Spam Detection System)\n",
154 | "- [Movie Recommendation System](https://medium.com/code-heroku/building-a-movie-recommendation-engine-in-python-using-scikit-learn-c7489d7cb145)\n",
155 | "\n",
156 | "Unsupervised Machine Learning Projects:\n",
157 | "\n",
158 | "- [Digit Recognition System](http://www.codeheroku.com/course_content?lesson_id=0&course_id=1§ion_id=2)\n",
159 | "- [Face Recognition System](http://www.codeheroku.com/course_content?lesson_id=3&course_id=1§ion_id=2)\n",
160 | "\n",
161 | "Reinforcement Learning Projects:\n",
162 | "\n",
163 | "- Solving Mouse Cat Maze\n",
164 | "- Cartpole Balancing with Q Learning\n",
165 | "\n",
166 | "Neural Network Projects:\n",
167 | "\n",
168 | "- Object Recognition with Neural Networks\n",
169 | "\n",
170 | "Apart from the list above, you can also try to implement tons of other cool projects on your own. You can get some good project ideas from [ml-showcase.com](https://ml-showcase.com/) and try to implement them on your own.\n",
171 | "\n",
172 | "## What learning strategy to follow?\n",
173 | "\n",
174 | "Most people are left out in the learning process because they do not follow a learning strategy. Though this thing depends from person to person according to their own preferences, we still tried to give you a generalized view over the learning process.\n",
175 | "\n",
176 | "- When you try to learn a topic related to machine learning, try to understand the theory behind it.\n",
177 | "- Once you have learned the theory, apply this knowledge to make a small project out of it.\n",
178 | "- Once you have explored enough topics, try to compare their performance while implementing the same project. For example, try to implement spam detection system using both [Naive Bayes](http://www.codeheroku.com/course_content?lesson_id=1&course_id=1§ion_id=1) and [SVM](http://www.codeheroku.com/course_content?lesson_id=0&course_id=1§ion_id=2) and then compare the results.\n",
179 | "- This will give you a better idea to understand which algorithm to use in which scenario.\n",
180 | "\n",
181 | "Apart from this, try to manage your time effectively and learn the topics one by one. Do not rush to learn everything at once.\n",
182 | "\n",
183 | "\n",
184 | "Follow our [Medium Publication](https://medium.com/code-heroku) to get regular updates on these kind of posts.\n",
185 | "\n",
186 | ">If this article was helpful to you, check out our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) Course at [Code Heroku](http://www.codeheroku.com/) for a complete guide to Machine Learning.\n",
187 | "\n",
188 | "
\n",
189 | "\n",
190 | "
\n",
191 | "
\n",
192 | "\n",
193 | "
"
194 | ]
195 | }
196 | ],
197 | "metadata": {
198 | "kernelspec": {
199 | "display_name": "Python 3",
200 | "language": "python",
201 | "name": "python3"
202 | },
203 | "language_info": {
204 | "codemirror_mode": {
205 | "name": "ipython",
206 | "version": 3
207 | },
208 | "file_extension": ".py",
209 | "mimetype": "text/x-python",
210 | "name": "python",
211 | "nbconvert_exporter": "python",
212 | "pygments_lexer": "ipython3",
213 | "version": "3.6.7"
214 | }
215 | },
216 | "nbformat": 4,
217 | "nbformat_minor": 2
218 | }
219 |
--------------------------------------------------------------------------------
/Blog Posts/README.md:
--------------------------------------------------------------------------------
1 | # Blog Posts
2 |
3 | This folder contains Jupyter notebooks for all the blog posts by [Code Heroku](http://www.codeheroku.com/).
4 |
5 | These posts can be found in [Code Heroku Blog](http://www.codeheroku.com/blog.html) and [Medium Publication of Code Heroku](https://medium.com/code-heroku).
6 |
7 | [Follow us on Medium](https://medium.com/code-heroku) to get latest updates on our posts.
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Building a Digit Recognizer/README.md:
--------------------------------------------------------------------------------
1 | # Building a Digit Recognizer
2 |
3 |
4 |
5 |
6 |
7 | ### Instructions
8 |
9 | This folder contains resources of Building a Digit Recognizer lesson.
10 |
11 | The recorded video for this lesson can be found here: https://www.youtube.com/watch?v=7aK7tVdcVbY
12 |
13 | > Check out our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) Course at [Code Heroku](http://www.codeheroku.com/) for a complete guide to Machine Learning.
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Building a Digit Recognizer/classification_compelete.py:
--------------------------------------------------------------------------------
1 | import pandas as pd
2 | import matplotlib.pyplot as plt
3 | from sklearn import svm
4 | from sklearn import metrics
5 | import joblib
6 | from sklearn.decomposition import PCA
7 | import numpy as np
8 | from sklearn.utils import shuffle
9 |
10 | dataframe = pd.read_csv('csv/dataset5labels.csv')
11 | dataframe = dataframe.sample(frac=1).reset_index(drop=True)
12 |
13 | print dataframe
14 |
15 | X = dataframe.drop(['label'], axis=1)
16 | Y = dataframe['label']
17 |
18 | # X_train, Y_train = X[0:198], Y[0:198]
19 | # X_test,Y_test = X[198:],Y[198:]
20 | X_train, Y_train = X, Y
21 | X_test,Y_test = X,Y
22 |
23 |
24 | grid_data = X_train.values[40].reshape(28,28)
25 | plt.imshow(grid_data,interpolation=None,cmap="gray")
26 | plt.title(Y_train.values[40])
27 | plt.show()
28 |
29 |
30 |
31 | model = svm.SVC(kernel="linear",C=2)
32 |
33 | print "Fitting this might take some time ....."
34 |
35 | model.fit(X_train,Y_train)
36 |
37 | joblib.dump(model, "model/svm_0to5label_linear_2")
38 | #model = joblib.load("svm_class_1")
39 | print "predicting ....."
40 | predictions = model.predict(X_test)
41 |
42 | print "Getting Accuracy ....."
43 | print "Score", metrics.accuracy_score(Y_test, predictions)
44 |
45 |
--------------------------------------------------------------------------------
/Building a Digit Recognizer/draw.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/draw.txt
--------------------------------------------------------------------------------
/Building a Digit Recognizer/gen_dataset.py:
--------------------------------------------------------------------------------
1 | import cv2,os
2 | from sklearn.externals import joblib
3 | import numpy as np
4 | import csv
5 |
6 | import glob
7 | label = "5"
8 | #run this script for all labels
9 | dirList = glob.glob("orig_images/"+label+"/*.png")
10 | for img_path in dirList:
11 | file_name = img_path.split("/")[2]
12 | print file_name
13 | im = cv2.imread(img_path)
14 | im_gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
15 | im_gray = cv2.GaussianBlur(im_gray, (15, 15), 0)
16 | roi = cv2.resize(im_gray, (28, 28), interpolation=cv2.INTER_AREA)
17 |
18 | #cv2.imshow("window",roi)
19 |
20 | data=[]
21 | data.append(label)
22 | rows,cols = roi.shape
23 |
24 | # #Add pixel one-by-one into data Array.
25 | for i in range(rows):
26 | for j in range(cols):
27 | k = roi[i,j]
28 | if k>100:
29 | k=1
30 | else:
31 | k=0
32 |
33 | data.append(k)
34 |
35 | # header =["label"]
36 | # for i in range(0,784):
37 | # header.append("pixel"+str(i))
38 | # print header
39 |
40 | with open('csv/dataset5labels.csv', 'ab') as f:
41 | writer = csv.writer(f)
42 | writer.writerow(data)
43 |
44 | #cv2.imwrite("proc_images/0/"+file_name, roi)
45 |
46 | cv2.waitKey()
47 |
48 |
--------------------------------------------------------------------------------
/Building a Digit Recognizer/model/svm_4label_linear:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/model/svm_4label_linear
--------------------------------------------------------------------------------
/Building a Digit Recognizer/model/svm_4label_rbf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/model/svm_4label_rbf
--------------------------------------------------------------------------------
/Building a Digit Recognizer/model/svm_6label_linear:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/model/svm_6label_linear
--------------------------------------------------------------------------------
/Building a Digit Recognizer/model/svm_6label_linear_1_0.1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/model/svm_6label_linear_1_0.1
--------------------------------------------------------------------------------
/Building a Digit Recognizer/model/svm_6label_linear_2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/model/svm_6label_linear_2
--------------------------------------------------------------------------------
/Building a Digit Recognizer/model/svm_6label_rbf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/model/svm_6label_rbf
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/0.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/1.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/10.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/11.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/12.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/13.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/14.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/15.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/16.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/17.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/18.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/19.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/2.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/20.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/21.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/21.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/22.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/23.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/23.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/24.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/25.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/25.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/26.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/26.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/27.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/27.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/28.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/28.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/29.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/3.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/30.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/30.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/31.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/31.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/32.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/33.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/33.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/34.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/34.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/35.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/35.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/36.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/36.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/37.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/37.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/38.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/38.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/39.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/39.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/4.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/5.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/6.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/7.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/8.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/0/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/0/9.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/0.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/1.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/10.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/11.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/12.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/13.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/14.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/15.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/16.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/17.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/18.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/19.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/2.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/20.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/21.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/21.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/22.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/23.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/23.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/24.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/25.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/25.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/26.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/26.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/27.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/27.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/28.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/28.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/29.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/3.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/30.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/30.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/31.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/31.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/32.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/33.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/33.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/34.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/34.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/35.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/35.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/36.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/36.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/37.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/37.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/38.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/38.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/39.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/39.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/5.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/6.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/7.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/8.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/1/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/1/9.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/0.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/1.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/11.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/12.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/13.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/15.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/16.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/17.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/18.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/19.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/2.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/20.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/21.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/21.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/22.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/23.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/23.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/24.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/25.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/25.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/26.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/26.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/27.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/27.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/28.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/28.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/29.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/3.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/30.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/30.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/31.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/31.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/33.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/33.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/34.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/34.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/35.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/35.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/36.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/36.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/37.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/37.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/38.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/38.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/39.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/39.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/4.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/41.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/41.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/42.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/42.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/43.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/43.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/44.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/44.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/5.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/6.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/7.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/8.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/2/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/2/9.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/0.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/1.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/10.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/11.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/12.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/13.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/14.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/15.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/16.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/17.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/18.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/19.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/2.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/20.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/21.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/21.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/22.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/23.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/23.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/25.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/25.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/26.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/26.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/28.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/28.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/29.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/3.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/30.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/30.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/31.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/31.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/32.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/33.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/33.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/34.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/34.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/35.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/35.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/36.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/36.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/37.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/37.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/38.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/38.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/39.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/39.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/4.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/40.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/41.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/41.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/42.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/42.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/43.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/43.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/44.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/44.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/5.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/6.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/7.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/8.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/3/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/3/9.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/0.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/1.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/10.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/11.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/13.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/14.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/15.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/16.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/17.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/18.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/19.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/2.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/20.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/21.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/21.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/22.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/23.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/23.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/24.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/25.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/25.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/26.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/26.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/27.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/27.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/28.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/28.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/29.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/3.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/31.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/31.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/32.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/33.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/33.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/34.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/34.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/35.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/35.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/38.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/38.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/4.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/40.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/41.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/41.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/42.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/42.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/43.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/43.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/44.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/44.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/5.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/6.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/7.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/8.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/4/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/4/9.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/0.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/10.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/11.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/12.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/13.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/14.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/15.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/16.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/17.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/18.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/19.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/2.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/20.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/21.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/21.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/23.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/23.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/24.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/25.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/25.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/26.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/26.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/27.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/27.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/28.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/28.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/29.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/3.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/30.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/30.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/31.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/31.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/32.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/33.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/33.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/34.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/34.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/35.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/35.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/36.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/36.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/37.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/37.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/39.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/39.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/4.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/40.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/41.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/41.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/42.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/42.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/43.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/43.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/44.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/44.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/5.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/6.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/7.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/8.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/orig_images/5/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/orig_images/5/9.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/predictor_live.py:
--------------------------------------------------------------------------------
1 | import joblib,cv2
2 | import numpy as np
3 | model = joblib.load("model/svm_6label_rbf")
4 |
5 | import pyscreenshot as ImageGrab
6 | import time
7 |
8 | images_folder = "temp/"
9 | fout = open("testing_x","w+")
10 | for i in range (0,100):
11 |
12 |
13 | img = ImageGrab.grab(bbox=(80, 80, 208, 208)) # X1,Y1,X2,Y2
14 | img.save(images_folder+"test_orig.png")
15 | im = cv2.imread(images_folder+"test_orig.png")
16 | im_gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
17 | im_gray = cv2.GaussianBlur(im_gray, (15, 15), 0)
18 |
19 | # Threshold the image
20 | ret, im_th = cv2.threshold(im_gray, 100, 255, cv2.THRESH_BINARY)
21 |
22 |
23 | roi = cv2.resize(im_th, (28, 28), interpolation=cv2.INTER_AREA)
24 |
25 | cv2.imwrite(images_folder+"segmented.png", roi)
26 |
27 |
28 | rows,cols = roi.shape
29 |
30 | X=[]
31 |
32 | # #Add pixel one-by-one into data Array.
33 | for i in range(rows):
34 | for j in range(cols):
35 | k = roi[i,j]
36 | if k>100:
37 | k=1
38 | else:
39 | k=0
40 | X.append(k)
41 |
42 | #scaling = MinMaxScaler(feature_range=(-1, 1)).fit([X])
43 |
44 | #X = scaling.transform([X])
45 | fout.write(str(X))
46 | predictions = model.predict([X])
47 | print "Prediction: ", predictions[0]
48 | cv2.putText(im, "Prediction is: "+str(predictions[0]), (20, 20), 0, 0.8, (0, 255, 0), 2, cv2.LINE_AA)
49 |
50 | #cv2.startWindowThread()
51 | cv2.namedWindow("Result")
52 | cv2.imshow("Result", im)
53 | cv2.waitKey(10000)
54 | #time.sleep(4)
55 |
56 |
57 |
--------------------------------------------------------------------------------
/Building a Digit Recognizer/screencapture.py:
--------------------------------------------------------------------------------
1 | import pyscreenshot as ImageGrab
2 | import time
3 |
4 | images_folder = "orig_images/5/"
5 |
6 | for i in range (0,45):
7 |
8 | time.sleep(5)
9 | im = ImageGrab.grab(bbox=(80, 80, 208, 208)) # X1,Y1,X2,Y2
10 | print "saved....",i
11 | im.save(images_folder+str(i)+'.png')
12 | print "clear screen now and redraw now..."
13 |
--------------------------------------------------------------------------------
/Building a Digit Recognizer/svm_starter.py:
--------------------------------------------------------------------------------
1 | import pandas as pd
2 | import matplotlib.pyplot as plt
3 | from sklearn import svm
4 | from sklearn import metrics
5 | import joblib
6 | import numpy as np
7 | from sklearn.utils import shuffle
8 |
9 |
10 | ##Step 1: Get Data from CSV
11 |
12 |
13 | ##Step 2: Seperate Labels and Features
14 |
15 |
16 |
17 | ##Step 3: Make sure you have the correct Feature / label combination in training
18 |
19 |
20 |
21 | ##Step 4: Build a Model and Save it
22 |
23 |
24 |
25 | ##Step5 : Print Accuracy
26 |
--------------------------------------------------------------------------------
/Building a Digit Recognizer/temp/segmented.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/temp/segmented.png
--------------------------------------------------------------------------------
/Building a Digit Recognizer/temp/test_orig.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Digit Recognizer/temp/test_orig.png
--------------------------------------------------------------------------------
/Building a Movie Recommendation Engine/Building_A_Movie_Recommendation_Engine.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Movie Recommendation Engine/Building_A_Movie_Recommendation_Engine.pdf
--------------------------------------------------------------------------------
/Building a Movie Recommendation Engine/README.md:
--------------------------------------------------------------------------------
1 | # Building a Movie Recommendation Engine
2 |
3 |
4 |
5 |
6 |
7 | ### Instructions
8 |
9 | Open [`Movie_Recommendation_Engine.ipynb`](https://github.com/codeheroku/Introduction-to-Machine-Learning/blob/master/Building%20a%20Movie%20Recommendation%20Engine/Movie_Recommendation_Engine.ipynb) to see the tutorial on Building a Movie Recommendation Engine.
10 |
11 | Dataset associated with this tutorial can be found in [`movie_dataset.csv`](https://github.com/codeheroku/Introduction-to-Machine-Learning/blob/master/Building%20a%20Movie%20Recommendation%20Engine/movie_dataset.csv) file.
12 |
13 | Starter code for finding cosine similarity can be found in [`cosine_similarity.py`](https://github.com/codeheroku/Introduction-to-Machine-Learning/blob/master/Building%20a%20Movie%20Recommendation%20Engine/cosine_similarity.py) file.
14 |
15 | Starter code for movie recommendation engine can be found in [`movie_recommender_starter.py`](https://github.com/codeheroku/Introduction-to-Machine-Learning/blob/master/Building%20a%20Movie%20Recommendation%20Engine/movie_recommender_starter.py) file.
16 |
17 | The fully completed code can be found in [`movie_recommender_completed.py`](https://github.com/codeheroku/Introduction-to-Machine-Learning/blob/master/Building%20a%20Movie%20Recommendation%20Engine/movie_recommender_completed.py) file.
18 |
19 |
20 | > Check out our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) Course at [Code Heroku](http://www.codeheroku.com/) for a complete guide to Machine Learning.
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Building a Movie Recommendation Engine/assignment.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Building a Movie Recommendation Engine/assignment.pdf
--------------------------------------------------------------------------------
/Building a Movie Recommendation Engine/cosine_similarity.py:
--------------------------------------------------------------------------------
1 | from sklearn.feature_extraction.text import CountVectorizer
2 | from sklearn.metrics.pairwise import cosine_similarity
3 |
4 | text = ["London Paris London","Paris Paris London"]
5 | cv = CountVectorizer()
6 |
7 | count_matrix = cv.fit_transform(text)
8 |
9 | #print count_matrix.toarray()
10 | similarity_scores = cosine_similarity(count_matrix)
11 |
12 | print similarity_scores
--------------------------------------------------------------------------------
/Building a Movie Recommendation Engine/movie_recommender_completed.py:
--------------------------------------------------------------------------------
1 | import pandas as pd
2 | import numpy as np
3 | from sklearn.feature_extraction.text import CountVectorizer
4 | from sklearn.metrics.pairwise import cosine_similarity
5 | ###### helper functions. Use them when needed #######
6 | def get_title_from_index(index):
7 | return df[df.index == index]["title"].values[0]
8 |
9 | def get_index_from_title(title):
10 | return df[df.title == title]["index"].values[0]
11 | ##################################################
12 |
13 | ##Step 1: Read CSV File
14 | df = pd.read_csv("movie_dataset.csv")
15 | #print df.columns
16 | ##Step 2: Select Features
17 |
18 | features = ['keywords','cast','genres','director']
19 | ##Step 3: Create a column in DF which combines all selected features
20 | for feature in features:
21 | df[feature] = df[feature].fillna('')
22 |
23 | def combine_features(row):
24 | try:
25 | return row['keywords'] +" "+row['cast']+" "+row["genres"]+" "+row["director"]
26 | except:
27 | print "Error:", row
28 |
29 | df["combined_features"] = df.apply(combine_features,axis=1)
30 |
31 | #print "Combined Features:", df["combined_features"].head()
32 |
33 | ##Step 4: Create count matrix from this new combined column
34 | cv = CountVectorizer()
35 |
36 | count_matrix = cv.fit_transform(df["combined_features"])
37 |
38 | ##Step 5: Compute the Cosine Similarity based on the count_matrix
39 | cosine_sim = cosine_similarity(count_matrix)
40 | movie_user_likes = "Avatar"
41 |
42 | ## Step 6: Get index of this movie from its title
43 | movie_index = get_index_from_title(movie_user_likes)
44 |
45 | similar_movies = list(enumerate(cosine_sim[movie_index]))
46 |
47 | ## Step 7: Get a list of similar movies in descending order of similarity score
48 | sorted_similar_movies = sorted(similar_movies,key=lambda x:x[1],reverse=True)
49 |
50 | ## Step 8: Print titles of first 50 movies
51 | i=0
52 | for element in sorted_similar_movies:
53 | print get_title_from_index(element[0])
54 | i=i+1
55 | if i>50:
56 | break
57 |
--------------------------------------------------------------------------------
/Building a Movie Recommendation Engine/movie_recommender_starter.py:
--------------------------------------------------------------------------------
1 | import pandas as pd
2 | import numpy as np
3 | from sklearn.feature_extraction.text import CountVectorizer
4 | from sklearn.metrics.pairwise import cosine_similarity
5 | ###### helper functions. Use them when needed #######
6 | def get_title_from_index(index):
7 | return df[df.index == index]["title"].values[0]
8 |
9 | def get_index_from_title(title):
10 | return df[df.title == title]["index"].values[0]
11 | ##################################################
12 |
13 | ##Step 1: Read CSV File
14 |
15 | ##Step 2: Select Features
16 |
17 | ##Step 3: Create a column in DF which combines all selected features
18 |
19 | ##Step 4: Create count matrix from this new combined column
20 |
21 | ##Step 5: Compute the Cosine Similarity based on the count_matrix
22 |
23 | movie_user_likes = "Avatar"
24 |
25 | ## Step 6: Get index of this movie from its title
26 |
27 | ## Step 7: Get a list of similar movies in descending order of similarity score
28 |
29 |
30 | ## Step 8: Print titles of first 50 movies
--------------------------------------------------------------------------------
/Collaborative Filtering/Collaborative Filtering Dummy Dataset.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": 1,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "import pandas as pd\n",
10 | "from scipy import sparse\n",
11 | "from sklearn.metrics.pairwise import cosine_similarity\n",
12 | "ratings=pd.read_csv(\"toy_dataset.csv\",index_col=0)"
13 | ]
14 | },
15 | {
16 | "cell_type": "code",
17 | "execution_count": 9,
18 | "metadata": {},
19 | "outputs": [
20 | {
21 | "data": {
22 | "text/html": [
23 | "\n",
24 | "\n",
37 | "
\n",
38 | " \n",
39 | " \n",
40 | " | \n",
41 | " action1 | \n",
42 | " action2 | \n",
43 | " action3 | \n",
44 | " romantic1 | \n",
45 | " romantic2 | \n",
46 | " romantic3 | \n",
47 | "
\n",
48 | " \n",
49 | " \n",
50 | " \n",
51 | " user 1 | \n",
52 | " 4.0 | \n",
53 | " 5.0 | \n",
54 | " 3.0 | \n",
55 | " 0.0 | \n",
56 | " 2.0 | \n",
57 | " 1.0 | \n",
58 | "
\n",
59 | " \n",
60 | " user 2 | \n",
61 | " 5.0 | \n",
62 | " 3.0 | \n",
63 | " 3.0 | \n",
64 | " 2.0 | \n",
65 | " 2.0 | \n",
66 | " 0.0 | \n",
67 | "
\n",
68 | " \n",
69 | " user 3 | \n",
70 | " 1.0 | \n",
71 | " 0.0 | \n",
72 | " 0.0 | \n",
73 | " 4.0 | \n",
74 | " 5.0 | \n",
75 | " 4.0 | \n",
76 | "
\n",
77 | " \n",
78 | " user 4 | \n",
79 | " 0.0 | \n",
80 | " 2.0 | \n",
81 | " 1.0 | \n",
82 | " 4.0 | \n",
83 | " 0.0 | \n",
84 | " 3.0 | \n",
85 | "
\n",
86 | " \n",
87 | " user 5 | \n",
88 | " 1.0 | \n",
89 | " 0.0 | \n",
90 | " 2.0 | \n",
91 | " 3.0 | \n",
92 | " 3.0 | \n",
93 | " 4.0 | \n",
94 | "
\n",
95 | " \n",
96 | "
\n",
97 | "
"
98 | ],
99 | "text/plain": [
100 | " action1 action2 action3 romantic1 romantic2 romantic3\n",
101 | "user 1 4.0 5.0 3.0 0.0 2.0 1.0\n",
102 | "user 2 5.0 3.0 3.0 2.0 2.0 0.0\n",
103 | "user 3 1.0 0.0 0.0 4.0 5.0 4.0\n",
104 | "user 4 0.0 2.0 1.0 4.0 0.0 3.0\n",
105 | "user 5 1.0 0.0 2.0 3.0 3.0 4.0"
106 | ]
107 | },
108 | "execution_count": 9,
109 | "metadata": {},
110 | "output_type": "execute_result"
111 | }
112 | ],
113 | "source": [
114 | "ratings.fillna(0, inplace=True)\n",
115 | "ratings"
116 | ]
117 | },
118 | {
119 | "cell_type": "code",
120 | "execution_count": 16,
121 | "metadata": {},
122 | "outputs": [
123 | {
124 | "name": "stdout",
125 | "output_type": "stream",
126 | "text": [
127 | " user 1 user 2 user 3 user 4 user 5\n",
128 | "action1 0.36 0.56 -0.24 -0.440000 -0.240000\n",
129 | "action2 0.60 0.20 -0.40 0.000000 -0.400000\n",
130 | "action3 0.40 0.40 -0.60 -0.266667 0.066667\n",
131 | "romantic1 -0.65 -0.15 0.35 0.350000 0.100000\n",
132 | "romantic2 -0.08 -0.08 0.52 -0.480000 0.120000\n",
133 | "romantic3 -0.35 -0.60 0.40 0.150000 0.400000\n"
134 | ]
135 | },
136 | {
137 | "data": {
138 | "text/html": [
139 | "\n",
140 | "\n",
153 | "
\n",
154 | " \n",
155 | " \n",
156 | " | \n",
157 | " action1 | \n",
158 | " action2 | \n",
159 | " action3 | \n",
160 | " romantic1 | \n",
161 | " romantic2 | \n",
162 | " romantic3 | \n",
163 | "
\n",
164 | " \n",
165 | " \n",
166 | " \n",
167 | " action1 | \n",
168 | " 1.000000 | \n",
169 | " 0.706689 | \n",
170 | " 0.813682 | \n",
171 | " -0.799411 | \n",
172 | " -0.025392 | \n",
173 | " -0.914106 | \n",
174 | "
\n",
175 | " \n",
176 | " action2 | \n",
177 | " 0.706689 | \n",
178 | " 1.000000 | \n",
179 | " 0.723102 | \n",
180 | " -0.845154 | \n",
181 | " -0.518999 | \n",
182 | " -0.843374 | \n",
183 | "
\n",
184 | " \n",
185 | " action3 | \n",
186 | " 0.813682 | \n",
187 | " 0.723102 | \n",
188 | " 1.000000 | \n",
189 | " -0.847946 | \n",
190 | " -0.379980 | \n",
191 | " -0.802181 | \n",
192 | "
\n",
193 | " \n",
194 | " romantic1 | \n",
195 | " -0.799411 | \n",
196 | " -0.845154 | \n",
197 | " -0.847946 | \n",
198 | " 1.000000 | \n",
199 | " 0.148039 | \n",
200 | " 0.723747 | \n",
201 | "
\n",
202 | " \n",
203 | " romantic2 | \n",
204 | " -0.025392 | \n",
205 | " -0.518999 | \n",
206 | " -0.379980 | \n",
207 | " 0.148039 | \n",
208 | " 1.000000 | \n",
209 | " 0.393939 | \n",
210 | "
\n",
211 | " \n",
212 | " romantic3 | \n",
213 | " -0.914106 | \n",
214 | " -0.843374 | \n",
215 | " -0.802181 | \n",
216 | " 0.723747 | \n",
217 | " 0.393939 | \n",
218 | " 1.000000 | \n",
219 | "
\n",
220 | " \n",
221 | "
\n",
222 | "
"
223 | ],
224 | "text/plain": [
225 | " action1 action2 action3 romantic1 romantic2 romantic3\n",
226 | "action1 1.000000 0.706689 0.813682 -0.799411 -0.025392 -0.914106\n",
227 | "action2 0.706689 1.000000 0.723102 -0.845154 -0.518999 -0.843374\n",
228 | "action3 0.813682 0.723102 1.000000 -0.847946 -0.379980 -0.802181\n",
229 | "romantic1 -0.799411 -0.845154 -0.847946 1.000000 0.148039 0.723747\n",
230 | "romantic2 -0.025392 -0.518999 -0.379980 0.148039 1.000000 0.393939\n",
231 | "romantic3 -0.914106 -0.843374 -0.802181 0.723747 0.393939 1.000000"
232 | ]
233 | },
234 | "execution_count": 16,
235 | "metadata": {},
236 | "output_type": "execute_result"
237 | }
238 | ],
239 | "source": [
240 | "def standardize(row):\n",
241 | " new_row = (row - row.mean())/(row.max()-row.min())\n",
242 | " return new_row\n",
243 | "\n",
244 | "df_std = ratings.apply(standardize).T\n",
245 | "print(df_std)\n",
246 | "\n",
247 | "sparse_df = sparse.csr_matrix(df_std.values)\n",
248 | "corrMatrix = pd.DataFrame(cosine_similarity(sparse_df),index=ratings.columns,columns=ratings.columns)\n",
249 | "corrMatrix"
250 | ]
251 | },
252 | {
253 | "cell_type": "code",
254 | "execution_count": 17,
255 | "metadata": {},
256 | "outputs": [
257 | {
258 | "data": {
259 | "text/html": [
260 | "\n",
261 | "\n",
274 | "
\n",
275 | " \n",
276 | " \n",
277 | " | \n",
278 | " action1 | \n",
279 | " action2 | \n",
280 | " action3 | \n",
281 | " romantic1 | \n",
282 | " romantic2 | \n",
283 | " romantic3 | \n",
284 | "
\n",
285 | " \n",
286 | " \n",
287 | " \n",
288 | " action1 | \n",
289 | " 1.000000 | \n",
290 | " 0.706689 | \n",
291 | " 0.813682 | \n",
292 | " -0.799411 | \n",
293 | " -0.025392 | \n",
294 | " -0.914106 | \n",
295 | "
\n",
296 | " \n",
297 | " action2 | \n",
298 | " 0.706689 | \n",
299 | " 1.000000 | \n",
300 | " 0.723102 | \n",
301 | " -0.845154 | \n",
302 | " -0.518999 | \n",
303 | " -0.843374 | \n",
304 | "
\n",
305 | " \n",
306 | " action3 | \n",
307 | " 0.813682 | \n",
308 | " 0.723102 | \n",
309 | " 1.000000 | \n",
310 | " -0.847946 | \n",
311 | " -0.379980 | \n",
312 | " -0.802181 | \n",
313 | "
\n",
314 | " \n",
315 | " romantic1 | \n",
316 | " -0.799411 | \n",
317 | " -0.845154 | \n",
318 | " -0.847946 | \n",
319 | " 1.000000 | \n",
320 | " 0.148039 | \n",
321 | " 0.723747 | \n",
322 | "
\n",
323 | " \n",
324 | " romantic2 | \n",
325 | " -0.025392 | \n",
326 | " -0.518999 | \n",
327 | " -0.379980 | \n",
328 | " 0.148039 | \n",
329 | " 1.000000 | \n",
330 | " 0.393939 | \n",
331 | "
\n",
332 | " \n",
333 | " romantic3 | \n",
334 | " -0.914106 | \n",
335 | " -0.843374 | \n",
336 | " -0.802181 | \n",
337 | " 0.723747 | \n",
338 | " 0.393939 | \n",
339 | " 1.000000 | \n",
340 | "
\n",
341 | " \n",
342 | "
\n",
343 | "
"
344 | ],
345 | "text/plain": [
346 | " action1 action2 action3 romantic1 romantic2 romantic3\n",
347 | "action1 1.000000 0.706689 0.813682 -0.799411 -0.025392 -0.914106\n",
348 | "action2 0.706689 1.000000 0.723102 -0.845154 -0.518999 -0.843374\n",
349 | "action3 0.813682 0.723102 1.000000 -0.847946 -0.379980 -0.802181\n",
350 | "romantic1 -0.799411 -0.845154 -0.847946 1.000000 0.148039 0.723747\n",
351 | "romantic2 -0.025392 -0.518999 -0.379980 0.148039 1.000000 0.393939\n",
352 | "romantic3 -0.914106 -0.843374 -0.802181 0.723747 0.393939 1.000000"
353 | ]
354 | },
355 | "execution_count": 17,
356 | "metadata": {},
357 | "output_type": "execute_result"
358 | }
359 | ],
360 | "source": [
361 | "corrMatrix = ratings.corr(method='pearson')\n",
362 | "corrMatrix.head(6)"
363 | ]
364 | },
365 | {
366 | "cell_type": "code",
367 | "execution_count": 18,
368 | "metadata": {},
369 | "outputs": [],
370 | "source": [
371 | "def get_similar(movie_name,rating):\n",
372 | " similar_score = corrMatrix[movie_name]*(rating-2.5)\n",
373 | " similar_score = similar_score.sort_values(ascending=False)\n",
374 | " #print(type(similar_ratings))\n",
375 | " return similar_score"
376 | ]
377 | },
378 | {
379 | "cell_type": "code",
380 | "execution_count": 22,
381 | "metadata": {},
382 | "outputs": [
383 | {
384 | "data": {
385 | "text/html": [
386 | "\n",
387 | "\n",
400 | "
\n",
401 | " \n",
402 | " \n",
403 | " | \n",
404 | " action1 | \n",
405 | " action2 | \n",
406 | " action3 | \n",
407 | " romantic1 | \n",
408 | " romantic2 | \n",
409 | " romantic3 | \n",
410 | "
\n",
411 | " \n",
412 | " \n",
413 | " \n",
414 | " 0 | \n",
415 | " 2.500000 | \n",
416 | " 1.766722 | \n",
417 | " 2.034204 | \n",
418 | " -1.998527 | \n",
419 | " -0.063480 | \n",
420 | " -2.285265 | \n",
421 | "
\n",
422 | " \n",
423 | " 1 | \n",
424 | " 0.038088 | \n",
425 | " 0.778499 | \n",
426 | " 0.569970 | \n",
427 | " -0.222059 | \n",
428 | " -1.500000 | \n",
429 | " -0.590909 | \n",
430 | "
\n",
431 | " \n",
432 | " 2 | \n",
433 | " 1.371159 | \n",
434 | " 1.265061 | \n",
435 | " 1.203271 | \n",
436 | " -1.085620 | \n",
437 | " -0.590909 | \n",
438 | " -1.500000 | \n",
439 | "
\n",
440 | " \n",
441 | "
\n",
442 | "
"
443 | ],
444 | "text/plain": [
445 | " action1 action2 action3 romantic1 romantic2 romantic3\n",
446 | "0 2.500000 1.766722 2.034204 -1.998527 -0.063480 -2.285265\n",
447 | "1 0.038088 0.778499 0.569970 -0.222059 -1.500000 -0.590909\n",
448 | "2 1.371159 1.265061 1.203271 -1.085620 -0.590909 -1.500000"
449 | ]
450 | },
451 | "execution_count": 22,
452 | "metadata": {},
453 | "output_type": "execute_result"
454 | }
455 | ],
456 | "source": [
457 | "action_lover = [(\"action1\",5),(\"romantic2\",1),(\"romantic3\",1)]\n",
458 | "similar_scores = pd.DataFrame()\n",
459 | "for movie,rating in action_lover:\n",
460 | " similar_scores = similar_scores.append(get_similar(movie,rating),ignore_index = True)\n",
461 | "\n",
462 | "similar_scores.head(10)"
463 | ]
464 | },
465 | {
466 | "cell_type": "code",
467 | "execution_count": 23,
468 | "metadata": {},
469 | "outputs": [
470 | {
471 | "data": {
472 | "text/plain": [
473 | "action1 3.909247\n",
474 | "action2 3.810282\n",
475 | "action3 3.807445\n",
476 | "romantic2 -2.154389\n",
477 | "romantic1 -3.306206\n",
478 | "romantic3 -4.376174\n",
479 | "dtype: float64"
480 | ]
481 | },
482 | "execution_count": 23,
483 | "metadata": {},
484 | "output_type": "execute_result"
485 | }
486 | ],
487 | "source": [
488 | "similar_scores.sum().sort_values(ascending=False)"
489 | ]
490 | },
491 | {
492 | "cell_type": "code",
493 | "execution_count": null,
494 | "metadata": {},
495 | "outputs": [],
496 | "source": []
497 | }
498 | ],
499 | "metadata": {
500 | "kernelspec": {
501 | "display_name": "Python 3",
502 | "language": "python",
503 | "name": "python3"
504 | },
505 | "language_info": {
506 | "codemirror_mode": {
507 | "name": "ipython",
508 | "version": 3
509 | },
510 | "file_extension": ".py",
511 | "mimetype": "text/x-python",
512 | "name": "python",
513 | "nbconvert_exporter": "python",
514 | "pygments_lexer": "ipython3",
515 | "version": "3.6.1"
516 | }
517 | },
518 | "nbformat": 4,
519 | "nbformat_minor": 2
520 | }
521 |
--------------------------------------------------------------------------------
/Collaborative Filtering/dataset/README.txt:
--------------------------------------------------------------------------------
1 | Summary
2 | =======
3 |
4 | This dataset (ml-latest-small) describes 5-star rating and free-text tagging activity from [MovieLens](http://movielens.org), a movie recommendation service. It contains 100836 ratings and 3683 tag applications across 9742 movies. These data were created by 610 users between March 29, 1996 and September 24, 2018. This dataset was generated on September 26, 2018.
5 |
6 | Users were selected at random for inclusion. All selected users had rated at least 20 movies. No demographic information is included. Each user is represented by an id, and no other information is provided.
7 |
8 | The data are contained in the files `links.csv`, `movies.csv`, `ratings.csv` and `tags.csv`. More details about the contents and use of all these files follows.
9 |
10 | This is a *development* dataset. As such, it may change over time and is not an appropriate dataset for shared research results. See available *benchmark* datasets if that is your intent.
11 |
12 | This and other GroupLens data sets are publicly available for download at .
13 |
14 |
15 | Usage License
16 | =============
17 |
18 | Neither the University of Minnesota nor any of the researchers involved can guarantee the correctness of the data, its suitability for any particular purpose, or the validity of results based on the use of the data set. The data set may be used for any research purposes under the following conditions:
19 |
20 | * The user may not state or imply any endorsement from the University of Minnesota or the GroupLens Research Group.
21 | * The user must acknowledge the use of the data set in publications resulting from the use of the data set (see below for citation information).
22 | * The user may redistribute the data set, including transformations, so long as it is distributed under these same license conditions.
23 | * The user may not use this information for any commercial or revenue-bearing purposes without first obtaining permission from a faculty member of the GroupLens Research Project at the University of Minnesota.
24 | * The executable software scripts are provided "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of them is with you. Should the program prove defective, you assume the cost of all necessary servicing, repair or correction.
25 |
26 | In no event shall the University of Minnesota, its affiliates or employees be liable to you for any damages arising out of the use or inability to use these programs (including but not limited to loss of data or data being rendered inaccurate).
27 |
28 | If you have any further questions or comments, please email
29 |
30 |
31 | Citation
32 | ========
33 |
34 | To acknowledge use of the dataset in publications, please cite the following paper:
35 |
36 | > F. Maxwell Harper and Joseph A. Konstan. 2015. The MovieLens Datasets: History and Context. ACM Transactions on Interactive Intelligent Systems (TiiS) 5, 4: 19:1–19:19.
37 |
38 |
39 | Further Information About GroupLens
40 | ===================================
41 |
42 | GroupLens is a research group in the Department of Computer Science and Engineering at the University of Minnesota. Since its inception in 1992, GroupLens's research projects have explored a variety of fields including:
43 |
44 | * recommender systems
45 | * online communities
46 | * mobile and ubiquitious technologies
47 | * digital libraries
48 | * local geographic information systems
49 |
50 | GroupLens Research operates a movie recommender based on collaborative filtering, MovieLens, which is the source of these data. We encourage you to visit to try it out! If you have exciting ideas for experimental work to conduct on MovieLens, send us an email at - we are always interested in working with external collaborators.
51 |
52 |
53 | Content and Use of Files
54 | ========================
55 |
56 | Formatting and Encoding
57 | -----------------------
58 |
59 | The dataset files are written as [comma-separated values](http://en.wikipedia.org/wiki/Comma-separated_values) files with a single header row. Columns that contain commas (`,`) are escaped using double-quotes (`"`). These files are encoded as UTF-8. If accented characters in movie titles or tag values (e.g. Misérables, Les (1995)) display incorrectly, make sure that any program reading the data, such as a text editor, terminal, or script, is configured for UTF-8.
60 |
61 |
62 | User Ids
63 | --------
64 |
65 | MovieLens users were selected at random for inclusion. Their ids have been anonymized. User ids are consistent between `ratings.csv` and `tags.csv` (i.e., the same id refers to the same user across the two files).
66 |
67 |
68 | Movie Ids
69 | ---------
70 |
71 | Only movies with at least one rating or tag are included in the dataset. These movie ids are consistent with those used on the MovieLens web site (e.g., id `1` corresponds to the URL ). Movie ids are consistent between `ratings.csv`, `tags.csv`, `movies.csv`, and `links.csv` (i.e., the same id refers to the same movie across these four data files).
72 |
73 |
74 | Ratings Data File Structure (ratings.csv)
75 | -----------------------------------------
76 |
77 | All ratings are contained in the file `ratings.csv`. Each line of this file after the header row represents one rating of one movie by one user, and has the following format:
78 |
79 | userId,movieId,rating,timestamp
80 |
81 | The lines within this file are ordered first by userId, then, within user, by movieId.
82 |
83 | Ratings are made on a 5-star scale, with half-star increments (0.5 stars - 5.0 stars).
84 |
85 | Timestamps represent seconds since midnight Coordinated Universal Time (UTC) of January 1, 1970.
86 |
87 |
88 | Tags Data File Structure (tags.csv)
89 | -----------------------------------
90 |
91 | All tags are contained in the file `tags.csv`. Each line of this file after the header row represents one tag applied to one movie by one user, and has the following format:
92 |
93 | userId,movieId,tag,timestamp
94 |
95 | The lines within this file are ordered first by userId, then, within user, by movieId.
96 |
97 | Tags are user-generated metadata about movies. Each tag is typically a single word or short phrase. The meaning, value, and purpose of a particular tag is determined by each user.
98 |
99 | Timestamps represent seconds since midnight Coordinated Universal Time (UTC) of January 1, 1970.
100 |
101 |
102 | Movies Data File Structure (movies.csv)
103 | ---------------------------------------
104 |
105 | Movie information is contained in the file `movies.csv`. Each line of this file after the header row represents one movie, and has the following format:
106 |
107 | movieId,title,genres
108 |
109 | Movie titles are entered manually or imported from , and include the year of release in parentheses. Errors and inconsistencies may exist in these titles.
110 |
111 | Genres are a pipe-separated list, and are selected from the following:
112 |
113 | * Action
114 | * Adventure
115 | * Animation
116 | * Children's
117 | * Comedy
118 | * Crime
119 | * Documentary
120 | * Drama
121 | * Fantasy
122 | * Film-Noir
123 | * Horror
124 | * Musical
125 | * Mystery
126 | * Romance
127 | * Sci-Fi
128 | * Thriller
129 | * War
130 | * Western
131 | * (no genres listed)
132 |
133 |
134 | Links Data File Structure (links.csv)
135 | ---------------------------------------
136 |
137 | Identifiers that can be used to link to other sources of movie data are contained in the file `links.csv`. Each line of this file after the header row represents one movie, and has the following format:
138 |
139 | movieId,imdbId,tmdbId
140 |
141 | movieId is an identifier for movies used by . E.g., the movie Toy Story has the link .
142 |
143 | imdbId is an identifier for movies used by . E.g., the movie Toy Story has the link .
144 |
145 | tmdbId is an identifier for movies used by . E.g., the movie Toy Story has the link .
146 |
147 | Use of the resources listed above is subject to the terms of each provider.
148 |
149 |
150 | Cross-Validation
151 | ----------------
152 |
153 | Prior versions of the MovieLens dataset included either pre-computed cross-folds or scripts to perform this computation. We no longer bundle either of these features with the dataset, since most modern toolkits provide this as a built-in feature. If you wish to learn about standard approaches to cross-fold computation in the context of recommender systems evaluation, see [LensKit](http://lenskit.org) for tools, documentation, and open-source code examples.
154 |
--------------------------------------------------------------------------------
/Collaborative Filtering/dataset/toy_dataset.csv:
--------------------------------------------------------------------------------
1 | ,action1,action2,action3,romantic1,romantic2,romantic3
2 | user 1,4,5,3,,2,1
3 | user 2,5,3,3,2,2,
4 | user 3,1,,,4,5,4
5 | user 4,,2,1,4,,3
6 | user 5,1,,2,3,3,4
--------------------------------------------------------------------------------
/Face Recognition Using PCA/README.md:
--------------------------------------------------------------------------------
1 | # Face Recognition Using PCA
2 |
3 |
4 |
5 |
6 |
7 | ### Instructions
8 |
9 | This folder contains resources of Face Recognition Using PCA lesson.
10 |
11 | The recorded video for this lesson can be found here: https://www.youtube.com/watch?v=g4Urfno4aTc
12 |
13 | Dataset associated with this tutorial can be found in [`face_data.csv`](https://github.com/codeheroku/Introduction-to-Machine-Learning/blob/master/Face%20Recognition%20Using%20PCA/face_data.csv) file.
14 |
15 | Starter code can be found in [`face_recog_starter.py`](https://github.com/codeheroku/Introduction-to-Machine-Learning/blob/master/Face%20Recognition%20Using%20PCA/face_recog_starter.py) file.
16 |
17 | The fully completed code can be found in [`face_recog_completed.py`](https://github.com/codeheroku/Introduction-to-Machine-Learning/blob/master/Face%20Recognition%20Using%20PCA/face_recog_completed.py) file.
18 |
19 |
20 | > Check out our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) Course at [Code Heroku](http://www.codeheroku.com/) for a complete guide to Machine Learning.
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Face Recognition Using PCA/face_recog_completed.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import pandas as pd
3 | import matplotlib.pyplot as plt
4 | from time import time
5 | from sklearn.model_selection import train_test_split
6 | from sklearn.metrics import classification_report
7 | from sklearn.decomposition import PCA
8 | from sklearn.svm import SVC
9 |
10 | ##Helper functions. Use when needed.
11 | def show_orignal_images(pixels):
12 | #Displaying Orignal Images
13 | fig, axes = plt.subplots(6, 10, figsize=(11, 7),
14 | subplot_kw={'xticks':[], 'yticks':[]})
15 | for i, ax in enumerate(axes.flat):
16 | ax.imshow(np.array(pixels)[i].reshape(64, 64), cmap='gray')
17 | plt.show()
18 |
19 | def show_eigenfaces(pca):
20 | #Displaying Eigenfaces
21 | fig, axes = plt.subplots(3, 8, figsize=(9, 4),
22 | subplot_kw={'xticks':[], 'yticks':[]})
23 | for i, ax in enumerate(axes.flat):
24 | ax.imshow(pca.components_[i].reshape(64, 64), cmap='gray')
25 | ax.set_title("PC " + str(i+1))
26 | plt.show()
27 |
28 |
29 | ## Step 1: Read dataset and visualize it
30 | df = pd.read_csv("face_data.csv")
31 | targets = df["target"]
32 | pixels = df.drop(["target"],axis=1)
33 |
34 | print np.array(pixels).shape
35 |
36 | show_orignal_images(pixels)
37 | ## Step 2: Split Dataset into training and testing
38 | x_train, x_test, y_train, y_test = train_test_split(pixels, targets)
39 |
40 | ## Step 3: Perform PCA.
41 | pca = PCA(n_components=150).fit(x_train)
42 | plt.plot(np.cumsum(pca.explained_variance_ratio_))
43 | plt.xlabel('number of components')
44 | plt.ylabel('cumulative explained variance');
45 | plt.show()
46 |
47 | show_eigenfaces(pca)
48 |
49 | ## Step 4: Project Training data to PCA
50 | print("Projecting the input data on the eigenfaces orthonormal basis")
51 | Xtrain_pca = pca.transform(x_train)
52 |
53 | ##############
54 |
55 | ## Step 5: Initialize Classifer and fit training data
56 | clf = SVC(kernel='rbf',C=1000,gamma=0.001)
57 | clf = clf.fit(Xtrain_pca, y_train)
58 |
59 |
60 | ## Step 6: Perform testing and get classification report
61 | print("Predicting people's names on the test set")
62 | t0 = time()
63 | Xtest_pca = pca.transform(x_test)
64 | y_pred = clf.predict(Xtest_pca)
65 | print("done in %0.3fs" % (time() - t0))
66 | print(classification_report(y_test, y_pred))
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/Face Recognition Using PCA/face_recog_starter.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import pandas as pd
3 | import matplotlib.pyplot as plt
4 | from time import time
5 | from sklearn.model_selection import train_test_split
6 | from sklearn.metrics import classification_report
7 | from sklearn.decomposition import PCA
8 | from sklearn.svm import SVC
9 |
10 | ##Helper functions. Use when needed.
11 | def show_orignal_images(pixels):
12 | #Displaying Orignal Images
13 | fig, axes = plt.subplots(6, 10, figsize=(11, 7),
14 | subplot_kw={'xticks':[], 'yticks':[]})
15 | for i, ax in enumerate(axes.flat):
16 | ax.imshow(np.array(pixels)[i].reshape(64, 64), cmap='gray')
17 | plt.show()
18 |
19 | def show_eigenfaces(pca):
20 | #Displaying Eigenfaces
21 | fig, axes = plt.subplots(3, 8, figsize=(9, 4),
22 | subplot_kw={'xticks':[], 'yticks':[]})
23 | for i, ax in enumerate(axes.flat):
24 | ax.imshow(pca.components_[i].reshape(64, 64), cmap='gray')
25 | ax.set_title("PC " + str(i+1))
26 | plt.show()
27 |
28 |
29 | ## Step 1: Read dataset and visualize it.
30 |
31 | ## Step 2: Split Dataset into training and testing
32 |
33 | ## Step 3: Perform PCA.
34 |
35 | ## Step 4: Project Training data to PCA
36 |
37 | ##############
38 |
39 | ## Step 5: Initialize Classifer and fit training data
40 |
41 | ## Step 6: Perform testing and get classification report
42 |
43 |
44 |
--------------------------------------------------------------------------------
/Face Recognition Using PCA/olivetti_faces.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Face Recognition Using PCA/olivetti_faces.npy
--------------------------------------------------------------------------------
/Face Recognition Using PCA/olivetti_faces_target.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Face Recognition Using PCA/olivetti_faces_target.npy
--------------------------------------------------------------------------------
/Face Recognition Using PCA/prep_dataset.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import pandas as pd
3 | import matplotlib.pyplot as plt
4 |
5 |
6 | faces_image = np.load('olivetti_faces.npy')
7 | faces_target = np.load('olivetti_faces_target.npy')
8 |
9 | n_row = 64
10 | n_col = 64
11 |
12 | faces_data = faces_image.reshape(faces_image.shape[0], faces_image.shape[1] * faces_image.shape[2])
13 |
14 | plt.imshow(faces_image[22],cmap='gray')
15 |
16 | plt.show()
17 |
18 | n_samples = faces_image.shape[0]
19 | X = faces_data
20 | n_features = faces_data.shape[1]
21 | # the label to predict is the id of the person
22 | y = faces_target
23 | n_classes = faces_target.shape[0]
24 | #merged.to_csv("output.csv", index=False)
25 |
26 | df= pd.DataFrame(X)
27 | df['target'] = pd.Series(y, index=df.index)
28 |
29 | df.to_csv("face_data.csv", index=False)
30 |
--------------------------------------------------------------------------------
/Indeed Job Analysis/chromedriver_mac:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Indeed Job Analysis/chromedriver_mac
--------------------------------------------------------------------------------
/Indeed Job Analysis/scrape_selenium.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | import pandas as pd
3 | from bs4 import BeautifulSoup
4 |
5 | options = webdriver.ChromeOptions()
6 | driver = webdriver.Chrome("./chromedriver")
7 |
8 |
9 | df = pd.DataFrame(columns=["Title","Location","Company","Salary","Sponsored","Description"])
10 |
11 | for i in range(0,500,10):
12 | driver.get('https://www.indeed.co.in/jobs?q=artificial%20intelligence&l=India&start='+str(i))
13 | jobs = []
14 | driver.implicitly_wait(4)
15 |
16 |
17 | for job in driver.find_elements_by_class_name('result'):
18 |
19 | soup = BeautifulSoup(job.get_attribute('innerHTML'),'html.parser')
20 |
21 | try:
22 | title = soup.find("a",class_="jobtitle").text.replace("\n","").strip()
23 |
24 | except:
25 | title = 'None'
26 |
27 | try:
28 | location = soup.find(class_="location").text
29 | except:
30 | location = 'None'
31 |
32 | try:
33 | company = soup.find(class_="company").text.replace("\n","").strip()
34 | except:
35 | company = 'None'
36 |
37 | try:
38 | salary = soup.find(class_="salary").text.replace("\n","").strip()
39 | except:
40 | salary = 'None'
41 |
42 | try:
43 | sponsored = soup.find(class_="sponsoredGray").text
44 | sponsored = "Sponsored"
45 | except:
46 | sponsored = "Organic"
47 |
48 |
49 | sum_div = job.find_element_by_xpath('./div[3]')
50 | try:
51 | sum_div.click()
52 | except:
53 | close_button = driver.find_elements_by_class_name('popover-x-button-close')[0]
54 | close_button.click()
55 | sum_div.click()
56 | job_desc = driver.find_element_by_id('vjs-desc').text
57 |
58 | df = df.append({'Title':title,'Location':location,"Company":company,"Salary":salary,
59 | "Sponsored":sponsored,"Description":job_desc},ignore_index=True)
60 |
61 | print("Got these many results:",df.shape)
62 |
63 |
64 | df.to_csv("ai.csv",index=False)
65 |
66 |
--------------------------------------------------------------------------------
/Indeed Job Analysis/scraper_only_bs4.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 | import pandas as pd
3 | from bs4 import BeautifulSoup
4 |
5 | ## Download the chromedriver from link in description
6 | ## And give the location of executable here
7 | driver = webdriver.Chrome("./chromedriver")
8 |
9 | dataframe = pd.DataFrame(columns=["Title","Location","Company","Salary","Sponsored","Description"])
10 |
11 |
12 | for i in range(0,500,10):
13 |
14 | ##Step1: Get the page
15 | driver.get("https://www.indeed.co.in/jobs?q=data+science&l=India&start="+str(i))
16 | driver.implicitly_wait(4)
17 |
18 | all_jobs = driver.find_elements_by_class_name('result')
19 |
20 | for job in all_jobs:
21 |
22 | result_html = job.get_attribute('innerHTML')
23 | soup = BeautifulSoup(result_html,'html.parser')
24 |
25 | try:
26 | title = soup.find("a",class_="jobtitle").text.replace('\n','')
27 | except:
28 | title = 'None'
29 |
30 | try:
31 | location = soup.find(class_="location").text
32 | except:
33 | location = 'None'
34 |
35 | try:
36 | company = soup.find(class_="company").text.replace("\n","").strip()
37 | except:
38 | company = 'None'
39 |
40 | try:
41 | salary = soup.find(class_="salary").text.replace("\n","").strip()
42 | except:
43 | salary = 'None'
44 |
45 | try:
46 | sponsored = soup.find(class_="sponsoredGray").text
47 | sponsored = "Sponsored"
48 | except:
49 | sponsored = "Organic"
50 |
51 |
52 | sum_div = job.find_elements_by_class_name("summary")[0]
53 | try:
54 | sum_div.click()
55 | except:
56 | close_button = driver.find_elements_by_class_name("popover-x-button-close")[0]
57 | close_button.click()
58 | sum_div.click()
59 |
60 |
61 | job_desc = driver.find_element_by_id('vjs-desc').text
62 |
63 |
64 | dataframe = dataframe.append({'Title':title,'Location':location,"Company":company,
65 | "Sponsored":sponsored,"Description":job_desc},
66 | ignore_index=True)
67 |
68 |
69 | dataframe.to_csv("datascience.csv",index=False)
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/K Means/README.md:
--------------------------------------------------------------------------------
1 | # K Means
2 |
3 |
4 |
5 |
6 |
7 | ### Instructions
8 |
9 | This folder contains resources of Introduction to Unsupervised Learning Using K Means lesson.
10 |
11 | The recorded video for this lesson can be found here: https://www.youtube.com/watch?v=gnxCdjaBkXY
12 |
13 | Dataset associated with this tutorial can be found in [`dataset.csv`](https://github.com/codeheroku/Introduction-to-Machine-Learning/blob/master/K%20Means/dataset.csv) file.
14 |
15 | Starter code can be found in [`kmeans.py`](https://github.com/codeheroku/Introduction-to-Machine-Learning/blob/master/K%20Means/kmeans.py) file.
16 |
17 | The fully completed code can be found in [`kmeans_completed.py`](https://github.com/codeheroku/Introduction-to-Machine-Learning/blob/master/K%20Means/kmeans_completed.py) file.
18 |
19 |
20 | > Check out our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) Course at [Code Heroku](http://www.codeheroku.com/) for a complete guide to Machine Learning.
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/K Means/kmeans.py:
--------------------------------------------------------------------------------
1 | from copy import deepcopy
2 | import numpy as np
3 | import pandas as pd
4 | from matplotlib import pyplot as plt
5 | from sklearn.metrics.pairwise import euclidean_distances
6 | plt.rcParams['figure.figsize'] = (16, 9)
7 | plt.ion()
8 |
9 | #####Helper Functions#####
10 | def show_plot(C,X):
11 | colors = ['r', 'g', 'b', 'y', 'c', 'r']
12 | for i in range(k):
13 |
14 | points = np.array([X[j] for j in range(len(X)) if clusters[j] == i])
15 | plt.scatter(points[:, 0], points[:, 1], s=20, c=colors[i], alpha=0.2)
16 | plt.scatter(C[i,0], C[i,1], marker='D', s=200, c='black',edgecolor='w')
17 |
18 | plt.draw()
19 | plt.pause(5)
20 | plt.clf()
21 |
22 | def get_random_centeroids(X,k):
23 | C_x = np.random.randint(0, np.max(X)-20, size=k)
24 | C_y = np.random.randint(0, np.max(X)-20, size=k)
25 | C = np.array(list(zip(C_x, C_y)))
26 | return C,C_x,C_y
27 |
28 | # Euclidean Distance Caculator
29 | def dist(a, b, ax=1):
30 | return np.linalg.norm(a - b, axis=ax)
31 |
32 | #######Begin Here###############################
33 | ## Step1: Read Dataset
34 |
35 | ## Step2: Get values f1,f2 and plotting it
36 |
37 |
38 | ## Step3: Plot data and centroids
39 |
40 | ##Init K Random Centroids
41 |
42 |
43 | ## Step4: Run Kmeans
44 | while change_in_c != 0:
45 | ##Part1: Cluster Assignment. Assign points to closest cluster
46 |
47 |
48 | ##Part2: Cluster Movement: Find the new centroids
49 | ##by taking the average value of all points and moving centroid there
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/K Means/kmeans_completed.py:
--------------------------------------------------------------------------------
1 | from copy import deepcopy
2 | import numpy as np
3 | import pandas as pd
4 | from matplotlib import pyplot as plt
5 | from sklearn.metrics.pairwise import euclidean_distances
6 | plt.rcParams['figure.figsize'] = (16, 9)
7 | plt.ion()
8 |
9 | #####Helper Functions#####
10 | def show_plot(C,X):
11 | colors = ['r', 'g', 'b', 'y', 'c', 'r']
12 | for i in range(k):
13 |
14 | points = np.array([X[j] for j in range(len(X)) if clusters[j] == i])
15 | plt.scatter(points[:, 0], points[:, 1], s=20, c=colors[i], alpha=0.2)
16 | plt.scatter(C[i,0], C[i,1], marker='D', s=200, c='black',edgecolor='w')
17 |
18 | plt.draw()
19 | plt.pause(5)
20 | plt.clf()
21 |
22 | def get_random_centeroids(X,k):
23 | C_x = np.random.randint(0, np.max(X)-20, size=k)
24 | C_y = np.random.randint(0, np.max(X)-20, size=k)
25 | C = np.array(list(zip(C_x, C_y)))
26 | return C,C_x,C_y
27 |
28 | # Euclidean Distance Caculator
29 | def dist(a, b, ax=1):
30 | return np.linalg.norm(a - b, axis=ax)
31 |
32 | #######Begin Here###############################
33 | ## Step1: Read Dataset
34 | data = pd.read_csv('dataset.csv')
35 |
36 |
37 | ## Step2: Get values f1,f2 and plotting it
38 | f1 = data['V1'].values
39 | f2 = data['V2'].values
40 | X = list(zip(f1, f2))
41 |
42 | ## Step3: Plot data and centroids
43 |
44 | ##Init K Random Centroids
45 | k = 4
46 | C,C_x,C_y = get_random_centeroids(X,k)
47 |
48 | # plt.scatter(f1, f2, c='black', s=7)
49 | # plt.scatter(C_x, C_y, marker='*', s=200, c='r')
50 | # plt.show()
51 |
52 | # To store the value of centroids when it updates
53 | C_old = np.zeros(C.shape)
54 | # Cluster Lables(0, 1, 2)
55 | clusters = np.zeros(len(X))
56 |
57 | change_in_c = dist(C, C_old, None)
58 |
59 | erros = []
60 |
61 | while change_in_c != 0:
62 | ##Part1: Cluster Assignment. Assign points to closest cluster
63 | for i in range(len(X)):
64 | distances_x_centroids = dist(X[i], C)
65 | clusters[i] = np.argmin(distances_x_centroids)
66 | # Storing the old centroid values
67 | C_old = deepcopy(C)
68 |
69 | #Find the new centroids by taking the average value
70 | #Part2: Cluster Movement
71 | for i in range(k):
72 | points = [X[j] for j in range(len(X)) if clusters[j] == i]
73 | C[i] = np.mean(points, axis=0)
74 |
75 |
76 | show_plot(C,X)
77 |
78 | change_in_c = dist(C, C_old, None)
79 |
80 | plt.show()
81 |
82 |
83 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Code Heroku
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Malaria Detection/Readme.md:
--------------------------------------------------------------------------------
1 | Step 1: Download the cell images from here
2 | https://drive.google.com/file/d/1azIYjzLFCY7qp7-NjgSBvakbGgPvQlRf/view
3 |
4 | Step 2: Run the gen_dataset.py to read cell images and generate the CSV file for training and test data
5 |
--------------------------------------------------------------------------------
/Malaria Detection/gen_dataset_completed.py:
--------------------------------------------------------------------------------
1 | import cv2,os
2 | import numpy as np
3 | import csv
4 | import glob
5 |
6 | label = "Parasitized"
7 | dirList = glob.glob("cell_images/"+label+"/*.png")
8 | file = open("csv/dataset.csv","a")
9 |
10 | for img_path in dirList:
11 |
12 | im = cv2.imread(img_path)
13 |
14 | im = cv2.GaussianBlur(im,(5,5),2)
15 |
16 |
17 |
18 | im_gray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)
19 |
20 | ret,thresh = cv2.threshold(im_gray,127,255,0)
21 | contours,_ = cv2.findContours(thresh,1,2)
22 |
23 | for contour in contours:
24 | cv2.drawContours(im_gray, contours, -1, (0,255,0), 3)
25 |
26 |
27 | cv2.imshow("window",im_gray)
28 |
29 | break
30 |
31 |
32 | file.write(label)
33 | file.write(",")
34 |
35 | for i in range(5):
36 | try:
37 | area = cv2.contourArea(contours[i])
38 | file.write(str(area))
39 | except:
40 | file.write("0")
41 |
42 | file.write(",")
43 |
44 |
45 | file.write("\n")
46 |
47 |
48 | cv2.waitKey(19000)
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/Malaria Detection/malaria_classification_completed.py:
--------------------------------------------------------------------------------
1 | import pandas as pd
2 | from sklearn.model_selection import train_test_split
3 | from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier
4 | from sklearn import metrics
5 | import joblib
6 |
7 | ##Step1: Load Dataset
8 |
9 | dataframe = pd.read_csv("csv/dataset.csv")
10 | #print(dataframe.head())
11 |
12 | #Step2: Split into training and test data
13 | x = dataframe.drop(["Label"],axis=1)
14 | y = dataframe["Label"]
15 | x_train, x_test, y_train, y_test = train_test_split(x,y,test_size=0.2,random_state=42)
16 |
17 | ##Step4: Build a model
18 |
19 | model = RandomForestClassifier(n_estimators=100,max_depth=5)
20 | model.fit(x_train,y_train)
21 | joblib.dump(model,"rf_malaria_100_5")
22 |
23 |
24 | ##Step5: Make predictions and get classification report
25 |
26 | predictions = model.predict(x_test)
27 |
28 | print(metrics.classification_report(predictions,y_test))
29 | print(model.score(x_test,y_test))
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Naive Bayes/Supervised-Machine-Learning.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Naive Bayes/Supervised-Machine-Learning.pdf
--------------------------------------------------------------------------------
/Naive Bayes/Supervised-MachineLearning-Part_2.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Naive Bayes/Supervised-MachineLearning-Part_2.pdf
--------------------------------------------------------------------------------
/Naive Bayes/home_work_dataset_ham_spam.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Naive Bayes/home_work_dataset_ham_spam.csv
--------------------------------------------------------------------------------
/Naive Bayes/naive-bayes.py:
--------------------------------------------------------------------------------
1 | import pandas as pd
2 | import matplotlib.pyplot as plt
3 | from sklearn.naive_bayes import GaussianNB
4 | import numpy as np
5 | from sklearn.metrics import mean_squared_error
6 |
7 | '''
8 | We can use Scikit learn to build a simple linear regression model
9 | you can use it use it like
10 | model = GaussianNB()
11 |
12 | '''
13 |
14 |
15 | #### Your Code Goes Here ####
16 |
17 | ## Step 1: Load Data from CSV File ####
18 |
19 |
20 | ## Step 2: Plot the Data ####
21 |
22 |
23 | ## Step 3: Build a NB Model ####
24 |
25 |
26 | ## Step 4: Print Predicted vs Actuals ####
27 |
28 |
29 | ## Step 5: Estimate Error ####
--------------------------------------------------------------------------------
/PCA/Iris.csv:
--------------------------------------------------------------------------------
1 | Id,SepalLengthCm,SepalWidthCm,PetalLengthCm,PetalWidthCm,Species
2 | 1,5.1,3.5,1.4,0.2,Iris-setosa
3 | 2,4.9,3.0,1.4,0.2,Iris-setosa
4 | 3,4.7,3.2,1.3,0.2,Iris-setosa
5 | 4,4.6,3.1,1.5,0.2,Iris-setosa
6 | 5,5.0,3.6,1.4,0.2,Iris-setosa
7 | 6,5.4,3.9,1.7,0.4,Iris-setosa
8 | 7,4.6,3.4,1.4,0.3,Iris-setosa
9 | 8,5.0,3.4,1.5,0.2,Iris-setosa
10 | 9,4.4,2.9,1.4,0.2,Iris-setosa
11 | 10,4.9,3.1,1.5,0.1,Iris-setosa
12 | 11,5.4,3.7,1.5,0.2,Iris-setosa
13 | 12,4.8,3.4,1.6,0.2,Iris-setosa
14 | 13,4.8,3.0,1.4,0.1,Iris-setosa
15 | 14,4.3,3.0,1.1,0.1,Iris-setosa
16 | 15,5.8,4.0,1.2,0.2,Iris-setosa
17 | 16,5.7,4.4,1.5,0.4,Iris-setosa
18 | 17,5.4,3.9,1.3,0.4,Iris-setosa
19 | 18,5.1,3.5,1.4,0.3,Iris-setosa
20 | 19,5.7,3.8,1.7,0.3,Iris-setosa
21 | 20,5.1,3.8,1.5,0.3,Iris-setosa
22 | 21,5.4,3.4,1.7,0.2,Iris-setosa
23 | 22,5.1,3.7,1.5,0.4,Iris-setosa
24 | 23,4.6,3.6,1.0,0.2,Iris-setosa
25 | 24,5.1,3.3,1.7,0.5,Iris-setosa
26 | 25,4.8,3.4,1.9,0.2,Iris-setosa
27 | 26,5.0,3.0,1.6,0.2,Iris-setosa
28 | 27,5.0,3.4,1.6,0.4,Iris-setosa
29 | 28,5.2,3.5,1.5,0.2,Iris-setosa
30 | 29,5.2,3.4,1.4,0.2,Iris-setosa
31 | 30,4.7,3.2,1.6,0.2,Iris-setosa
32 | 31,4.8,3.1,1.6,0.2,Iris-setosa
33 | 32,5.4,3.4,1.5,0.4,Iris-setosa
34 | 33,5.2,4.1,1.5,0.1,Iris-setosa
35 | 34,5.5,4.2,1.4,0.2,Iris-setosa
36 | 35,4.9,3.1,1.5,0.1,Iris-setosa
37 | 36,5.0,3.2,1.2,0.2,Iris-setosa
38 | 37,5.5,3.5,1.3,0.2,Iris-setosa
39 | 38,4.9,3.1,1.5,0.1,Iris-setosa
40 | 39,4.4,3.0,1.3,0.2,Iris-setosa
41 | 40,5.1,3.4,1.5,0.2,Iris-setosa
42 | 41,5.0,3.5,1.3,0.3,Iris-setosa
43 | 42,4.5,2.3,1.3,0.3,Iris-setosa
44 | 43,4.4,3.2,1.3,0.2,Iris-setosa
45 | 44,5.0,3.5,1.6,0.6,Iris-setosa
46 | 45,5.1,3.8,1.9,0.4,Iris-setosa
47 | 46,4.8,3.0,1.4,0.3,Iris-setosa
48 | 47,5.1,3.8,1.6,0.2,Iris-setosa
49 | 48,4.6,3.2,1.4,0.2,Iris-setosa
50 | 49,5.3,3.7,1.5,0.2,Iris-setosa
51 | 50,5.0,3.3,1.4,0.2,Iris-setosa
52 | 51,7.0,3.2,4.7,1.4,Iris-versicolor
53 | 52,6.4,3.2,4.5,1.5,Iris-versicolor
54 | 53,6.9,3.1,4.9,1.5,Iris-versicolor
55 | 54,5.5,2.3,4.0,1.3,Iris-versicolor
56 | 55,6.5,2.8,4.6,1.5,Iris-versicolor
57 | 56,5.7,2.8,4.5,1.3,Iris-versicolor
58 | 57,6.3,3.3,4.7,1.6,Iris-versicolor
59 | 58,4.9,2.4,3.3,1.0,Iris-versicolor
60 | 59,6.6,2.9,4.6,1.3,Iris-versicolor
61 | 60,5.2,2.7,3.9,1.4,Iris-versicolor
62 | 61,5.0,2.0,3.5,1.0,Iris-versicolor
63 | 62,5.9,3.0,4.2,1.5,Iris-versicolor
64 | 63,6.0,2.2,4.0,1.0,Iris-versicolor
65 | 64,6.1,2.9,4.7,1.4,Iris-versicolor
66 | 65,5.6,2.9,3.6,1.3,Iris-versicolor
67 | 66,6.7,3.1,4.4,1.4,Iris-versicolor
68 | 67,5.6,3.0,4.5,1.5,Iris-versicolor
69 | 68,5.8,2.7,4.1,1.0,Iris-versicolor
70 | 69,6.2,2.2,4.5,1.5,Iris-versicolor
71 | 70,5.6,2.5,3.9,1.1,Iris-versicolor
72 | 71,5.9,3.2,4.8,1.8,Iris-versicolor
73 | 72,6.1,2.8,4.0,1.3,Iris-versicolor
74 | 73,6.3,2.5,4.9,1.5,Iris-versicolor
75 | 74,6.1,2.8,4.7,1.2,Iris-versicolor
76 | 75,6.4,2.9,4.3,1.3,Iris-versicolor
77 | 76,6.6,3.0,4.4,1.4,Iris-versicolor
78 | 77,6.8,2.8,4.8,1.4,Iris-versicolor
79 | 78,6.7,3.0,5.0,1.7,Iris-versicolor
80 | 79,6.0,2.9,4.5,1.5,Iris-versicolor
81 | 80,5.7,2.6,3.5,1.0,Iris-versicolor
82 | 81,5.5,2.4,3.8,1.1,Iris-versicolor
83 | 82,5.5,2.4,3.7,1.0,Iris-versicolor
84 | 83,5.8,2.7,3.9,1.2,Iris-versicolor
85 | 84,6.0,2.7,5.1,1.6,Iris-versicolor
86 | 85,5.4,3.0,4.5,1.5,Iris-versicolor
87 | 86,6.0,3.4,4.5,1.6,Iris-versicolor
88 | 87,6.7,3.1,4.7,1.5,Iris-versicolor
89 | 88,6.3,2.3,4.4,1.3,Iris-versicolor
90 | 89,5.6,3.0,4.1,1.3,Iris-versicolor
91 | 90,5.5,2.5,4.0,1.3,Iris-versicolor
92 | 91,5.5,2.6,4.4,1.2,Iris-versicolor
93 | 92,6.1,3.0,4.6,1.4,Iris-versicolor
94 | 93,5.8,2.6,4.0,1.2,Iris-versicolor
95 | 94,5.0,2.3,3.3,1.0,Iris-versicolor
96 | 95,5.6,2.7,4.2,1.3,Iris-versicolor
97 | 96,5.7,3.0,4.2,1.2,Iris-versicolor
98 | 97,5.7,2.9,4.2,1.3,Iris-versicolor
99 | 98,6.2,2.9,4.3,1.3,Iris-versicolor
100 | 99,5.1,2.5,3.0,1.1,Iris-versicolor
101 | 100,5.7,2.8,4.1,1.3,Iris-versicolor
102 | 101,6.3,3.3,6.0,2.5,Iris-virginica
103 | 102,5.8,2.7,5.1,1.9,Iris-virginica
104 | 103,7.1,3.0,5.9,2.1,Iris-virginica
105 | 104,6.3,2.9,5.6,1.8,Iris-virginica
106 | 105,6.5,3.0,5.8,2.2,Iris-virginica
107 | 106,7.6,3.0,6.6,2.1,Iris-virginica
108 | 107,4.9,2.5,4.5,1.7,Iris-virginica
109 | 108,7.3,2.9,6.3,1.8,Iris-virginica
110 | 109,6.7,2.5,5.8,1.8,Iris-virginica
111 | 110,7.2,3.6,6.1,2.5,Iris-virginica
112 | 111,6.5,3.2,5.1,2.0,Iris-virginica
113 | 112,6.4,2.7,5.3,1.9,Iris-virginica
114 | 113,6.8,3.0,5.5,2.1,Iris-virginica
115 | 114,5.7,2.5,5.0,2.0,Iris-virginica
116 | 115,5.8,2.8,5.1,2.4,Iris-virginica
117 | 116,6.4,3.2,5.3,2.3,Iris-virginica
118 | 117,6.5,3.0,5.5,1.8,Iris-virginica
119 | 118,7.7,3.8,6.7,2.2,Iris-virginica
120 | 119,7.7,2.6,6.9,2.3,Iris-virginica
121 | 120,6.0,2.2,5.0,1.5,Iris-virginica
122 | 121,6.9,3.2,5.7,2.3,Iris-virginica
123 | 122,5.6,2.8,4.9,2.0,Iris-virginica
124 | 123,7.7,2.8,6.7,2.0,Iris-virginica
125 | 124,6.3,2.7,4.9,1.8,Iris-virginica
126 | 125,6.7,3.3,5.7,2.1,Iris-virginica
127 | 126,7.2,3.2,6.0,1.8,Iris-virginica
128 | 127,6.2,2.8,4.8,1.8,Iris-virginica
129 | 128,6.1,3.0,4.9,1.8,Iris-virginica
130 | 129,6.4,2.8,5.6,2.1,Iris-virginica
131 | 130,7.2,3.0,5.8,1.6,Iris-virginica
132 | 131,7.4,2.8,6.1,1.9,Iris-virginica
133 | 132,7.9,3.8,6.4,2.0,Iris-virginica
134 | 133,6.4,2.8,5.6,2.2,Iris-virginica
135 | 134,6.3,2.8,5.1,1.5,Iris-virginica
136 | 135,6.1,2.6,5.6,1.4,Iris-virginica
137 | 136,7.7,3.0,6.1,2.3,Iris-virginica
138 | 137,6.3,3.4,5.6,2.4,Iris-virginica
139 | 138,6.4,3.1,5.5,1.8,Iris-virginica
140 | 139,6.0,3.0,4.8,1.8,Iris-virginica
141 | 140,6.9,3.1,5.4,2.1,Iris-virginica
142 | 141,6.7,3.1,5.6,2.4,Iris-virginica
143 | 142,6.9,3.1,5.1,2.3,Iris-virginica
144 | 143,5.8,2.7,5.1,1.9,Iris-virginica
145 | 144,6.8,3.2,5.9,2.3,Iris-virginica
146 | 145,6.7,3.3,5.7,2.5,Iris-virginica
147 | 146,6.7,3.0,5.2,2.3,Iris-virginica
148 | 147,6.3,2.5,5.0,1.9,Iris-virginica
149 | 148,6.5,3.0,5.2,2.0,Iris-virginica
150 | 149,6.2,3.4,5.4,2.3,Iris-virginica
151 | 150,5.9,3.0,5.1,1.8,Iris-virginica
152 |
--------------------------------------------------------------------------------
/PCA/README.md:
--------------------------------------------------------------------------------
1 | # Principle Component Analysis (PCA)
2 |
3 |
4 |
5 |
6 |
7 | ### Instructions
8 |
9 | This folder contains resources of Introduction to Principle Component Analysis (PCA) lesson.
10 |
11 | The recorded video for this lesson can be found here: https://www.youtube.com/watch?v=0SiRTlFcZRQ
12 |
13 | Dataset associated with this tutorial can be found in [`Iris.csv`](https://github.com/codeheroku/Introduction-to-Machine-Learning/blob/master/PCA/Iris.csv) file.
14 |
15 | Starter code can be found in [`pca.py`](https://github.com/codeheroku/Introduction-to-Machine-Learning/blob/master/PCA/pca.py) file.
16 |
17 | The fully completed code can be found in [`pca_completed.py`](https://github.com/codeheroku/Introduction-to-Machine-Learning/blob/master/PCA/pca_completed.py) file.
18 |
19 |
20 | > Check out our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) Course at [Code Heroku](http://www.codeheroku.com/) for a complete guide to Machine Learning.
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/PCA/pca.py:
--------------------------------------------------------------------------------
1 | from sklearn.decomposition import PCA
2 | import pandas as pd
3 | from sklearn.preprocessing import StandardScaler
4 | import matplotlib.pyplot as plt
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/PCA/pca_completed.py:
--------------------------------------------------------------------------------
1 | from sklearn.decomposition import PCA
2 | import pandas as pd
3 | from sklearn.preprocessing import StandardScaler
4 | import matplotlib.pyplot as plt
5 |
6 |
7 | df = pd.read_csv("Iris.csv")
8 | labels = df['Species']
9 | X = df.drop(['Id','Species'],axis=1)
10 |
11 | X_std = StandardScaler().fit_transform(X)
12 |
13 |
14 |
15 |
16 | pca = PCA(n_components=4)
17 | X_transform = pca.fit_transform(X_std)
18 |
19 | explained_var = pca.explained_variance_ratio_
20 | for var in explained_var:
21 | print var
22 | plt.bar([1,2,3,4],explained_var,label=var)
23 | plt.xlabel("Component #")
24 | plt.ylabel("% Variance Contribution")
25 | plt.legend()
26 | plt.show()
27 |
28 | # pca1 = zip(*X_transform)[0]
29 | # pca2 = zip(*X_transform)[1]
30 |
31 | # color_dict = {}
32 |
33 | # color_dict["Iris-setosa"] = "green"
34 | # color_dict["Iris-versicolor"]='red'
35 | # color_dict["Iris-virginica"] = 'blue'
36 |
37 | # i=0
38 | # for label in labels.values:
39 |
40 | # plt.scatter(pca1[i],pca2[i],color=color_dict[label])
41 | # i=i+1
42 |
43 | # plt.show()
44 |
45 |
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Introduction to Machine Learning
2 |
3 | > This repository contains material related to [Introduction to Machine Learning](http://codeheroku.com/course?course_id=1) Course by [Code Heroku](http://codeheroku.com).
4 |
5 |
6 | ## Course Objectives
7 |
8 | - Introduce you to fundamentals of Machine Learning
9 | - Serve as a launch pad for your career in Machine Learning and Data science
10 |
11 | ## Who is the target audience?
12 | - This course is for beginners with a none to a small amount of Machine Learning experience.
13 |
14 | # Tutorials
15 | The tutorials lead you through implementing various algorithms in machine learning. All of the code is written in Python.
16 |
17 | #### Introduction and getting started
18 |
19 | - ##### [Introduction to machine learning](http://www.codeheroku.com/course_content?lesson_id=0&course_id=1§ion_id=0)
20 |
21 | > A brief introduction on the fundamentals of machine learning.
22 |
23 | - ##### [Setup Python](http://www.codeheroku.com/course_content?lesson_id=1&course_id=1§ion_id=0)
24 |
25 | > A guide for installing Python on your system.
26 |
27 | - ##### [Scikit-Learn and other libraries installation](http://www.codeheroku.com/course_content?lesson_id=2&course_id=1§ion_id=0)
28 |
29 | > A guide for installing Scikit-Learn and other libraries required for this course.
30 |
31 | - ##### [Python Numpy Tutorial](http://www.codeheroku.com/course_content?lesson_id=3&course_id=1§ion_id=0)
32 |
33 | > A brief walkthrough on Python, Numpy, Scipy and Matplotlib
34 |
35 |
36 | #### Supervised Machine Learning
37 |
38 | - ##### [Linear Regression using Scikit-Learn](http://www.codeheroku.com/course_content?lesson_id=0&course_id=1§ion_id=1)
39 |
40 | > Implement linear regression to predict score of a student based on the number of hours he studies.
41 |
42 | - ##### [Naive Bayes using Scikit Learn](http://www.codeheroku.com/course_content?lesson_id=1&course_id=1§ion_id=1)
43 |
44 | > Implement Naive Bayes algorithm to solve classification problems using Scikit Learn.
45 |
46 | - ##### [Building a Movie Recommendation Engine](https://github.com/codeheroku/Introduction-to-Machine-Learning/tree/master/Building%20a%20Movie%20Recommendation%20Engine)
47 |
48 | > Build a Movie Recommendation Engine in Python using Scikit Learn.
49 |
50 | - ##### [Understanding Gradient Descent Optimization](https://github.com/codeheroku/Introduction-to-Machine-Learning/tree/master/gradient%20descent)
51 |
52 | > Learn how to use Gradient Descent optimization for solving Machine Learning problems.
53 |
54 | #### Unsupervised Learning
55 |
56 | - ##### [Building a Digit Recognizer using SVM](https://github.com/codeheroku/Introduction-to-Machine-Learning/tree/master/Building%20a%20Digit%20Recognizer)
57 |
58 | > Learn how to use Support Vector Machine (SVM) classifier for building a digit recognition system.
59 |
60 | - ##### [Introduction to Unsupervised Learning using K-means](https://github.com/codeheroku/Introduction-to-Machine-Learning/tree/master/K%20Means)
61 |
62 | > Learn how to use K-Means clustering algorithm for Machine Learning problems.
63 |
64 | - ##### [Principal Component Analysis (PCA)](https://github.com/codeheroku/Introduction-to-Machine-Learning/tree/master/PCA)
65 |
66 | > Learn how to perform PCA for achieving dimensionality reduction.
67 |
68 | - ##### [Face Recognition using PCA](https://github.com/codeheroku/Introduction-to-Machine-Learning/tree/master/Face%20Recognition%20Using%20PCA)
69 |
70 | > Learn how to implement a Face Recognition System in Python using PCA.
71 |
72 | #### Reinforcement Learning
73 |
74 | - ##### [Inroduction to Reinforcement Learning](https://github.com/codeheroku/Introduction-to-Machine-Learning/tree/master/Reinforcement%20Learning/RL1%20Multiarm%20Bandit)
75 |
76 | > An introduction on how to implement Reinforcement Learning algorithms and solve the Multi Arm Bandit problem using it.
77 |
78 | - ##### [Reinforcement Learning with OpenAI Gym](https://github.com/codeheroku/Introduction-to-Machine-Learning/tree/master/Reinforcement%20Learning/RL2%20Value%20Iteration)
79 |
80 | > Learn how to use OpenAI Gym in order to solve Reinforcement Learning problems.
81 |
82 | - ##### [Build an Intelligent Agent with Q-Learning](https://github.com/codeheroku/Introduction-to-Machine-Learning/tree/master/Reinforcement%20Learning/RL3%20QLearning)
83 |
84 | > Learn how to use Q-Learning in order to build an intelligent agent.
85 |
86 | # Course Projects
87 |
88 | The following projects are included as a part of this course.
89 |
90 | - ##### [Ham or Spam Email Classification](#)
91 | > Build a spam classifier system.
92 |
93 | - ##### [Student Exam Score Prediction](#)
94 | > Predict the score obtained by a student in the examination based on how many hours he has studied.
95 |
96 | - ##### [Movie Recommendation Engine](https://github.com/codeheroku/Introduction-to-Machine-Learning/tree/master/Building%20a%20Movie%20Recommendation%20Engine)
97 | > Build a movie recommendation system using Scikit Learn.
98 |
99 | - ##### [Cartpole Balancing with Q-learning](#)
100 | > Build a system to balance a cartpole using Q-Learning.
101 |
102 | - ##### [Object Recognition with Neural Networks](#)
103 | > Build a system to recognize objects using Neural Networks.
104 |
105 | - ##### [Mouse Cat Maze with Reinforcement Learning](#)
106 | > Use Reinforcement Learning to solve Mouse Cat Maze.
107 |
108 | # Want to learn more?
109 |
110 | Come learn with us in the [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1 "Introduction to Machine Learning") course at [Code Heroku](http://www.codeheroku.com/) !
111 |
112 | Subscribe to our YouTube channel: [Code Heroku - YouTube](https://www.youtube.com/channel/UCL-_0RrZ3084Ea8Yavtcd9g "Code Heroku - YouTube")
113 |
114 | Visit our Facebook page: [Code Heroku - Facebook](https://www.facebook.com/codeheroku "Code Heroku - Facebook")
115 |
116 | Visit our blog on Medium: [Code Heroku - Medium](https://medium.com/code-heroku "Code Heroku - Medium")
117 |
118 |
119 |
120 |
121 |
--------------------------------------------------------------------------------
/Reinforcement Learning/README.md:
--------------------------------------------------------------------------------
1 | # Reinforcement Learning
2 |
3 |
4 |
5 |
6 |
7 | ### Instructions
8 |
9 | This folder contains resources of Reinforcement Learning section.
10 |
11 | Lesson 1: [`Multiarm Bandit`](https://github.com/codeheroku/Introduction-to-Machine-Learning/tree/master/Reinforcement%20Learning/RL1%20Multiarm%20Bandit)
12 |
13 | Lesson 2: [`Value Iteration`](https://github.com/codeheroku/Introduction-to-Machine-Learning/tree/master/Reinforcement%20Learning/RL2%20Value%20Iteration)
14 |
15 | Lesson 3: [`Q Learning`](https://github.com/codeheroku/Introduction-to-Machine-Learning/tree/master/Reinforcement%20Learning/RL3%20QLearning)
16 |
17 |
18 |
19 | > Check out our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) Course at [Code Heroku](http://www.codeheroku.com/) for a complete guide to Machine Learning.
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Reinforcement Learning/RL1 Multiarm Bandit/README.md:
--------------------------------------------------------------------------------
1 | # Introduction to Reinforcement Learning - Multi Arm Bandit
2 |
3 |
4 |
5 |
6 |
7 | ### Instructions
8 |
9 | Part 1: Open [`Reinforcement_Learning_Part_1.ipynb`](https://github.com/codeheroku/Introduction-to-Machine-Learning/blob/master/Reinforcement%20Learning/RL1%20Multiarm%20Bandit/Reinforcement_Learning_Part_1.ipynb) to see the Part 1 of Introduction to Reinforcement Learning tutorial.
10 |
11 |
12 | > Check out our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) Course at [Code Heroku](http://www.codeheroku.com/) for a complete guide to Machine Learning.
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Reinforcement Learning/RL1 Multiarm Bandit/Reinforcement_Learning_Part_1.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "
\n",
8 | "\n",
9 | ">This notebook is part of our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) course at [Code Heroku](http://www.codeheroku.com/).\n",
10 | "\n",
11 | "Till now in our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) course, we have seen that a supervised machine learning algorithm takes in Features of a dataset (e.g., number of hours a student studies) and Labels (e.g., their score on an exam) as inputs and estimates a Function (model) which minimizes the difference between the expected and predicted results.\n",
12 | "\n",
13 | "
\n",
14 | "\n",
15 | "Now think about how a kid learns to ride a bicycle. No one gives him/her datasets to analyze. They learn by trying different things and then observing the effects of their actions. If the kind of actions they perform lead to balancing the bike they get to enjoy the ride or else they end-up falling and hurting themself. Similarly, can we also teach computers to learn from their mistakes? And the answer lies with Reinforcement Learning.\n",
16 | "\n",
17 | "
\n",
18 | "\n",
19 | "> Reinforcement learning is the closest one could get to the natural form of learning. It is a paradigm of Machine Learning and Artificial Intelligence which deals with making a set of sequential decisions under uncertainty.\n",
20 | "\n",
21 | "## What is Reinforcement Learning?\n",
22 | "\n",
23 | "Let’s say we are given a robot inside a room and our goal is to reach to the green block which gives us +1 point. There is also a red block and if we end up there we get -1 point. After reaching to both of these blocks(states) our simulation comes to an end. There is one challenge, because the way mechanics of this world and robot are setup whenever the robot tries to move forward, in only 80% of the cases it actually moves forward. In the other 10% of cases, it goes either goes to the right and in remaining 10% it tries to go the left but since there is no place to go it will stay at the same spot.\n",
24 | "\n",
25 | "
\n",
26 | "\n",
27 | "In real world where all our actions do not always end up with intended consequences (i.e. the world is stochastic) conventional planning algorithms are useless. Given this challenge, what is the best sequence of actions that we can take so as to ultimately reach to our goal?\n",
28 | "\n",
29 | "Reinforcement Learning tries to find answer to this question.\n",
30 | "\n",
31 | "The goal of any reinforcement learning algorithm is to find a set of actions that will result in maximum rewards (now or in near future).\n",
32 | "\n",
33 | "And what’s the solution? Well, the only hope in this case to take an action and then observe its effects i.e. We not only need data from our sensors but also access to the physical/simulated environment. Also note that in most blocks (states) in this room except for the terminating states we do not get any feedback(reward) from the environment.\n",
34 | "\n",
35 | "## Reinforcement Learning Problem Formulation\n",
36 | "\n",
37 | "
\n",
38 | "\n",
39 | "### Let’s Make sure you understand some RL Lingo\n",
40 | "\n",
41 | "**States** is your current observation of the world. In the previous example, the positions/blocks in the room were the states of our environment.\n",
42 | "\n",
43 | "**Actions** are the set of actions your RL agent can perform in the environment. In the previous example, the actions that our robot could perform were moving Up, Down, Left and Right.\n",
44 | "\n",
45 | "**Rewards** are the feedback that you might get from the environment. In the previous example our robot gets a reward of +1 for being in the green block and -1 for being the red block.\n",
46 | "\n",
47 | "Let’s see if you get it.\n",
48 | "\n",
49 | "
\n",
50 | "\n",
51 | "What do you think? What are the states, actions and rewards for the RL problem of playing the game of Pac-Man.\n",
52 | "\n",
53 | "**States:** What could be an efficient way to represent a state in this game? We can ask ourselves what does the agent (Pac-Man) need to know in order to make a good move? It needs to know its own position, positions of all the ghosts and position of all the food. Right? So, a good representation of the state might be a tuple containing values of\n",
54 | "\n",
55 | "{agent_loc:33; ghost_locations:[12,22,32], food_locations: [10,20,30]}\n",
56 | "\n",
57 | "**Actions:** Our agent can move only in four directions in this 2D grid so our actions are {Up,Down,Left,Right}\n",
58 | "\n",
59 | "**Rewards:** Our end goal is to obtain maximum possible score in the game. So, after performing an action, the increase in score can be a good reward signal for our agent. Or, if your intention is to survive in the game as long as possible, time spent in the game can be a good reward signal for the agent.\n",
60 | "\n",
61 | "### Markov Decision Process (MDP):\n",
62 | "\n",
63 | "To formalize the Reinforcement Learning problem at hand we use Markov Decision Process (MDP). MDPs give us a good way to create a mathematical model of the RL problem and adhere to the Markovian property that the results of our actions only depends on the present state and everything that has happened before this is irrelevant. This might seem a bit limiting at first since intuitively we know that our set of actions/states are correlated and not independent of each other. But as always, we will work our way around this assumption.\n",
64 | "\n",
65 | "
\n",
66 | "\n",
67 | "`S` denotes all the states.\n",
68 | "\n",
69 | "`A` denotes all the actions.\n",
70 | "\n",
71 | "`P(s’|s,a)` denotes the transition probabilities. It indicates the probability of reaching state s’ from state s given that you take the action a.\n",
72 | "\n",
73 | "`P(r|s,a)` denotes the reward probabilities. It indicates the chance of getting reward R given that you take an action a on state s.\n",
74 | "\n",
75 | "`s_0` denotes the initial state of the world.\n",
76 | "\n",
77 | "> The goal of any reinforcement learning algorithm is to come up with a policy which maps all the states to actions.\n",
78 | "\n",
79 | "
\n",
80 | "\n",
81 | "There could be many possible policies. But, we need to select an optimal policy which will give us the maximum value.\n",
82 | "\n",
83 | "
\n",
84 | "\n",
85 | "Now the question is, “How do we get this maximum value?”\n",
86 | "\n",
87 | "Well, we know that we want to get maximum rewards using a policy. Right?\n",
88 | "\n",
89 | "So, if we sum all our rewards from t = 0 to infinity for a given policy, we should get the value of that policy. And because these rewards are stochastic, we always don’t get these rewards. So, the value of policy is actually the expectation over the sum of rewards.\n",
90 | "\n",
91 | "
\n",
92 | "\n",
93 | "But wait, the sum of all the rewards from t = 0 to infinity will not be bounded. We will run out of memory if we try to compute this value. So let’s introduce a new factor, gamma (Ɣ) into our equation. This gamma (Ɣ) is called as the discount factor, which will between 0 to 1.\n",
94 | "\n",
95 | "
\n",
96 | "\n",
97 | "Gamma (Ɣ) indicates the importance of a reward in our equation. Initially, the value of gamma (Ɣ) is set to 1. And then, the value of gamma (Ɣ) gradually decreases with each iteration. This is a way of saying that our future rewards are less valuable than our current reward. So if someone gives you a \\\\$100 check right now versus \\\\$100 one year latter, the one that you get right now is more valuable, right?\n",
98 | "\n",
99 | "As the value of gamma (Ɣ)decreases in each step, the sum of discounted rewards will eventually converge (remember geometric series?).\n",
100 | "\n",
101 | "Thus we have formalized the problem at hand and we will see latter posts how we go about solving this.\n",
102 | "\n",
103 | ">If this article was helpful to you, check out our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) Course at [Code Heroku](http://www.codeheroku.com/) for a complete guide to Machine Learning.\n",
104 | "\n",
105 | "
\n",
106 | "\n",
107 | "
\n",
108 | "
\n",
109 | "\n",
110 | "
"
111 | ]
112 | }
113 | ],
114 | "metadata": {
115 | "kernelspec": {
116 | "display_name": "Python 3",
117 | "language": "python",
118 | "name": "python3"
119 | },
120 | "language_info": {
121 | "codemirror_mode": {
122 | "name": "ipython",
123 | "version": 3
124 | },
125 | "file_extension": ".py",
126 | "mimetype": "text/x-python",
127 | "name": "python",
128 | "nbconvert_exporter": "python",
129 | "pygments_lexer": "ipython3",
130 | "version": "3.6.7"
131 | }
132 | },
133 | "nbformat": 4,
134 | "nbformat_minor": 2
135 | }
136 |
--------------------------------------------------------------------------------
/Reinforcement Learning/RL1 Multiarm Bandit/agents.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import random
3 | random.seed(0)
4 | np.random.seed(0)
5 |
6 | class RandomAgent():
7 | def __init__(self,action_space):
8 | self.action_space = action_space
9 |
10 | # Choose a random action
11 | def choose_action(self):
12 | ##Todo >> Return a random choice of the available actions
13 |
14 |
15 | class ValueApproxAgent():
16 | def __init__(self,action_space,epsilon=0.05):
17 | self.action_space = action_space
18 | self.epsilon = epsilon
19 | self.approx_values = [0.0] * len(action_space)
20 | self.observation_counts = [0] * len(action_space)
21 |
22 |
23 | def choose_action(self):
24 | ##Todo: Returns a random choice of the available actions
25 |
26 |
27 |
28 | def learn(self,action,reward):
29 | ##Todo: Learn from action and reward to update self.approx_values
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Reinforcement Learning/RL1 Multiarm Bandit/agents.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Reinforcement Learning/RL1 Multiarm Bandit/agents.pyc
--------------------------------------------------------------------------------
/Reinforcement Learning/RL1 Multiarm Bandit/completed/agents.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import random
3 | random.seed(0)
4 | np.random.seed(0)
5 |
6 | class RandomAgent():
7 | def __init__(self,action_space):
8 | self.action_space = action_space
9 |
10 | # Choose a random action
11 | def choose_action(self):
12 | """Returns a random choice of the available actions"""
13 | return np.random.choice(self.action_space)
14 |
15 | class ValueApproxAgent():
16 | def __init__(self,action_space,epsilon=0.05):
17 | self.action_space = action_space
18 | self.epsilon = epsilon
19 | self.approx_values = [0.0] * len(action_space)
20 | self.observation_counts = [0] * len(action_space)
21 |
22 |
23 | def choose_action(self):
24 | """Returns a random choice of the available actions"""
25 | if np.random.uniform(0,1) < self.epsilon:
26 | #print "Making a random choice..."
27 | return np.random.choice(self.action_space)
28 | else:
29 | return np.argmax(self.approx_values)
30 |
31 |
32 | def learn(self,action,reward):
33 | self.observation_counts[action]+=1
34 | current_val = self.approx_values[action]
35 | step_size = 1.0 / (self.observation_counts[action])
36 | self.approx_values[action] = current_val + step_size * (reward - current_val)
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/Reinforcement Learning/RL1 Multiarm Bandit/completed/agents.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Reinforcement Learning/RL1 Multiarm Bandit/completed/agents.pyc
--------------------------------------------------------------------------------
/Reinforcement Learning/RL1 Multiarm Bandit/completed/environment.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import random
3 | random.seed(0)
4 | np.random.seed(0)
5 |
6 | class Environment:
7 | def __init__(self, num_arms=10):
8 | self.num_arms = num_arms
9 |
10 | # for each arm, save a random probability for success
11 | self._probs = [random.random() for _ in range(self.num_arms)]
12 | self.action_space = range(num_arms)
13 |
14 |
15 | def try_arm(self, arm_num):
16 |
17 | # either succed or fail randomly based on the arm's probability
18 | got_reward = random.random() < self._probs[int(arm_num)]
19 |
20 | return 1.0 if got_reward else 0.0
--------------------------------------------------------------------------------
/Reinforcement Learning/RL1 Multiarm Bandit/completed/environment.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Reinforcement Learning/RL1 Multiarm Bandit/completed/environment.pyc
--------------------------------------------------------------------------------
/Reinforcement Learning/RL1 Multiarm Bandit/completed/play.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import random
3 | from environment import Environment
4 | from agents import RandomAgent
5 | from agents import ValueApproxAgent
6 | import matplotlib.pyplot as plt
7 | # initialize
8 | env = Environment(20)
9 | agent = RandomAgent(env.action_space)
10 |
11 |
12 | total_reward = 0
13 | for i in range(1000):
14 | action = agent.choose_action()
15 | total_reward += env.try_arm(action)
16 |
17 | print('total reward from RandomAgent:', total_reward)
18 |
19 |
20 |
21 | all_rewards = []
22 |
23 |
24 |
25 | agent = ValueApproxAgent(env.action_space,epsilon=0.07)
26 | total_reward = 0
27 | for i in range(1000):
28 | action = agent.choose_action()
29 | reward = env.try_arm(action)
30 | agent.learn(action,reward)
31 | total_reward += reward
32 |
33 |
34 |
35 | print 'total reward from ValueApproxAgent:', total_reward
36 | print agent.approx_values, env._probs
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Reinforcement Learning/RL1 Multiarm Bandit/environment.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import random
3 | random.seed(0)
4 | np.random.seed(0)
5 |
6 | class Environment:
7 | def __init__(self, num_arms=10):
8 | self.num_arms = num_arms
9 |
10 | # for each arm, save a random probability for success
11 | self._probs = [random.random() for _ in range(self.num_arms)]
12 | self.action_space = range(num_arms)
13 |
14 |
15 | def try_arm(self, arm_num):
16 |
17 | # either succed or fail randomly based on the arm's probability
18 | got_reward = random.random() < self._probs[int(arm_num)]
19 |
20 | return 1.0 if got_reward else 0.0
--------------------------------------------------------------------------------
/Reinforcement Learning/RL1 Multiarm Bandit/environment.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Reinforcement Learning/RL1 Multiarm Bandit/environment.pyc
--------------------------------------------------------------------------------
/Reinforcement Learning/RL1 Multiarm Bandit/play.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import random
3 | from environment import Environment
4 | from agents import RandomAgent
5 | from agents import ValueApproxAgent
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Reinforcement Learning/RL2 Value Iteration/README.md:
--------------------------------------------------------------------------------
1 | # Reinforcement Learning with OpenAI Gym - Value Iteration (Frozen Lake Problem)
2 |
3 |
4 |
5 |
6 |
7 | ### Instructions
8 |
9 | This folder contains resources of Reinforcement Learning with OpenAI Gym - Value Iteration lesson.
10 |
11 | The recorded video for this lesson can be found here: https://www.youtube.com/watch?v=3begG_s9lzg
12 |
13 |
14 |
15 | > Check out our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) Course at [Code Heroku](http://www.codeheroku.com/) for a complete guide to Machine Learning.
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Reinforcement Learning/RL2 Value Iteration/agents.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 |
3 | class RandomAgent():
4 | def __init__(self,action_space):
5 | self.action_space = action_space
6 |
7 | def choose_action(self,observation):
8 | ##Todo: Return a random choice of the available actions
9 | return ""
10 |
11 |
12 | class ValueIterAgent():
13 | def __init__(self,env,gamma):
14 | self.max_iterations = 1000
15 | self.gamma = gamma
16 | self.num_states = env.observation_space.n
17 | self.num_actions = env.action_space.n
18 | self.state_prob = env.env.P
19 |
20 | self.values = np.zeros(env.observation_space.n)
21 | self.policy = np.zeros(env.observation_space.n)
22 |
23 | ##Helper Function
24 | def extract_policy(self):
25 |
26 | for s in range(self.num_states):
27 | q_sa = np.zeros(self.num_actions)
28 | for a in range(self.num_actions):
29 | for next_sr in self.state_prob[s][a]:
30 | # next_sr is a tuple of (probability, next state, reward, done)
31 | p, s_, r, _ = next_sr
32 | q_sa[a] += (p * (r + self.gamma * self.values[s_]))
33 | self.policy[s] = np.argmax(q_sa)
34 |
35 |
36 | def choose_action(self,observation):
37 | ##Todo: Return action based on calculated policy
38 | return ""
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/Reinforcement Learning/RL2 Value Iteration/agents.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Reinforcement Learning/RL2 Value Iteration/agents.pyc
--------------------------------------------------------------------------------
/Reinforcement Learning/RL2 Value Iteration/completed/agents.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 |
3 | class RandomAgent():
4 | def __init__(self,action_space):
5 | self.action_space = action_space
6 |
7 | def choose_action(self,observation):
8 | ##Todo: Returns a random choice of the available actions
9 | return self.action_space.sample()
10 |
11 |
12 | class ValueIterAgent():
13 | def __init__(self,env,gamma):
14 | self.max_iterations = 1000
15 | self.gamma = gamma
16 | self.num_states=env.observation_space.n
17 | self.num_actions=env.action_space.n
18 | self.state_prob = env.env.P
19 |
20 | self.values = np.zeros(env.observation_space.n)
21 | self.policy = np.zeros(env.observation_space.n)
22 |
23 | def value_iteration(self):
24 | for i in range(self.max_iterations):
25 | prev_v = np.copy(self.values)
26 | for state in range(self.num_states):
27 | Q_value = []
28 | for action in range(self.num_actions):
29 | next_states_rewards = []
30 | for trans_prob, next_state, reward_prob, _ in self.state_prob[state][action]:
31 |
32 | next_states_rewards.append((trans_prob * (reward_prob + self.gamma * prev_v[next_state])))
33 |
34 | Q_value.append(sum(next_states_rewards))
35 |
36 |
37 | self.values[state] = max(Q_value)
38 |
39 | return self.values
40 |
41 |
42 | def extract_policy(self):
43 |
44 | for s in range(self.num_states):
45 | q_sa = np.zeros(self.num_actions)
46 | for a in range(self.num_actions):
47 | for next_sr in self.state_prob[s][a]:
48 | # next_sr is a tuple of (probability, next state, reward, done)
49 | p, s_, r, _ = next_sr
50 | q_sa[a] += (p * (r + self.gamma * self.values[s_]))
51 | self.policy[s] = np.argmax(q_sa)
52 |
53 | def choose_action(self,observation):
54 |
55 | return self.policy[observation]
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/Reinforcement Learning/RL2 Value Iteration/completed/agents.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Reinforcement Learning/RL2 Value Iteration/completed/agents.pyc
--------------------------------------------------------------------------------
/Reinforcement Learning/RL2 Value Iteration/completed/play.py:
--------------------------------------------------------------------------------
1 | import gym
2 | from agents import RandomAgent
3 | from agents import ValueIterAgent
4 | import numpy as np
5 |
6 | env = gym.make('FrozenLake-v0')
7 |
8 |
9 | gamma = 1
10 | #agent = RandomAgent(env.action_space)
11 |
12 | agent = ValueIterAgent(env,gamma)
13 |
14 | agent.value_iteration();
15 | agent.extract_policy();
16 |
17 | print "Agent Policy: ", agent.policy
18 | all_rewards=[]
19 | for _ in range(1000):
20 | obs=env.reset()
21 | total_reward = 0
22 | while True:
23 | #env.render()
24 | action = agent.choose_action(obs)
25 | obs,reward,done,info = env.step(action)
26 | if done:
27 | all_rewards.append(reward)
28 | break
29 |
30 | print "Average Reward: ", np.mean(all_rewards)
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Reinforcement Learning/RL2 Value Iteration/play.py:
--------------------------------------------------------------------------------
1 | import gym
2 | from agents import RandomAgent
3 | from agents import ValueIterAgent
4 | import numpy as np
5 | env = gym.make('FrozenLake-v0')
6 | gamma = 1
7 |
8 | #Step1: Instantiate a Random/ValueIter Agent
9 |
10 | #Step2: For Value Iter Agent, Evaluate Policy
11 |
12 | #Step3: Play Frozen Lake 1000 times with this policy and measure rewards
13 |
14 | #Step4: Print Average Reward
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Reinforcement Learning/RL3 QLearning/Agents.py:
--------------------------------------------------------------------------------
1 | import random
2 | from collections import defaultdict
3 | import numpy as np
4 | class QAgent():
5 | def __init__(self,env,gamma):
6 |
7 | self.gamma = gamma
8 | self.env = env
9 | self.q_vals = defaultdict(lambda: np.array([0. for _ in range(env.action_space.n)]))
10 | self.alpha = 0.2
11 | self.eps = 0.5
12 |
13 | def choose_action(self,state):
14 | ##Todo: Epsilon Greed Action Selector
15 | return ""
16 |
17 |
18 | def learn(self,cur_state,action,reward,next_state):
19 | ##Todo: Learn From Your Experience
20 | return ""
21 |
22 |
--------------------------------------------------------------------------------
/Reinforcement Learning/RL3 QLearning/README.md:
--------------------------------------------------------------------------------
1 | # Q Learning - Building A Crawling Robot
2 |
3 |
4 |
5 |
6 |
7 | ### Instructions
8 |
9 | This folder contains resources of Q Learning - Building A Crawling Robot With Reinforcement Learning lesson.
10 |
11 | The recorded video for this lesson can be found here: https://www.youtube.com/watch?v=VDsugzVbnms
12 |
13 |
14 |
15 | > Check out our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) Course at [Code Heroku](http://www.codeheroku.com/) for a complete guide to Machine Learning.
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Reinforcement Learning/RL3 QLearning/completed/Agents.py:
--------------------------------------------------------------------------------
1 | import random
2 | from collections import defaultdict
3 | import numpy as np
4 | class QAgent():
5 | def __init__(self,env,gamma):
6 |
7 | self.gamma = 0.9
8 | self.env = env
9 | self.q_vals = defaultdict(lambda: np.array([0. for _ in range(env.action_space.n)]))
10 | self.alpha = 0.2
11 | self.eps = 0.5
12 |
13 | def choose_action(self,state):
14 | if random.random() < self.eps:
15 | # randomly select action from state
16 | action = np.random.choice(len(self.q_vals[state]))
17 | else:
18 | # greedily select action from state
19 | action = np.argmax(self.q_vals[state])
20 | return action
21 |
22 |
23 | def learn(self, cur_state,action,reward,next_state):
24 | maxqnew = np.max(self.q_vals[next_state])
25 | new_value = reward + self.gamma*maxqnew
26 |
27 | oldv = self.q_vals[cur_state][action]
28 | self.q_vals[cur_state][action] = oldv + self.alpha * (new_value - oldv)
29 |
30 |
--------------------------------------------------------------------------------
/Reinforcement Learning/RL3 QLearning/completed/Agents.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Reinforcement Learning/RL3 QLearning/completed/Agents.pyc
--------------------------------------------------------------------------------
/Reinforcement Learning/RL3 QLearning/completed/crawler_env.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/Reinforcement Learning/RL3 QLearning/completed/crawler_env.pyc
--------------------------------------------------------------------------------
/Reinforcement Learning/RL3 QLearning/completed/play.py:
--------------------------------------------------------------------------------
1 | import gym
2 | from Agents import QAgent
3 | import numpy as np
4 | from crawler_env import CrawlingRobotEnv
5 |
6 |
7 |
8 | env = CrawlingRobotEnv(render=False)
9 |
10 | agent = QAgent(env,gamma=0.9)
11 |
12 |
13 |
14 | all_rewards=0
15 | current_state=env.reset()
16 | total_reward = 0
17 | i = 0
18 | while i < 900000:
19 | i=i+1
20 | action = agent.choose_action(current_state)
21 | next_state,reward,done,info = env.step(action)
22 | agent.learn(current_state,action,reward,next_state)
23 | current_state = next_state
24 | total_reward += reward
25 |
26 | if i % 5000 == 0: # evaluation
27 | print "average_reward in last 5000 steps", total_reward / i
28 | if (total_reward / i) > 1.3:
29 | break
30 | average_reward = 0
31 | env.render = True
32 |
33 |
34 | env = CrawlingRobotEnv(render=True)
35 | current_state=env.reset()
36 | total_reward = 0
37 | agent.eps = 0
38 |
39 | i = 0
40 | while True:
41 | i=i+1
42 | action = agent.choose_action(current_state)
43 | next_state,reward,done,info = env.step(action)
44 | agent.learn(current_state,action,reward,next_state)
45 | current_state = next_state
46 | total_reward += reward
47 |
48 | if i % 5000 == 0: # evaluation
49 | print "average_reward in last 5000 steps", total_reward / 5000
50 | i=0;average_reward = 0
51 | env.render = True
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/Reinforcement Learning/RL3 QLearning/play.py:
--------------------------------------------------------------------------------
1 | import gym
2 | from Agents import QAgent
3 | import numpy as np
4 | from crawler_env import CrawlingRobotEnv
5 |
6 | ##Todo: Build a robot that can learn to crawl
--------------------------------------------------------------------------------
/gradient descent/README.md:
--------------------------------------------------------------------------------
1 | # Understanding Gradient Descent Optimization
2 |
3 |
4 |
5 |
6 |
7 | ### Instructions
8 |
9 | Open [`Gradient_Descent.ipynb`](https://github.com/codeheroku/Introduction-to-Machine-Learning/blob/master/gradient%20descent/Gradient_Descent.ipynb) to see the tutorial on Gradient Descent Optimization.
10 |
11 | All the starter code can be found in the [`starter code`](https://github.com/codeheroku/Introduction-to-Machine-Learning/tree/master/gradient%20descent/starter%20code) folder.
12 |
13 | The fully completed code can be found in [`complete code`](https://github.com/codeheroku/Introduction-to-Machine-Learning/tree/master/gradient%20descent/complete%20code) folder.
14 |
15 |
16 | > Check out our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) Course at [Code Heroku](http://www.codeheroku.com/) for a complete guide to Machine Learning.
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/gradient descent/complete code/gd_complete.py:
--------------------------------------------------------------------------------
1 | import pandas as pd
2 | import matplotlib.pyplot as plt
3 |
4 | ### Helper function use when needed
5 | def plot_regression_line(X,m,b):
6 | regression_x = X.values
7 | regression_y = []
8 | for x in regression_x:
9 | y = m*x + b
10 | regression_y.append(y)
11 |
12 | plt.plot(regression_x,regression_y)
13 | plt.pause(1)
14 |
15 |
16 | df = pd.read_csv("student_scores.csv")
17 |
18 | X = df["Hours"]
19 | Y = df["Scores"]
20 |
21 | plt.plot(X,Y,'o')
22 | plt.title("Implementing Gradient Descent")
23 | plt.xlabel("Hours Studied")
24 | plt.ylabel("Student Score")
25 |
26 | #plt.show()
27 |
28 | m = 0
29 | b = 0
30 |
31 |
32 | ## takes in m,b and gives a better value of m,b
33 | ## such that error reduces
34 | def grad_desc(X,Y,m,b):
35 |
36 | for point in zip(X,Y):
37 | x = point[0]
38 | y_actual = point[1]
39 |
40 | y_prediction = m*x + b
41 |
42 | error = y_prediction - y_actual
43 |
44 | delta_m = -1 * (error*x) * 0.0005
45 | delta_b = -1 * (error) * 0.0005
46 | m = m + delta_m
47 | b = b + delta_b
48 |
49 | return m,b
50 |
51 |
52 | for i in range(0,10):
53 | m,b = grad_desc(X,Y,m,b)
54 | plot_regression_line(X,m,b)
55 |
56 | plt.show()
57 |
58 |
59 |
--------------------------------------------------------------------------------
/gradient descent/slides/Gradient Descent for Machine Learning.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/gradient descent/slides/Gradient Descent for Machine Learning.pdf
--------------------------------------------------------------------------------
/gradient descent/starter code/gd.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeheroku/Introduction-to-Machine-Learning/cb915bab2892a0cf4e60da956c493a83753af3cb/gradient descent/starter code/gd.zip
--------------------------------------------------------------------------------
/gradient descent/starter code/student_scores.csv:
--------------------------------------------------------------------------------
1 | Hours,Scores
2 | 2.3,18
3 | 5.0,45
4 | 3.2,25
5 | 8.5,72
6 | 3.5,30
7 | 1.5,20
8 | 9.2,88
9 | 5.5,60
10 | 8.3,81
11 | 2.7,25
12 | 7.7,85
13 | 5.9,62
14 | 4.5,41
15 | 3.4,44
16 | 1.1,17
17 | 8.9,95
18 | 2.5,30
19 | 1.9,24
20 | 6.1,67
21 | 7.4,69
22 | 2.7,30
23 | 4.8,54
24 | 3.7,33
25 | 6.8,70
26 | 7.4,85
27 |
--------------------------------------------------------------------------------