Skip to main content

ML Basics

What is a Model in ML ?

In the world of machine learning, the term "model" is one of the most frequently used concepts. Let’s clarify what a model is and how it relates to an algorithm in machine learning.

What is a Machine Learning Model ?

A machine learning model is a program or system that learns patterns from data using an algorithm and uses those patterns to make predictions or decisions.

It's the result of the machine learning process. Essentially, the model serves as a mathematical or statistical structure that maps inputs (features) to outputs (target value or predicted value).

How does a model work ?

To train a model, you provide with a dataset and a procedure to learn patterns from the data (algorithm).

Once trained, the model is used to make predictions on new, unseen data.

For example, a linear regression model that predicts house prices based on square footage, area and city. Another example is a neural network model that classifies images as either cats or dogs.

Fig: Model Flow diagram

Another example is OpenAI's ChatGPT is a pre-trained transformer model that leverages deep learning techniques to process and generate natural language.

The ChatGPT model refers to the underlying mathematical representation that has been trained to predict the next word in a sentence based on the preceding words. It processes input text as numerical data (tokens) and uses its learned parameters to predict and create contextually appropriate text responses.

What is an algorithm in machine learning ?

An algorithm is a set of rules or instructions that guide the model's learning process.

It defines how the model process the data, identifies patterns, adjusts its internal parameters to improve its performance.

πŸ’‘
In short, an algorithm builds and trains the model, making the two inseparable in the machine learning workflow.

For example, gradient descent is an optimization algorithm to minimize the errors in models. Also k-means clustering algorithm helps to groups the similar data points, random forest algorithm is an ensemble algorithm that trains multiple decision trees, and whereas deep learning algorithms are used for the above ChatGPT model example etc.

Analogy

Think of the algorithm as the process (recipe) and the model as the result (cake). The data is the ingredients used to make it.