Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

Machine learning is a branch of computer science in which algorithms improve their performance by finding patterns in data. It matters because it powers tools such as recommendation systems, medical image analysis, speech recognition, fraud detection, and self-driving features. Instead of writing every rule by hand, engineers design a learning process that turns examples into a model that can make useful predictions on new cases.

A typical machine learning pipeline starts with data collection, cleaning, and feature selection, then moves through model training, evaluation, and deployment. Supervised learning uses labeled examples to learn mappings from inputs to known outputs, while unsupervised learning searches for structure in unlabeled data. Neural networks are models built from layers of connected units that transform inputs into increasingly abstract representations, making them powerful for images, language, and complex nonlinear patterns.

Key Facts

  • Supervised learning trains on labeled pairs (x, y) to learn a function f(x) ≈ y.
  • Classification predicts categories, such as spam or not spam, while regression predicts numerical values, such as house price.
  • Unsupervised learning finds patterns without labels, such as clusters, low-dimensional structure, or unusual outliers.
  • A common training objective is minimize loss: J(θ) = (1/n) Σ L(fθ(xi), yi).
  • Gradient descent updates parameters using θnew = θold - α∇J(θ), where α is the learning rate.
  • Model quality is tested on data not used for training so that performance estimates reflect generalization.

Vocabulary

Feature
A feature is an input variable or measurable property used by a machine learning model to make a prediction.
Label
A label is the known output value or category provided during supervised learning.
Training Set
A training set is the collection of examples used to fit the parameters of a model.
Loss Function
A loss function measures how far a model prediction is from the correct answer for a given task.
Neural Network
A neural network is a machine learning model made of layers of connected units that apply weighted sums and nonlinear activation functions.

Common Mistakes to Avoid

  • Training and testing on the same data: this is wrong because it can make a model look accurate even when it has only memorized the examples.
  • Using accuracy alone for imbalanced classification: this is wrong because a model can score high by mostly predicting the majority class while failing on important rare cases.
  • Confusing correlation with causation: this is wrong because machine learning often finds predictive associations that do not prove one variable causes another.
  • Ignoring data preprocessing: this is wrong because missing values, inconsistent units, outliers, and unscaled features can distort training and reduce model performance.

Practice Questions

  1. 1 A classifier is tested on 200 emails. It correctly labels 90 spam emails and 80 non-spam emails, but mislabels 20 spam emails and 10 non-spam emails. What is its accuracy?
  2. 2 A regression model predicts house prices of 250,000,250,000, 310,000, and 400,000forhomesthatactuallysellfor400,000 for homes that actually sell for 260,000, 300,000,and300,000, and 380,000. Compute the mean absolute error.
  3. 3 A model has very low training error but much higher test error. Explain what this suggests about the model and name two strategies that could improve its generalization.