Skip to content

Python

Sklearn Scikit-Learn One Hot Endoding Cover Image

One-Hot Encoding in Scikit-Learn with OneHotEncoder

In this tutorial, you’ll learn how to use the OneHotEncoder class in Scikit-Learn to one hot encode your categorical data in sklearn. One-hot encoding is a process by which categorical data (such as nominal data) are converted into numerical features

How to calculate MAE in Python Cover Image

How to Calculate Mean Absolute Error (MAE) in Python

In this tutorial, you’ll learn how to calculate the mean absolute error, or MAE, in Python. The mean absolute error can help measure the accuracy of a given machine learning model. The MAE can be a good complement or alternative to

Pandas to_datetime Convert a Column to Date Time Cover Image

Pandas to_datetime: Convert a Pandas String Column to Date Time

In this tutorial, you’ll learn how to use the Pandas to_datetime function to convert a Pandas column to date time. Pandas provides a huge number of methods and functions that make working with dates incredibly versatile. However, data aren’t always

Python Match Case Switch Statement Tutorial Cover Image

Python Switch (Match-Case) Statements: Complete Guide

In this tutorial, you’ll learn how to use Python to create a switch-case statement. Prior to Python version 3.10, Python did not have an official switch-case statement. In order to accomplish this, you had a number of different options, such

Python Decorators Cover Image

Python Decorators: How and Why to Use Python Decorators

In this tutorial, you’ll learn how to use Python decorators on a function. Python decorators are useful tools to help you modify the behavior of a function. Similarly, decorators allow you to embrace the Don’t Repeat Yourself (DRY) programming principles for

K Nearest Neighbor KNN in Python Scikit Learn Cover Image

K-Nearest Neighbor (KNN) Algorithm in Python

In this tutorial, you’ll learn how all you need to know about the K-Nearest Neighbor algorithm and how it works using Scikit-Learn in Python. The K-Nearest Neighbor algorithm in this tutorial will focus on classification problems, though many of the

How to Calculate MAPE in Python Cover Image

How to Calculate MAPE in Python

In this tutorial, you’ll learn how to use Python to calculate the MAPE, or the mean absolute percentage error. This error is often used to measure the accuracy of machine learning models. By the end of this tutorial, you’ll have

Hyper-Parameter Tuning in Scikit-Learn Sklearn GridSearchCV Cover Image

Hyper-parameter Tuning with GridSearchCV in Sklearn

In this tutorial, you’ll learn how to use GridSearchCV for hyper-parameter tuning in machine learning. In machine learning, you train models on a dataset and select the best performing model. One of the tools available to you in your search

NumPy Random Normal to Create Normal Distributions Cover Image

Numpy Normal (Gaussian) Distribution (Numpy Random Normal)

In this tutorial, you’ll learn how to use the Numpy random.normal function to create normal (or Gaussian) distributions. The functions provides you with tools that allow you create distributions with specific means and standard distributions. Additionally, you can create distributions

Manhattan Distance Python City Block Cover Image

Calculate Manhattan Distance in Python (City Block Distance)

In this tutorial, you’ll learn how to use Python to calculate the Manhattan distance. The Manhattan distance is often referred to as the city block distance or the taxi cab distance. The Manhattan distance can be a helpful measure when

Hamming Distance in Python SciPy Cover Image

Calculate Hamming Distance in Python (with Examples)

In this tutorial, you’ll learn how to calculate the hamming distance in Python, using step-by-step examples. In machine learning, the Hamming distance represents the sum of corresponding elements that differ between vectors. By the end of this tutorial, you’ll have

Python List Prepend Cover Image

Prepend to a Python a List (Append at beginning)

In this tutorial, you’ll learn how to use Python to prepend a list. While Python has a method to append values to the end of a list, there is no prepend method. By the end of this tutorial, you’ll have