Skip to main content
Machine learning, neural networks, LLMs, retrieval-augmented generation, model serving, and the systems engineering behind production AI.

Artificial Intelligence

Machine learning, neural networks, LLMs, retrieval-augmented generation, model serving, and the systems engineering behind production AI.

Machine Learning Fundamentals

What Machine Learning Means

Machine learning is the discipline of writing programs that improve with data instead of explicit rules. Instead of hand-coding “if the transaction is over $500 and from an unknown country, flag it”, you hand the model thousands of labeled examples and let it learn the boundary.

The same loop that powers every AI system applies here:

  1. Choose a model family (linear, tree, neural network).
  2. Feed it features — the measurable inputs.
  3. Train it to minimize error against labels.
  4. Evaluate on data it has never seen.
  5. Ship it, monitor it, and retrain when reality drifts.

Features and Labels

A feature is a measurable property of an example: an email’s word count, a user’s age, a sensor reading. A label is the answer you’re trying to predict: spam / not-spam, price, churn / stay.

RowFeature: time on pageFeature: pages visitedLabel: converted?
142s3Yes
28s1No
3120s7Yes

Each row is one example; the columns you feed the model are the feature vector; the last column is the ground truth used during training.

Supervised vs Unsupervised

SettingWhat you haveTypical task
SupervisedFeatures and labelsClassification, regression
UnsupervisedFeatures onlyClustering, anomaly detection
Self-supervisedUnlabeled text/imagesLearning representations (what powers LLMs)

Supervised learning is where most practical ML starts. Unsupervised learning is useful when labeling is too expensive — grouping customers, finding unusual network traffic, discovering topic structure in documents.

Train / Validation / Test

You never evaluate a model on the data it trained on — it memorizes, not learns. Split the data:

  • Training set — the model optimizes its parameters here.
  • Validation set — tune hyper-parameters and pick between model versions.
  • Test set — a single, final, untouched measurement of real-world performance.

The test set is sacred. Every time you look at it and change the model, it leaks into your decisions, and your accuracy number stops meaning what it claims.

The Overfitting Trap

Overfitting is memorizing the training set instead of learning the underlying pattern — great training accuracy, terrible test accuracy. Symptoms and cures:

SymptomCauseCure
Train 99%, test 60%Model too complex for the dataFewer features, more regularization, more data
Great on old data, bad on newConcept driftRetraining cadence, drift monitoring
Test set improved after tuningTest leakageFresh holdout, fewer test-set peeks

Underfitting is the opposite: the model is too simple and can’t capture the pattern — both train and test are bad. You add capacity, not remove it.

Metrics Beyond Accuracy

Accuracy lies on imbalanced data. If 99% of transactions are legit and the model predicts “legit” for everything, accuracy is 99% and the model is useless.

  • Precision — of the things you flagged, how many were right?
  • Recall — of the things you should have flagged, how many did you catch?
  • F1 — the harmonic mean, useful when you care about both.

Choose the metric that matches the cost of the mistake. False alarms cost support time; missed fraud costs real money.

Practice Trajectory

  1. Take a small dataset (e.g. Titanic or a CSV you own) and identify features, label, and task type.
  2. Hand-split it into train/validation/test and explain why the split matters.
  3. Train a trivial “always predict majority” baseline and compare any model to it.
  4. Describe a case where accuracy is the wrong metric and precision/recall are better.
  5. Explain the difference between overfitting and underfitting in one sentence each.