ML Foundations
0/12Learn the minimum ML vocabulary needed to read modern AI systems work. You are not becoming an ML researcher; you are becoming fluent enough that nobody can bluff you.
This week exists to give you vocabulary, not skill. Everything after it — embeddings, RAG, agents, evaluation — is written in the language of machine learning, and without a week spent here you will spend twelve weeks nodding at words like overfitting and baseline without them meaning anything. The goal is fluency sufficient that nobody can bluff you, and then you move on.
The three families, and which one you are inSupervised learning means you have examples with correct answers attached — emails labelled spam or not, houses with their sale prices. The model learns the mapping from input to label. Unsupervised means no labels: you are looking for structure that was already there, such as clustering customers into groups nobody defined in advance. Reinforcement learning learns from a reward signal over a sequence of actions, and you will meet it only indirectly, as the RLHF stage that turns a raw language model into an assistant.
Almost everything commercially valuable is supervised, and the practical consequence is that the label is the bottleneck. Where the labels come from, how consistent they are, and how long they take to arrive will constrain your project more than any model choice.
Regression, classification, and the metric that followsRegression predicts a number — a price, a duration, a temperature — and is scored with errors like RMSE or MAE. Classification predicts a category, and is scored with precision, recall and their relatives. The reason this distinction matters immediately is that the task type determines the metric, and the metric determines what the model optimises for. Choose it carelessly and you will get exactly what you asked for rather than what you wanted.
Accuracy is the trap. On a dataset where 99% of transactions are legitimate, a model that predicts legitimate every single time is 99% accurate and completely worthless. Precision and recall separate the two questions that actually matter: of the things you flagged, how many were real; and of the real ones, how many did you catch.
Overfitting, and why you hold data backA model that has memorised its training data scores brilliantly on it and fails on anything new. That is overfitting, and it is why data is split three ways. The training set fits the model. The validation set is used to make choices — which model, which settings. The test set is touched once, at the end, to get an honest number; every time you look at it and change something in response, it becomes a little more like a validation set and a little less like a measurement.
The opposite failure, underfitting, is a model too simple to capture the pattern — bad on training data and bad on new data alike. Between them sits the bias-variance trade-off: simple models are consistently a bit wrong, complex models are wildly right and wildly wrong depending on the sample.
train fit the model's parameters
validation choose between models and settings
test touched ONCE, for the number you report
symptom diagnosis
train 0.98 / val 0.62 overfitting
train 0.61 / val 0.60 underfitting
train 0.91 / val 0.89 healthy
val 0.89 / test 0.71 you overfitted the VALIDATION set
(too many choices made against it)Before training anything, write down what a trivial approach scores: predict the mean, predict the majority class, predict yesterday's value, or use the heuristic the business already runs. This is the single most useful habit in the week. A model that scores 0.84 sounds good until the baseline scores 0.83, at which point you have spent three weeks for nothing — and you would not have known without the baseline.
The project for this week is deliberately small. Load one tabular dataset, establish a baseline, preprocess, train two models, compare on held-out data, and then do error analysis: pull the twenty worst predictions and write a paragraph on why they fail. That paragraph teaches more than the model does.
What it sets upWeek 2 moves from classical ML to the machinery inside a language model — neural networks, embeddings and attention. The vocabulary from this week is what makes that readable: you will meet loss, gradients and training splits again, applied to a very different scale of model.
Learn
- AI vs ML vs deep learning; supervised vs unsupervised; what “learning” actually means
- Features, labels, and the train / validation / test split — why the test set is touched once
- Regression vs classification, and the metrics that go with each (RMSE and MAE vs precision, recall, F1)
- Overfitting, underfitting and the bias–variance trade-off
- Cross-validation, and why evaluation data must never leak into training
- Baselines: why “predict the mean” or “predict the majority class” is the number to beat
Build — ML Prediction Notebook
Start hereuv init ml-notebook && uv add pandas scikit-learn matplotlib jupyter, then open one notebook: 01_model.ipynb. Use one dataset for the whole week.
- Pick one small tabular dataset; write down what a single row means before you model anything
- Pick a small, clean-ish CSV from Kaggle or UCI (Titanic, Adult Income, California Housing).
- Load it with
pd.read_csv, then look atdf.shape,df.head(),df.info()anddf.describe(). - In a markdown cell, write one sentence: 'One row is … and the target column is …'.
Done whenyou can say what one row is, and what the target is, without looking.
- Establish a dumb baseline and record its score — this is your floor
- Split first:
train_test_split(X, y, test_size=0.2, random_state=42, stratify=y)(dropstratifyfor regression). - Fit
DummyClassifier(strategy='most_frequent')orDummyRegressor(strategy='mean')on train. - Score it on the test split and write the number in a README table under 'baseline'.
Done whena baseline number is written down before any real model exists.
- Split first:
- Preprocess: missing values, categorical encoding, scaling where the model needs it
- List columns by type: numeric, categorical, and anything to drop (IDs, free text).
- Build a
ColumnTransformer:SimpleImputer+StandardScalerfor numbers,SimpleImputer+OneHotEncoder(handle_unknown='ignore')for categories. - Wrap it in a
Pipelinewith the model, so it is fitted on train only.
Done when
pipe.fit(X_train, y_train)runs with no errors and no manual preprocessing outside the pipeline. - Train two models and compare them on held-out data, never on training data
- Model 1:
LogisticRegression(orLinearRegression). Model 2:RandomForestorHistGradientBoosting. - Compare them with
cross_val_score(pipe, X_train, y_train, cv=5)and pick the better one. - Score only the winner on the test set, once, and add it to the README table next to the baseline.
Done whenthe table shows baseline vs model 1 vs model 2, and the test set was used once.
- Model 1:
- Error analysis: pull the twenty worst predictions and write a paragraph on why they fail
- Predict on the test set and put the predictions next to the true values in a DataFrame.
- Sort by error (absolute error, or the confidence of wrong predictions) and take the top 20.
- Look for a pattern (a segment, missing values, rare categories) and write one paragraph about it.
Done whenyou can name one concrete reason the model fails, backed by examples.
The notebook runs top to bottom on a fresh kernel, and the README states the baseline, the final metric, and one sentence on what the model still gets wrong.
Explain training vs testing, overfitting, and how you would know your model is any good — without writing a single formula.
The trap this week is completeness. Do not implement every classical algorithm. Stop the moment the end-to-end lifecycle is clear and move on.
ReferencesCampusX — 100 Days of Machine LearningDeepLearning.AI — ML Specializationscikit-learn — model evaluation
Attached files live in this browser’s storage for this origin only. Export saves the log, not the files — keep the real copy in the repository you linked above.