KatInterview

Predictive Modeling for Wine Ratings from Chemical Properties

Machine LearningModel answer
MediumModel answerMachine Learningsupervised-learningfeature-engineeringmodel-evaluation

Last updated

Build and validate a model that predicts wine ratings from chemical measurements, choosing appropriate problem framing, metrics, and feature analysis methods.

Task: Predict Wine Ratings from Chemical Measurements

You have a structured dataset containing red wine samples. Each sample includes approximately 10 chemical measurements (all numeric) and a rating score.

Target variable:

  • quality: Rating score ranging from 1 to 7 (integer)

Input variables (chemical properties):

  • fixed_acidity (float)
  • volatile_acidity (float)
  • citric_acid (float)
  • residual_sugar (float)
  • chlorides (float)
  • free_sulfur_dioxide (float)
  • total_sulfur_dioxide (float)
  • density (float)
  • pH (float)
  • sulphates (float)
  • alcohol (float)

Assumptions:

  • The dataset contains no missing entries
  • Rows represent independent samples (verify this assumption during exploration)

Your Task

Address each of the following:

  1. Exploratory Analysis: Investigate the dataset structure and properties. Identify at least three specific observations (distribution patterns, relationships between variables, data quality issues, or target characteristics) and explain how each observation should influence your modeling decisions.

  2. Feature Assessment: Before building a model, determine which chemical properties are likely to be predictive of wine ratings. Describe at least two different analytical techniques you would use to assess predictiveness, and explain what each technique reveals.

  3. Model Development: Construct a predictive model. Your answer should clearly state:

    • How you frame the prediction problem (as regression, classification, or another formulation) and your reasoning
    • Your validation approach (splitting strategy or cross-validation design)
    • Which evaluation metrics you use and why they are appropriate
  4. Feature Interpretation: After training your model, how would you identify which chemical properties actually contribute to predictions? Describe a method suited to your chosen model type and discuss potential issues that could lead to incorrect conclusions (such as correlated features, data contamination, or artifacts of certain importance calculations).

Deliverable: Present your reasoning and methodology in a structured write-up. You may include code snippets or pseudocode (Python with pandas/scikit-learn) if helpful.

Hints

Hint 1

Check whether your data contains exact duplicate rows—this violates independence assumptions and can artificially inflate performance if splits aren't handled carefully.

Hint 2

The target distribution is likely imbalanced, with most samples concentrated in the middle rating values. This affects both metric selection and validation strategy.

Hint 3

Consider that rating scores have inherent ordering (a 6 is closer to a 5 than to a 3), which standard classification ignores but could be leveraged.