liveBook · Manning

Preprocessing

As explained in Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI

Data preprocessing is the transformation and preparation of raw data before it is supplied to a machine learning model.

Preprocessing transforms raw, unevenly organized data into a usable dataset for machine learning. Begin by locating the target output, then identify the predictors that will be mapped to it. Because data preparation and pipelining often consume substantial effort, understanding the data scheme and combining stored data correctly are central parts of the work. section 2.3

A practical preprocessing workflow includes:

  • Inspect columns and distributions to distinguish numeric-looking data from genuinely numeric features. section 9.1
  • Use unique-value counts as a useful indication of categorical or continuous features, while investigating ambiguous columns rather than applying the rule mechanically. section 9.1
  • Measure dataset dimensions and missing values before cleanup, then address columns according to their specific data problems. section 9.1 section 9.2
  • Initially clean the complete feature set when practical, because examining all available columns can reveal invalid values and preserve data for later projects. section 9.2

Kuala Lumpur real estate data

A real estate dataset contains 53,883 rows and eight columns. Location, Property Type, and Furnishing appear categorical; Price, Bathrooms, Car Parks, and Size appear continuous; Rooms requires further investigation. Although Price, Rooms, and Size contain values that look numeric, descriptive statistics show that only Bathrooms and Car Parks are numeric until those fields are processed. Missing values also require attention: Car Parks has 17,567 missing entries, Furnishing 6,930, and Bathrooms 2,013. section 9.1 section 9.2

Listing 9.1 Getting the count of unique values in each column
counts = df.nunique()                                  #1
print("unique value counts:\n",counts)

Inspect unique-value counts with a compact DataFrame operation, then compare the counts across columns to investigate likely feature types. section 9.1

How Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI covers it

How deep it goes
Provides a worked inspection and cleanup workflow, stopping short of specifying final transformations for every problematic column.
Examples
Uses a Kuala Lumpur real estate dataset, DataFrame statistics, unique-value counts, dimensions, and missing-value reports.
What it assumes
Assumes a machine-learning problem with target outputs and predictors, while teaching dataset organization and cleanup decisions.
What you can do after
Apply DataFrame inspection to classify features, quantify missing data, and prioritize column cleanup before training.
How it connects
Connects targets, predictors, data pipelines, feature types, missing values, and model training.

Also explained in

Compare how 22 books explain preprocessing →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI. The section links point to the parts of the book it draws on.