All cheat sheets
Part 2 cheat sheet: data
Most of the work in a real project is data. This is the short list.
1Data, features and labels
- A row is one example. Features are the columns the model reads; the label is the column you want to predict.
- Only use features you will really have at prediction time.
Learn more: Data basics: types, features, labels and splits
2The three sets
- Training set: the model learns from it.
- Validation set: compare ideas and settings.
- Test set: open once, at the end, like a final exam.
- Split before any training, and for data over time split by time.
Learn more: Data basics: types, features, labels and splits
Practice questions, a mock exam, then one final exam. The split is made before any training, and the test set is never used for tuning.
3Four kinds of mess
- Missing values, duplicates, messy categories, and invalid values or outliers.
- Look at the data first (charts and summaries), then clean with a script you keep.
- Mean and median can differ a lot when there are outliers.
Learn more: Cleaning and exploring data
Missing values, duplicates, inconsistent categories and invalid values are the four kinds of mess to find and fix before training.
4Collecting and labelling
- Label with a written guide, let two people label the same items, and measure how often they agree.
- SQL is the everyday tool for pulling rows from a database.
Learn more: Collecting and labelling data, with SQL
5Features from raw data
- Turn text categories into numbers (one-hot: one 0/1 column per category).
- Scale numbers when columns have very different sizes.
- Fit encoders and scalers on training data only, then apply them everywhere.
Learn more: Feature engineering: turning raw data into model inputs
One text column becomes one yes/no column per plan, so the model does not treat pro as bigger than basic.