# Linear Regression From Scratch PT3: Stochastic Gradient Descent

Welcome back! This is part 3 of the Linear regression model from scratch. In this article, we will be exploring the famous “Stochastic gradient descent(SGD)” algorithm. I will attempt to explain the intuition of how this very popular algorithm works, and what makes it different from the simple Batch gradient descent algorithm explored in the last series. If you have not seen the previous articles on this subject, find the links embedded here: Part1 and Part 2. Do read them, as this article builds on what has been discussed earlier on.

In the previous article, we discussed the use of…

# Linear Regression From Scratch PT2: The Gradient Descent Algorithm

In my previous article on Linear regression, I gave a brief introduction to linear regression, the intuition, the assumptions, and two most common approaches used for solving linear regression problems. The previous article focused on one of the approaches; “the Closed Form solution(Analytical Approach)”. In this article, the focus will be on the second approach: “Numerical Approach”, in specific, one type of the numerical approach called the “Gradient Descent(GD Algorithm)”.

# SOLVING LINEAR REGRESSION USING THE NUMERICAL APPROACH

In real life scenario, most problems (or atleast the ones we are interested in Machine learning), do not have exact solutions as proposed by the Closed form solution. Aside this…

# LINEAR REGRESSION FROM SCRATCH PT1

The Linear Regression is considered the most natural learning algorithm for modelling data, primary because it is easy to interpret and models efficiently most natural problems. It belongs to the family of “Linear Models/Predictors” in machine learning(one of the most useful hypothesis space). Although, there are various ways of implementing this algorithm(including using the Sklearn library in Python, it is just as important to understand the basic intuition behind this algorithm and how libraries such as Sklearn work behind the scenes.

Assumptions of the Linear Regression Model

• It assumes a linear relationship between the dependent and independent variables.
• It assumes…

# “Hangman with Image Display” — Series 13: #LearnPythonThroughProjects

In the previous series, we built a simple version for the ‘Hangman game in Python”. In this series, we are advancing forward, improving on the previous program, and testing our skills.

As mentioned in the previous series(view here), the HANGMAN GAME is all about solving a puzzle and guessing a word or phrase correctly before the ‘hanging man dies’. An image is usually displayed, where a hanging man slowly begins to appear, bit-by-bit, for every wrongly guessed word, and a life/chance or try in the game is lost.

# “A Simple Hangman” — #LearnPythonThroughProjects: Series 12

Hey there Python rockstar! Welcome to another interesting Project. It’s that time of the week, put on your Coding armour , let’s go conquer another task.

# THE HANGMAN GAME:

One of those classic word guessing games played between two or more players. One player sets or defines a word or list of words, and the other player(s) have to guess correctly, given a certain number of trials. It is quick, easy, educational and most times requires only a piece of paper and the ability to spell correctly. It could also be played with a computer(as the one which will be built in this…

# Phonebook Program Revamped — #LearnPythonThroughProjects : Series 11

In the previous series, ‘a simple phonebook program’ was built using basic concepts of Functions, data structures, and flow control statements. Taking a step ahead, an improved version will be built today, working towards automation and fewer yet efficient lines of codes. We will apply the knowledge of user-defined modules once again, to get more comfortable with building one.

Excited about this one? Me too. Watch out for an important announcement at the end of the article.

Let’s move on to building the Project for the day.

# PROJECT PUEDOCODE

1. PYCONTACT MODULE
• Define an empty dictionary to store contact information as a global…

# “Building a Simple PhoneBook” — #LearnPythonThroughProjects: Series 10

Hey there Python rockstar! Welcome to another interesting Project. Do you have your Coding gear ready? Let’s go build a mind-blowing project.

In this article, we will explore how to build a simple phonebook in Python, using a blend of all the concepts learnt so far. Are you excited? 😃Me too!😊

Wouldn’t you agree that it’s a pretty good idea to automate and explore the little daily tasks/routines around, using your programming skills?

In the previous article, we scouted the use of user-defined modules and functions in Python .

So let’s probe further, get comfortable with these concepts, revise previously…

# A Simple Calculator: Revisted — #LearnPythonthroughProjects Series 9

Wow! Look how far we have come. Thumbs up👍🏼. Let’s keep the fire burning.

Remember we built a simple calculator earlier(Link here), and I mentioned we will be revisiting the project to improve its functionality, whilst also learning and exploring more concepts in Python? Well, in this project, we will build a calculator using the concepts of modules and functions in Python. The concept of Modular programming was introduced in the previous project. We explored how modules can be used to improve code efficiency and execution. Recall, I mentioned that modules can be made of variables(which could also be data…

# Rock, Paper, and Scissors: Series 8 — #LearnPythonThroughProjects

One of the oldest hand games, dated far back in history, centuries and centuries ago, passed down from generation to generation. It is not known for sure when it first started, however, its first known mention was in the book “Wuzazu” — written by Xie Zhaozhi, in the then Chinese Han-dynasty around 1600, where it was called ‘Shouling’. The game later found its way into the Japanese history, where a variation was created and named ‘Janken’, around 1700.

This hand-game is not just a pass time for most, it is considered as an official game in most parts of the…

# “Creating Patterns in Python” — #LearnPythonThroughProjects: Series 7

We have come so far these last few weeks. Buckle up! more exciting projects coming your way!

This project is all about creating some fun shapes in Python using nested for loops and conditional if-else statements. In this series, we will be creating several patterns, then I will share links to resources and source codes for further exploration.

The first pattern is a “Multiplication Table”. Let’s dive in!

As always, create a new python file, save as “multiplication.py”

PSEUDOCODE FOR MULTIPLICATION TABLE

1. Define a variable ‘num’. Use the input function and the int function.
2. Create an iterative condition using a…

## Aminah Mardiyyah Rufai

Data Scientist/Machine learning/AI enthusiast

Get the Medium app