Hacking the Bagel Shop

This is my write-up of the Medium Hack-the-Box-Machine, “Bagel”. Hacking into this machine, we assume the role of a bagel-loving hacker who tries to infiltrate an online bagel shop’s server. Topics…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Machine Learning Intuition

Part 1 of the “Getting Started in Deep Learning” series

Illustration of the learning process.

Deep Learning is a class of algorithms, sometimes also referred to as artificial neural networks, or just neural networks, belonging to a broader family — machine learning algorithms. This tutorial will be focused on providing an introductory explanation of the concept of machine learning.

To illustrate the concept of machine learning, suppose you have some images of animals, and you want to identify which animal is in a given picture. Our goal is to find a function that can do this job, i.e. that maps an image to the animal it contains.

More formally, given a set of input-output pairs {(x, y)}, which in this case x is an image and y is the animal in the image, we want to find the relation between them, that is a function

that maps the inputs to the outputs. In this particular case, we want to find a function that can output the animal from a set of pixels. It seems extremely complex to find this function explicitly!

Instead of writing the set of rules that determine the animal based on the pixels (as in the traditional programming paradigm depicted in the image below), machine learning tries to approximate this relationship by learning from the set of available examples (images, in this case), called the training set, and their respective labels (cat, dog, etc.).

We call the paradigm of learning from examples and their labels supervised learning. This somehow resembles the way children learn to identify animals in the first place, which is by seeing some examples and being told the name of the specific animal.

It is important that the approximated function not only produces correct outputs for the examples in the training set but also that when it sees a new example, it makes accurate predictions, making this function useful in the real world. In our example, this translates to our approximated function being able to predict the correct animal when faced with a new image.

The previous animal example was a classification problem, where the output variable was a class that could be either a cat, dog, or duck. We will now give an example of a machine learning model for a regression problem, in which we want to predict a numerical value given some input.

Suppose we are trying to predict the price of a used car based on the following features

The linear regression model makes a very simplifying assumption that the output y is linear on the inputs. So, we can write the estimated output as a linear combination of the inputs, where the parameters θ define the weight that each variable has on the output.

We start the summation at 0 to account for the bias term. The bias represents unmodelled effects, like the car seller was in a very good mood that day and so the price was lower than usual. We can think of the bias as the part of the output that is not predictable from the features.

We have made the assumption that the function that maps the car features to its price is linear. Now we need to find the value of the parameters θ that result in the line that best fits our data.

For visualization purposes, suppose now that we have only a single feature, say the displacement. Thus, we can visualize our data in a 2D plot, where the x-axis represents the feature (in thousands), and y is the output (the price of the car, in thousands of euros).

The linear regression model is able to find the line that best models the relation between x and y.

How do we know which line best fits our data? We want that the predicted output be as close as possible to the real output. So, we can define the error of our model as the Mean Squared Error, which is roughly the average of the squared differences between the predicted output and the real output. Assuming that our training set has m examples, and using superscript notation to define the i-th example, the Mean Squared Error is thus defined as

In the left-hand side of this equation, we read “;θ” as “parameterized by θ”, which simply means that θ are the parameters of the loss function ℒ.

In the image below, in red we have the distance between the target value (blue dot) and the prediction (projection of the target value on the linear regression line). The larger this distance is, the worse is our prediction. So we’d like this distance to be as small as possible.

Our goal is then to minimize the distance between the predicted output and the real output. In other words, we want to minimize our loss function, the Mean Squared Error. We’ll see how we can do this in the next article.

Example of the plot of the loss as a function of the parameters θ. Our goal is to find the parameters that minimize the loss function (red cross in this example).

Machine learning models learn the relationship between 2 sets, which in our first example are images (input) and animals (output) by looking at a lot of examples, called the training set. This is opposed to typical computer programs, in which the programmer specifically writes the set of rules that map the input to the output. Machine Learning models find such rules by themselves, and they are typically applied to complex problems in which it is infeasible for a human to derive such rules.

An example of a Machine Learning model is the Linear Regression. This model assumes that the output is a linear combination of the inputs. We thus have to find the parameters of this model that better fit our training data. So we define a loss function that reflects the error of our model and our goal is to minimize it. The parameters of our model will then be the ones that minimize this loss function.

Gradient Descent: How Machine Learning Models Learn, Part 2 of the “Getting Started in Deep Learning” Series

Add a comment

Related posts:

Neo Hair Lotion Green Lahore

visit the official website Link;https://healthcares.com.pk/product/neo-hair-lotion/ call us for online order with free home delivery +923053333127 ✔️ Neo Hair Lotion Available in…

A Few Handy Summer Agriculture Tips

The middle year could be a vigorous time for groundskeepers. Some plants can develop out of management and are aiming to die below the recent summer sun. With bare aid and plenty of water, there’s…

Vet Supply

So you decided to adopt a dog? Now what? The truth is that every dog is a little different and you won’t know your dog’s true personality until a few weeks in. The first thing you should do after you…