Linear Regression with MACHINE LEARNING (Python)

Mon, 03 Mar 2025 02:56:58 GMT

![Image](https://upload.cafenono.com/image/slashpagePost/20250303/115804_XurzPcjGi4rVseeonZ?q=80&s=1280x180&t=outside&f=webp)

## Motivation

✍️ There are many Python libraries for AI/ML. Tensorflow, ScikitLearn, Pytorch, Keras, Transformers, etc...

The problem is all explanations are very complicated at first glance.

So, let's return to a simple problem that can be solved analytically by formula or by bruteforce with machine learning: Linear Regression.

Everybody knows what's a Linear Regression and how it can be used estimate the future.

So I created a simple sequence from 10 to 100 and the first 5 numbers (10, 20, 30, 40, 50) I used as train. The rest (60, 70, 80, 90, 100) I used as test.

And can the model predict the next 5 numbers? Of course. You can copy this snippet to Google Colab and check the results.

So this will be your first AI model. Very simple to understand.

#️⃣ **Tags: #Python #AI #ML #Code #Coding #Colab #Linear #LinearRegression #Tensorflow #Keras #Pytorch #Transformers #HuggingFace #Academy #College #ComputerScience #Algo #Algorithm #Model #Math #Science**