Zaitounish commited on
Commit
e3f7922
·
1 Parent(s): e9eec48

Upload Machine Learning Introduction A Com.txt

Browse files
Machine Learning Introduction A Com.txt ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Machine Learning Introduction: A Comprehensive Guide
2
+
3
+ This is the first of a series of articles in which I will describe machine learning concepts, types, algorithms and python implementations.
4
+
5
+ The main goals of this series are:
6
+
7
+ Creating a comprehesive guide towards machine learning theory and intuition.
8
+ Sharing and explaining machine learning projects, developed in python, to show in a practical way the concepts and algorithms explained, as well as how they can be applied in real-world problems.
9
+ Leaving a digital footprint of my knowledge in the subject and inspire others to learn and apply machine learning in their own fields.
10
+ The information exposed in this series comes from several sources, being the main ones:
11
+
12
+ Machine Learning Engineer NanoDegree (Udacity)
13
+ Python Machine Learning book (by Sebastian Raschka & Vahid Mirjalili)
14
+ Deep Learning with Python book(by Francois Chollet)
15
+ Machine Learning Mastery with Python book(by Jason Brownlee)
16
+ Python Data Science and Machine Learning course by Jose Portilla (Udemy)
17
+ Machine Learning y Data Science con Python course by Manuel Garrido (Udemy)
18
+ What Is Machine Learning?
19
+ Due to the large decrease in technology and sensors prices, we can now create, store and send more data than ever in history. Up to ninety percent of the data in the world today has been created in the last two years alone. There are 2.5 quintillion bytes of data created each day at our current pace and this pace is only expected to grow. This data feed the machine learning models and it is the main driver of the boom that this science has experienced in recent years.
20
+
21
+ Machine Learning is one of the subfields of Artificial Inteligence and can be described as:
22
+
23
+ “Machine Learning is the science of getting computers to learn and act like humans do, and improve their learning over time in autonomous fashion, by feeding them data and information in the form of observations and real-world interactions.” — Dan Fagella
24
+
25
+ Machine learning offers an efficient way for capturing knowledge in data to gradually improve the performance of predictive models, and make data-driven decisions. It has become an ubiquitous technology and we enjoy its benefits in: e-mail spam filters, self-driving cars, image and voice recognition and world-class go players.
26
+
27
+ The next video shows a real-time event detection for video surveillance machine learning application.
28
+
29
+ Basic Terminology and Notations
30
+ Generally in machine learning it is used matrix and vector notations to refer to the data. This data is used normally in matrix form where:
31
+
32
+ Each separate row of the matrix is a sample, observation or data point.
33
+ Each column is feature (or attribute) of that observation.
34
+ Usually there is one column (or feature), that we will call the target, label or response, and its the value or class that we’re trying to predict.
35
+
36
+ Table By Author
37
+ To train a machine learning model is to provide a machine learning algorithm with training data to learn from it.
38
+
39
+ Regarding machine learning algorithms, they usually have some inner parameters. ie: In Decision Trees, there are parameters like depth, number of nodes, number of leaves… This inner parameters are called hyperparameters.
40
+
41
+ Generalization is the ability of the model to make predictions on new data.
42
+
43
+ Types of machine learning
44
+ The types of machine learning that will be studied through this series are:
45
+
46
+ Supervised learning
47
+ Unsupervised learning
48
+ Deep learning.
49
+ In this series we will explore and study all of the metioned types of machine learning and we will also dig deeper in a kind of deep learning techniques called “reinforcement learning”.
50
+
51
+ Supervised Learning
52
+ Supervised learning refers to a kind of machine learning models that are trained with a set of samples where the desired output signals (or labels) are already known. The models learn from these already known results and make adjustments in their inner parameters to adapt themselves to the input data. Once the model is properly trained, it can make accurate predictions about unseen or future data.
53
+
54
+ An overview of the general process:
55
+
56
+
57
+ Figure by Author
58
+ There are two main applications of supervised learning: classification and regression.
59
+
60
+ Classsification:
61
+ Classification is a subcategory of supervised learning where the goal is to predict the categorical class labels (discrete, unordered values, group membership) of new instances based on past observations. The typical example is e-mail spam detection, which is a binary classification (either an e-mail is -1- or isn’t -0- spam). There is also multi-class classification such as handwritten character recognition (where classes go from 0 to 9).
62
+
63
+ An example of binary classification: There are 2 classes, circles and crosses, and 2 features, X1 and X2. The model is able to find the relationship between the features of each data point and its class, and to set a boundary line between them, so when provided with new data, it can estimate the class where it belongs, given its features.
64
+
65
+
66
+ Figure by Author
67
+ In this case, the new data point falls into the circle subspace and, therefore, the model will predict its class to be a circle.
68
+
69
+ 2. Regression:
70
+
71
+ Regression is also used to assign categories to unlabeled data. In this type of learning we are given a number of predictor (explanatory) variables and a continuous response variable (outcome), and we try to find a relationship between those variables that allows us to predict a continuous outcome.
72
+
73
+ An example of linear regression: given X and Y, we fit a straight line that minimize the distance (with some criteria like average squared distance (SSE)) between the sample points and the fitted line. Then, we’ll use the intercept and slope learned, of the fitted line, to predict the outcome of new data.
74
+
75
+
76
+ Figure by Author
77
+ Unsupervised Learning
78
+ In unsupervised learning we deal with unlabeled data of unknown structure and the goal is to explore the structure of the data to extract meaningful information, without the reference of a known outcome variable.
79
+
80
+ There are two main categories: clustering and dimensionality reduction.
81
+
82
+ Clustering:
83
+ Clustering is an exploratory data analysis technique used for organizing information into meaningful clusters or subgroups without any prior knowledge of its structure. Each cluster is a group of similar objects that is different to objects of the other clusters.
84
+
85
+
86
+ Figure by Author
87
+ 2. Dimensionality Reduction:
88
+
89
+ It is common to work with data in which each observation comes with a high number of features, in other words, that have high dimensionality. This can be a challenge for the computational performance of Machine Learning algorithms, so dimensionality reduction is one of the techniques used for dealing with this issue.
90
+
91
+ Dimensionality reduction methods work by finding correlations between the features, which would mean that there is redundant information, as some feature could be partially explained with the others. It removes noise from data (which can also decrease the model’s performance) and compress data to a smaller subspace while retaining most of the relevant information.
92
+
93
+ Deep Learning
94
+ Deep learning is a subfield of machine learning, that uses a hierarchical structure of artificial neural networks, which are built in a similar fashion of a human brain, with the neuron nodes connected as a web. That architechture allows to tackle the data analysis in a non-linear way.
95
+
96
+ The first layer of the neural network takes raw data as an input, processes it, extracts some information and passes it to the next layer as an output. Each layer then processes the information given by the previous one and repeats, until data reaches the final layer, which makes a prediction.
97
+
98
+ This prediction is compared with the known result and then, by a method called backpropagation, the model is able to learn the weights that yield accurate outputs.
99
+
100
+
101
+ Figure by Author
102
+ Reinforcement Learning
103
+ Reinforcement learning is one of the most important branches of Deep Learning. The goal is to build a model in which there is an agent that takes actions and where the aim is to improve its performance. This improvement is done by giving an specific reward each time that the agent performs an action that belongs to the set of actions that the developer wants the agent to perform.
104
+
105
+ The reward is a measurement of how well the action was in order to achieve a predefined goal. The agent then uses this feedback to adjust its future behaviour, with the objective of obtaining the most reward.
106
+
107
+ One common example is a chess engine, where the agent decides from a series of possible actions, depending on the board’s disposition (which is the environment’s state) and the reward is given when winning or loosing the game.
108
+
109
+
110
+ Figure by Author
111
+ General Methodology for Building Machine Learning Models
112
+
113
+ Figure by Author
114
+ Preprocessing:
115
+ It is one of the most crucial steps in any Machine Learning application. Usually data comes in a format that is not optimal (or even inadequate) for the model to process it. In that cases preprocessing is a mandatory task to do.
116
+
117
+ Many algorithms require the features to be on the same scale (for example: to be in the [0,1] range) for optimizing its performance, and this is often done by applying normalization or standardization techniques on the data.
118
+
119
+ We can also find in some cases that the selected features are correlated and therefore, redundant for extracting meaningful information from them. Then we must use dimensionality reduction techniques to compress the features to smaller dimensional subspaces.
120
+
121
+ Finally, we’ll split randomly our original dataset into training and testing subsets.
122
+
123
+ Training and Selecting a Model
124
+ It is essential to compare a bunch of different algorithms in order to train and select the best performing one. To do so, it is necessary to select a metric for measuring the model’s performance. One commonly used in classification problems is classification accuracy, which is the proportion of correctly classified instances. In regression problems one of the most popular is Mean Squared Error (MSE), that measures the average squared difference between the estimated values and the real values.
125
+
126
+
127
+ Figure bu Author
128
+ Finally, we will use a technique called cross-validation to make sure that our model will perform well on real-world data befiore using the testing subset for the final evaluation of the model.
129
+
130
+ This technique divides the training dataset into smaller training and validating subsets, then estimates the generalization ability of the model, in other words, estimating how well it can predict outcomes when provided with new data. It then repeats the process, K times and computes the average performance of the model by dividing the sum of the metrics obtained between the K number of iterations.
131
+
132
+
133
+ Figure by Author
134
+ In general, the default parameters of the machine learning algorithms provided by the libraries are not the best ones to use with our data, so we will use hyperparameter optimization techniques to help us to do the fine tunning of the model’s performance.
135
+
136
+ Evaluating Models and Predicting with New Data
137
+ Once we have selected and fitted a model to our training dataset, we can use the testing dataset to estimate the performance on this unseen data, so we can make an estimation of the generalization error of the model. Or evaluate it using some other metric.
138
+
139
+ If we are satisfied with the value of the metric obtained, we can use then the model to make predictions on future data.
140
+
141
+ Wrap Up
142
+ In this article we learned what is Machine Learning painting a big picture of its nature, motivation and applications.
143
+
144
+ We also learned some basic notations and terminology and the different kinds of machine learning algorithms:
145
+
146
+ Supervised learning, with classification and regression problems.
147
+ Unsupervised learning, with clustering and dimensionality reduction.
148
+ Reinforcement learning, where the agent learn from its environment.
149
+ Deep learning and their artificial neuron networks.
150
+ Finally, we made an introduction to the typical methodology for building Machine Learning models and explained its main tasks:
151
+
152
+ Preprocessing.
153
+ Training and testing.
154
+ Selecting a model.
155
+ Evaluating.