Inkhmer LogoInKhmerBuilding the digital future
  • About
  • Projects
  • Blog
  • Tools
  • Learn
  • Contact
KMខ្មែរENEnglish

InKhmer.com — a personal Khmer Digital Hub curated by our team. Tools, Cambodia resources, Khmer culture, and digital projects. Practical, approachable, and built for everyone.

Social

FacebookTelegram

Quick Links

  • About
  • Projects
  • Blog
  • Tools
  • Learn
  • Contact

Explore

  • What We Build
  • How We Build
  • Roadmap
  • Experiments
  • Sitemap

Subscribe to our newsletter

Get the latest updates about Cambodia, new tools, and exclusive content delivered to your inbox.

  • Terms of Service
  • Privacy Policy
  • Cookie Policy

© 2026 InKhmer. All rights reserved.

LearnMachine Learning FoundationsA line through the data: linear regression

A line through the data: linear regression

Linear regression is the first model worth learning because it is simple and explainable. The idea is easy: draw one straight line through the data points so the total error is smallest.

Picture Cambodia's GDP-per-capita data from the World Bank: the x axis is the year, the y axis is GDP. A straight line y = a·x + b has two numbers: a, the slope, tells how much GDP grows per year, and b is the intercept. Training means finding the a and b that minimise the sum of squared errors — the least squares method.

The full form handles many features: y = a₁·x₁ + a₂·x₂ + … + b. For example: house price ≈ a₁·size + a₂·rooms + a₃·distance-to-market + b. Each a tells how much that feature contributes while the others stay fixed.

A key rule: correlation is not causation. If ice-cream sales and sea-bathing numbers rise together in the hot season, ice cream did not cause the swimming — the weather caused both. A straight-line model only sees correlation.

What to remember:

  • Linear regression = the straight line that minimises squared error
  • a = how much y changes when x rises by one unit
  • Use it as a baseline before trying more complex models

Sign in to start tracking from this lesson