Unsupervised Machine Learning in Python from scratch tutorial

Messier 13 — the Great Globular Cluster in Hercules. The best known globular clusters in the northern hemisphere.
Messier 13 — the Great Globular Cluster in Hercules. The best known globular clusters in the northern hemisphere.
Photo by Guillermo Ferla on Unsplash

After the short introduction to clustering and the practical ideas of using it, we will go through this tutorial on K-Means Clustering from scratch in Python. I will show you how it works intuitively step by step, in a way I wish somebody showed it to me. After completing this tutorial, you will learn how to:

Introduction

Customer Segmentation

Imagine that we are a company that provides some services, and has a customer database. To be able to provide better services, a higher value to our (future) customers we want to learn more about them, especially, those who are already connected to us. In other words, to learn from the historical data to improve the future. For this, we want to apply customer segmentation. …


Python for time management. Pomodoro application. The full code is included :)

A laptop and a cup. The header image for my article about creating a productivity app from scratch with Python.
A laptop and a cup. The header image for my article about creating a productivity app from scratch with Python.
Photo by Artem Sapegin on Unsplash

Intro

This article is the second part of my project I discussed previously. To recap, the idea is to create a Pomodoro app in Python from scratch. Because we all want to be effectively productive while staying at home amidst the COVID-19 pandemic.

One way to do so is to take one step at a time. Because our brain is not meant to be multitasking. In reality, it does multi-switching between different tasks.

In other words, we need to concentrate on one single activity at a time. And the Pomodoro technique can help us with it.

Summary from Part 1

Previously, we built the base of our application, that looked like…


Applying Regular Expressions (regex) to a real-world problem.

A laptop with a face mask on it.
A laptop with a face mask on it.
Photo by Guido Hofmann on Unsplash

Short Intro

The idea behind this project is very simple yet meaningful. It boils down to the following questions:

What can I do for the community during this horrible pandemic? How can I help others to research the coronavirus?

I am going to apply my knowledge of Python to analyze a scientific paper on COVID-19 and to show you that everyone can use Python to analyze the text and get some insights out of it. This post is meant to encourage everyone to use Python in day-to-day life. …


Python for time management. Pomodoro application.

Woman with a laptop sitting on a chair.
Woman with a laptop sitting on a chair.
Photo by Daria Nepriakhina on Unsplash

Introduction

The pandemic is hitting hard. It is necessary to limit any physical contact with the “outside” world and to stay indoors as much as possible. If you have an opportunity to work from home, it is great. However, there is a price to pay as well.

Staying efficiently productive at home is not an easy task. A home environment is not a work environment. Assuming you are not living alone, you cannot just say bye to your kids/family for the next ~8 hours and leave the house for work. Often, the workplace is the same room where you rest, eat, cultivate a hobby, and sleep. …


Introduction to the Tkinter.

Woman on the sofa with a laptop
Woman on the sofa with a laptop
Photo by Mimi Thian on Unsplash

Intro

Python is my favorite programming language. It is easy to get around, versatile, yet powerful. Python is a great choice for both beginners and experts. There are numerous reasons for using Python. In my opinion, one of the main reasons is an enormous amount of open-source Python libraries, packages, and frameworks.

There are many articles describing the advantages of Python. For example, as was mentioned by Mindfire Solutions in 7 Important Reasons Why You Should Use Python article: “You can use Python for developing complex scientific and numeric applications. Python is designed with features to facilitate data analysis and visualization.”

I am using Python for my research a lot. Some of the applications are scientific computing, statistics, and advanced visualization. But in my free time, I enjoy creating mini-applications for various reasons. Some of them solve a particular problem, others just for fun. For example, recently I wrote a mini-app to track my weight with Python. …


Explaining Regular Expressions (regex) plus a cheat sheet of useful rules

A laptop with a face mask.
A laptop with a face mask.
Photo by Guido Hofmann on Unsplash

Introduction

The rising second wave of COVID-19 makes me worried. Luckily, I can work from home and stay mostly indoors during these turbulent times. However, there are many people around the world who cannot do that. Especially, those who are living by earning from day-to-day services.

The pandemic hits everyone but some harder. While I have a chance, I want to do more, I want to do better.

In this situation, I ask myself “What can I do?” or “How can I help to fight the pandemic?”

Well, I can apply my knowledge of Python, programming, and data analysis to describe or create the tools, which others can use to get some insights into the coronavirus. For example, to help with the analysis of the COVID-19 data from the scientific papers. …


Redesign your thoughts to become rich.

A person in a suit standing near stairs.
A person in a suit standing near stairs.
Photo by Hunters Race on Unsplash

Everything in this world is a result of some cause. We might have heard it many times already. But there is a difference between hearing something and fully understanding it. In this article, I would like to share my understanding of our mind, how it keeps us broke throughout (most of) our life, and how we can break the cycle to become wealthier and happier.

We ourselves attract everything in our lives

It is probably, the harshest truth about life. We ourselves attract everything in our lives — every experience, and every event. Be it a good or bad experience. However difficult to admit it, that is true. We make poor choices and sabotage our success without realizing it. We are not manipulated by any higher forces to make poor choices, instead, we ourselves look for suffering and pain. …


Restore your relationships with yourself, people around you, and money (as a bonus).

A man in a suit standing with his arms open and looking up to bring the feeling of success.
A man in a suit standing with his arms open and looking up to bring the feeling of success.
Photo by Razvan Chisu on Unsplash

Many people want to be rich and wealthy. Money plays an important role in our lives and it is probably the reason why you started reading this article. But life itself is not limited to money. There is much more.

It is great to have enough earnings/income to not starve and have basic needs fulfilled. Sometimes it comes with its own price of doing a meaningless job. On the contrary, it happens that people who pursue their passion, for example, art, do not get enough income for a decent life and keep struggling. Even if one is getting enough money, and living a decent life, chances are one is not truly happy due to different issues in their relationships or other aspects of life. All these examples have one thing in common. …


You cannot improve what you cannot measure.

An open laptop with some programming code.
An open laptop with some programming code.
Photo by AltumCode on Unsplash

Some people want to gain weight while others want to lose it. I have been in the former group for as long as I can remember myself. Even after learning martial arts for about 10 years, my weight did not increase drastically. It made my body fitter and my mind stronger. But still, it was not enough to increase my Body Mass Index. I have always been in the lower limit of the “healthy” BMI range.

There might be many reasons for that. Maybe, my love for sweets and snacks (fast energy). Perhaps, my high metabolic rate. Maybe, something else. Or, most probably, everything altogether. …

About

Ruslan Brilenkov

Ph.D. candidate in Astrophysics | I write about everything I find fascinating.

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