Who Needs Strava Premium When You Have Python?

Who Needs Strava Premium When You Have Python?

If you haven’t already heard, Strava provide a powerful API that allows users to access their data using code. This gives us the ability to create interesting visualisations, analyse progress, and create custom trackers and planners, all with just a few lines of code.

In this tutorial, we’re going to walk through the process of building a heatmap to visualise all of your GPS routes on one map. It’ll show routes you travel frequently, adventures in the middle-of-nowhere, and everything in between. It’s a really cool way to see how much of an area you’ve explored, and find some new routes that connect places you’ve been.

Python Chess: Efficient Move Generation Using Bitwise Operations

Python Chess: Efficient Move Generation Using Bitwise Operations

This is part 2 in a series of articles documenting my process of building a chess engine. I hope to share insights from my previous experience, and explain some of the concepts and techniques I’ll be using. If you haven’t already read part 1, I’d strongly recommend taking a look before reading part 2. You can check it out at the link above.

Time to pick up where we left of…

Image Segmentation With K-Means Clustering

Image Segmentation With K-Means Clustering

Looking at the images above, we see an example of an image posterization filter that gives images a cartoon-like appearance, but behind the scenes, this filter is actually using a machine learning algorithm known as clustering.

Before exploring into how this process works and seeing how we can implement it in Python, let’s take a look at why we might want to do this in the first place.

1-Hot Encoding: The Chess Programmer’s Secret Weapon

1-Hot Encoding: The Chess Programmer’s Secret Weapon

This is not my first rodeo.

I’ve built a chess engine before, but the results were… let’s say… underwhelming.

Don’t get me wrong, the program worked; it was able to play a full game of chess, and for that, I give it credit. But let’s face it, it was terrible at chess.

It took minutes to produce a move, even at a low search depth. And then, the moves it would output were random and unpredictable: sometimes it would force you into a neat mate-in-3, other times it would sacrifice a rook and then lose the game entirely.

I recently decided it’s time for round 2, and I thought I’d document my journey and share some things I learn in the process. There are so many different problems that arise, and so many different approaches to solving them. Of all the programming rabbit holes I’ve gotten lost down, chess programming is definitely one of my favourites.

Solving the Travelling Salesman Problem Using a Genetic Algorithm

Solving the Travelling Salesman Problem Using a Genetic Algorithm

The Travelling Salesman Problem, TSP, describes a scenario where a salesman wishes to visit a number of cities, while taking the shortest possible route, before returning home to the start point. While it may appear simple, this problem not only has no known polynomial time solution, but there is also no time-efficient way to prove that a given solution is in fact optimal.

Why We Can’t (Completely) Solve The Travelling Salesman Problem

Why We Can’t (Completely) Solve The Travelling Salesman Problem

Imagine you want to travel around Europe. You want to see the sights, and visit as many European capital cities as possible, but you’re on a budget; flights can get expensive, so you plan to travel by rail and bus. To make your funds stretch as far as possible, you need to plan a route that will take you to all of the cities on your list for the cheapest price, before heading home again.

This is known as the Travelling Salesman Problem, and it’s a classic puzzle in computer science, operations research, and graph theory. While the problem itself may seem fairly straightforward, finding a solution proves deceptively challenging. Worse still, if you’ve found a solution that you think is the best, there is no quick or easy way to verify that it is in fact the optimal route.

Theory of Evolution

The Machine Learning Algorithm Inspired by Darwin

In the ever-expanding field of artificial intelligence, some of the most fascinating advancements come from mimicking the natural world. One such breakthrough is the Genetic Algorithm, a powerful machine learning technique inspired by Charles Darwin’s theory of natural selection. Just as organisms evolve over time, honing their adaptations to thrive in their environments, Genetic Algorithms evolve solutions to complex problems, becoming increasingly effective with each iteration.