Johnny.sh

Binary Classification

Videos:

  • Binary Classification

Notation + Binary Classification

We use logistical regression as a core guiding mathematical concept in machine learning. These are some of the notation that we use when working with logistical regression.

We’ve already established that x is the input and y is the output, and m is the size of the training set.

Let’s use the example of identifying cats in images. In this example, x is cat image data, and y is 1 or 0. This is called binary classification — either 1 or 0.

Our labeled training set looks like this:

{(x¹, y¹), (x²,y²),...(xᴹ,yᴹ)}

Assume each x is a 64x64 pixel image of a cat.


Furthermore, we have capital X. Capital X represents our training data in a matrix. In other words, it’s an array of our training images, an array of raw cat images. Each item in the array is an array of pixels, each pixel is an array of RGB values.

The total dimension of our cat training image is 64x64 pixels, each pixel having three color channels (RGB). That’s 12,288 dimensions, or we could say nx = 12288.

Back to the capital X, our input matrix looks like this:

X = [
  [...x¹],
  [...x²],
  ...,
  [...xᴹ],
]

Wherein each item is one picture.

To use the python notation, the shape of X is (nx, m).

X.shape = (nx, m)

On the other hand, we have capital Y, which represents our output matrix. Our output matrix is a one-dimensional array of the expected output values.

Y = [y¹, y²,..., yᴹ]

Somewhat related: we may refer to a “piece of data”, aka one item in our training data set with a superscript i. Like so:

xⁱ
yⁱ
zⁱ

zⁱ = wᵗxⁱ + b
Last modified: May 06, 2023
/about
/uses
/notes
/talks
/projects
/podcasts
/reading-list
/spotify
© 2024