Kickoff: Overview of the Wine Quality Dataset

Welcome to our next course, Introduction to Supervised Machine Learning, a plunge into the intriguing world of Supervised Machine Learning seasoned with a savory twist. Throughout this journey, your senses will be filled with a balanced mix of theory, hands-on exercises, and real-world case studies as we strive to perfect the coveted technique of predicting wine quality.

In this first lesson of the course, you will explore the renowned Wine Quality dataset. This dataset, sourced from the UCI Machine Learning Repository, provides information about various wines and their quality ratings.

A thorough understanding of your dataset is essential before developing machine learning models. A comprehensive dataset review empowers us to identify potential features that can significantly influence output variables. This process is akin to familiarizing oneself with a novel's characters before delving into the plot; possessing nuanced knowledge of the dataset makes the subsequent modeling phase more coherent.

In the spirit of curiosity, the Wine Quality dataset paves the way for us to explore a real-world problem: determining wine quality based on its physicochemical characteristics. As budding machine learning practitioners, this experience enlivens our learning journey by engaging us in practical applications within an accessible context. So, shall we make a toast to learning and dive right in?

Meet the Dataset: Wine Quality Dataset

As the name suggests, the Wine Quality dataset encompasses data on wines, specifically, the physicochemical properties of red and white variants of Portuguese "Vinho Verde" wine. The dataset consists of 12 variables, inclusive of quality — the target variable. Here's a quick summary of key columns:

  • fixed acidity
  • volatile acidity
  • citric acid
  • residual sugar
  • chlorides
  • free sulfur dioxide
  • total sulfur dioxide
  • density
  • pH
  • sulphates
  • alcohol
  • quality (score between 0 and 10)

Now, let's learn how to load the dataset. As referred to in the course brief, we'll employ the datasets Python library, which conveniently facilitates the loading of various datasets. This specific dataset is already available in the CodeSignal environment.

Python
import datasets
import pandas as pd

# Loading Dataset
red_wine = datasets.load_dataset('codesignal/wine-quality', split='red')
white_wine = datasets.load_dataset('codesignal/wine-quality', split='white')
red_wine = pd.DataFrame(red_wine)
white_wine = pd.DataFrame(white_wine)

# Checking the shape of the dataset
print("Red Wine Dataset Shape: ", red_wine.shape) # Red Wine Dataset Shape:  (1599, 12)
print("White Wine Dataset Shape: ", white_wine.shape) # White Wine Dataset Shape:  (4898, 12)

In the snippet above, we load the red and white wine datasets separately and subsequently display their respective sizes as an output of the shape function.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal