Preprocessing for Machine Learning in Python
Prepare data for machine learning in Python: handle missing values, scale features, encode categories and text, and select features with PCA.
Preprocessing for machine learning is the work done after a dataset is imported and cleaned but before a model is fitted: getting columns into the types, scales and shapes a model expects. The Python lessons deal with missing values, features on uneven scales, categorical and text columns, and datasets that carry more features than a model needs. Some exercises compare a model’s results on scaled and non-scaled data.
What You Will Achieve
- Clean up gaps and wrong types in a dataset, then split it into stratified training and test sets
- Decide when to log-normalize or scale features and compare the effect on a model’s results
- Turn categorical, date and free-text columns into numeric inputs a model can use
- Cut a dataset down by dropping correlated columns and applying PCA before training a model
Program Overview
Missing Data, Data Types, and Standardization
Opens with handling missing data and column types, then shows when standardizing features helps a model that assumes a certain scale or distribution.
- Missing values and converting column types
- Training and test sets, class imbalance and stratified sampling
- Log normalization, variance checks and feature scaling
- KNN results on scaled and non-scaled data
Feature Engineering and Feature Selection
Covers creating new features from numerical, datetime and text columns, then trimming a dataset down to the features that matter for modeling.
- Binary and one-hot encoding of categorical variables
- Aggregated numbers, datetime components and string patterns
- Text vectorizing with tf/idf and a Naive Bayes classifier
- Redundant and correlated features, dimensionality reduction with PCA
Preprocessing the UFO Sightings Dataset
Applies the earlier techniques in sequence to a dataset of UFO sightings, ending with feature selection and modeling.
- Column types and missing data
- Number extraction, date features and text vectorization
- Choosing the final dataset and modeling it
Certificate Awarded (Paid)
Job Outlook
These preparation steps come before modeling in machine learning and data science work, wherever tabular or text data has to be made ready for classification models built in Python.
Good for: Learners who already build models in Python and want a repeatable routine for preparing tabular and text data before training.
Keep in mind: Despite the intermediate label, the course is pitched as advanced: the exercises assume prior supervised learning experience and that you can already train and evaluate a model.
Bottom line: The closing chapter runs every technique on one UFO sightings dataset, which ties the separate exercises into a single preprocessing workflow.
Frequently Asked Questions
What happens in the UFO sightings chapter?
You prepare a dataset of UFO sightings step by step: checking column types, dropping missing data, extracting numbers from strings, building date features, vectorizing text, then selecting features and modeling the result. It repeats the earlier chapters' techniques on one set of data.
Which models appear in the exercises?
The exercises compare a KNN model on scaled and non-scaled data, train a Naive Bayes classifier on tf/idf text vectors after feature selection, and fit a model on data reduced with principal component analysis.
Does the course deal with imbalanced classes?
Yes. The first chapter looks at class imbalance when splitting data into training and test sets, and it shows stratified sampling as a way to keep class proportions consistent across both sets.
Why does standardization matter for some models?
A model often makes assumptions about the scale or distribution of its features. The standardization chapter shows how log normalization and scaling bring data in line with those assumptions, and the KNN exercises show the difference in results.


There are no reviews yet.