Skip to main content
Crowdfunding
Python + AI for Geeks
Practice

Why Algorithms Are Needed in Machine Learning

For a machine learning model to learn on its own, there needs to be a set of rules that determines how it should analyze and learn from given data.

These rules are called algorithms.

Simply put, an algorithm is a way for an AI model to learn patterns from data without humans directly providing rules.


How to Easily Explain Machine Learning Algorithms?

Algorithms are like cooking recipes.

Even if you have the ingredients (data), you can't make delicious food without knowing the cooking method (algorithm).

Depending on the recipe used, the result (prediction, classification, etc.) will differ, even with the same ingredients.

Some dishes need frying, others need mixing, and some need to be simmered for a long time.

Similarly, algorithms define the process of using data to achieve optimal results (learning method).


Representative Machine Learning Algorithms

There is a wide variety of algorithms used in machine learning.

Below, we introduce some of the representative machine learning algorithms.


Logistic Regression

This algorithm predicts outcomes by calculating probability.

It is often used in binary classification problems where a choice between two options is required.

For instance, for the question "Is this email spam?", it might output a result like "85% probability of being spam".

The result is given as a probability value between 0 (0%) and 1 (100%), and it's classified into a particular class if it exceeds a certain threshold (e.g., 50%).


Linear Regression

An algorithm that predicts numerical values by using data to draw a line (or a plane in multi-dimensional space) to forecast future values.

For example, if the average weight is 55kg when the height is 160cm, and 65kg when it's 170cm, you can draw a line using these two points to predict that if the height is 175cm, the weight will be approximately 70kg.


Decision Tree

An algorithm that classifies data by finding answers through a series of questions.

Much like a game of 20 questions, it finds the answer by asking questions one by one.

For instance, starting with the question "Is this animal a mammal?" and proceeding with different questions based on "Yes" or "No" responses, ultimately leading to identifying the animal.


Neural Networks

An algorithm that learns in a manner akin to the human brain by using layers composed of multiple neurons.

Neural networks comprise an input layer, hidden layers, and an output layer.

Each neuron is connected to neurons in the previous layer, and through this connectivity, it can learn complex patterns.

For example, a neural network recognizing faces might operate as follows:

  • The first layer analyzes differences in image brightness

  • The second layer detects shapes of eyes, nose, and mouth

  • The final layer predicts whose face it is


K-Nearest Neighbors (KNN)

An algorithm that predicts by finding similar data.

When classifying data, it references K of the closest pieces of data (neighbors) to determine the result.

For instance, when a new fruit arrives:

It checks which fruits from existing data are closest to it.

It then finds the nearest K fruits, and if the majority are apples, the new fruit is judged as an "apple".


In the next lesson, we will begin with the Linear Regression algorithm and delve into each algorithm in detail.

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.