Lesson 3 – Binary Classification
Neural networks are a type of computer program that can learn and make predictions based on data.
One important technique is to process a set of training examples without using a loop. Logistic regression is a way to classify things into two
categories, like whether an image is a truck or not. It can also be called Binary Classification. In a binary classification problem, the output is
a categorical variable that can take on one of two possible values.
Binary Classification Examples Spam Email (1) – Not Spam Email (0) | It is a cat (1) – It is not a cat (0)
The objective is to develop a binary classification model that takes an image, represented by a feature vector 𝑥, as input and outputs a
prediction of the corresponding binary label 𝑦, which indicates whether the image depicts a truck (𝑦 = 1) or not (𝑦 = 0).
In a computer, an image is represented by three distinct matrices, each corresponding to one of the three color
channels: Red, Green, and Blue (RGB).
For an image with dimensions of 5 pixels by 10 pixels, the Red, Green,
9 98 45 123 25 78 102 36 122 93
5
201 14
118 125
124 198
27 201
59 98
210 147
236 165
105 201
169 1419 196
and Blue color channels are each represented by a separate matrix of
34 58
253 144
178 118
199 124
120 251 210
197 274 59
41 67 100
115 104 23634 105
32 141
111 169
19 19
23 size 5x10.
209 118 124 27 59 210 236 105 169 19
78 2969 178
231 199
201 197
74 411 11523 104
45 34
78 111
101 19 5 Each cell within the matrices contains a pixel intensity value. These
35 178 199 197 4 115 104 34 111 19
10 90 7921 69
201 231
35 201
34 74
46 1148 239 45 12 7815 101
251 32 69 231
21 201 35 201
34 74 46 1148 239 45 12 7815 101 values are used to construct an n-dimensional feature vector, which
The size of the image and the number of pixels
presented here are for educational purposes only 67 21 201 35 34 46 48 9 12 15 serves as a representation of the image object in pattern recognition
and do not represent the actual size of an image
and pixel in a computer system.
10 and machine learning tasks, such as distinguishing between truck and
non-truck images.
To create a feature vector 𝑥 from an image represented by three 5x10 color channel matrices (Red, Green, and Blue), the pixel intensity values
will be "unrolled" or "reshaped" for each color. The dimension of the input feature vector 𝑥, in this case, will be 𝑛) = 5×10×3 = 150. The
feature vector 𝑥 will be a one-dimensional array containing all the pixel intensity values from the three-color channels, resulting in a vector of
length 150.
𝑥 = 253 144 120 … 41 67 100 … 141 23 255 ….
Red | Blue | Green