How is a Machine Learning Model like a Math Formula?

Vidhi
AI for High Schoolers by High Schoolers
3 min readAug 12, 2023

In one of my previous articles, we built a simple machine-learning model.

Now, let’s start with the basics of what we have read in our math class :

y = mx + c

The m and c values will change depending on the known data and it will affect the accuracy of future predictions.

Image Source: https://www.cuemath.com/geometry/y-mx-c/

Let’s take an example:

  1. Gather a set of X data points (the elapsed time) and Y data points (the quiz grade).
  2. Draw a line of best fit on the data.
  3. If you see 20 more tests with their elapsed times but for some reason, your system has broken and you can’t grade the tests, you can take those X points and see the Y point at which they cross your line of best fit to get a predicted quiz score for these 20 points and use that.

Linear regression is a statistical method that allows you to find the line of best fit for a set of data points. The line of best fit is the line that minimizes the sum of the squared distances between the data points and the line.

You can vary the model by how you define “best fit” and by changing the shape of the line that you use. For example, you could use a polynomial instead of a straight line.

Now let’s relate this to a Machine Learning Model:

Supervised learning is a type of machine learning where the AI is trained on a set of data that includes both the inputs and the desired outputs. The AI then learns to map the inputs to the outputs.

For example, if you want to train an AI to recognize cats, you would give it a set of images of cats and the corresponding labels (e.g., “cat” or “not cat”). The AI would then learn to map the pixels in the images to the labels.

Once the AI is trained, you can give it an image of a cat that it has never seen before and it will be able to tell you whether it is a cat or not.

Here is a simplified explanation of how supervised learning works:

  1. The AI is given a set of inputs and outputs.
  2. The AI learns to map the inputs to the outputs.
  3. The AI is given an input that it has never seen before.
  4. The AI maps the input to the output.
  5. The AI outputs the label for the input.

Supervised learning is a powerful tool that can be used to train AIs to perform a variety of tasks.

Hence if we conclude, based on our y = mx+c math formula, where data determines the value of m & c. Once we derive the value of m & c we get a formula which for example y = 2x+3. Now with any given x, we will get y.

Similarly, a machine learning model is a formula. That model determines its various internal parameters like (m & c) when various data input and output is provided while training the model. Once the model is trained, given any input it will provide the required output.

--

--

Vidhi
AI for High Schoolers by High Schoolers

A high schooler who is interested in Artificial Intelligence.