Python is considered the best programming language for Machine Learning and AI based projects because of its great variety of libraries and frameworks. Scikit-learn is likely the most useful library for Machine Learning in Python. The sklearn library has a lot of efficient tools for machine learning and statistical modeling including classification, regression, clustering and etc.

In this paper, I will show how to implement Linear Regression algorithm using sklearn library.

For non — library (from scratch) implementation of the algorithm, you can check my previous paper.

Going into the coding part, like any other usage of library in python…

Linear Regression is a Supervised Machine Learning which is used to predict values within a certain range, rather than classifying them into categories.

In this article you can find the implementation of Univariate Linear Regression in Python without using any machine learning library. The code will be explained step-by-step with provided mathematical background.


  • Theoretical background
  • Python code
  • Summary


You may think that, “I can drive a car without knowing how the engine works”. Yes, you are right. But what if the engine causes a simple trouble while you are on a highway. To wait for the service for hours or…

Linear Regression is among mostly used Machine Learning algorithms. Univariate Linear Regression is the simpler form, while Multivariate Linear Regression is for more complicated problems.

This is my second paper about Linear Regression, first one is on Univariate Linear Regression. You can look through it for getting background knowledge on Linear Regression, basics of Machine Learning algorithms, and better understanding of this paper.

The paper contains following topics:

  • Introduction to Multivariate Linear Regression;
  • Hypothesis of the algorithm;
  • Manipulation of the dataset and matrix multiplication;
  • Cost function;
  • Gradient Descent.

Introduction to Multivariate Linear Regression

In ML problems, there are various datasets, they differ from one another with their dimensions (number of…

Linear Regression (LR) is one of the main algorithms in Supervised Machine Learning. It solves many regression problems and it is easy to implement. This paper is about Univariate Linear Regression(ULR) which is the simplest version of LR.

The paper contains following topics:

  • The basics of datasets in Machine Learning;
  • What is Univariate Linear Regression?
  • How to represent the algorithm(hypothesis), Graphs of functions;
  • Cost function (Loss function);
  • Gradient Descent.

The basics of datasets in Machine Learning

In ML problems, beforehand some data is provided to build the model upon. The datasets contain of rows and columns. …

Anar Abiyev

Process Automation Engineering Student, Machine Learning Learner

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store