CODE PATH
PRO ACCOUNT

Master Code
On The Go

Learn. Practice. Build.

Quest 1 • Lesson 2

📊 Machine Learning Basics

Machine Learning (ML) is a subset of AI where computers learn from data without being explicitly programmed. There are three main types.

"The choice of ML type depends on your data and what you want to predict."
🏷️

Supervised Learning

Learn from labeled data (input → output). Examples: spam detection, house price prediction.

🔍

Unsupervised Learning

Find patterns in unlabeled data. Examples: customer segmentation, anomaly detection.

🎮

Reinforcement Learning

Learn by trial and error, receiving rewards. Examples: game AI, robotics.

📈 Live Demo: Linear Regression (Supervised Learning)

We'll train a model to predict house prices based on size (sq ft). The blue dots are training data. After training, the red line shows the learned relationship.

Click "Train Model" to start learning.
📘 How it works (TensorFlow.js linear regression)
// Create a simple linear model: y = mx + b
const model = tf.sequential();
model.add(tf.layers.dense({units: 1, inputShape: [1]}));
model.compile({optimizer: 'sgd', loss: 'meanSquaredError'});

// Training data: house size (sq ft) → price (in $1000)
const xs = tf.tensor2d([800, 1000, 1200, 1500, 1800, 2000], [6,1]);
const ys = tf.tensor2d([150, 190, 220, 280, 330, 360], [6,1]);

await model.fit(xs, ys, {epochs: 250});

✨ Challenge: Add More Data

Extend the training data with two new points: (2200 sq ft → $400k) and (2500 sq ft → $450k). Retrain and see how the line changes.

❤️ Support Free Education

This course is 100% free. If it helps you, consider buying me a coffee.

☕ Buy Me a Coffee

➡️ Ready for more?

Next lesson: Neural Networks & Deep Learning – visualise how neurons work.

Continue to Lesson 1.3 →

(Coming soon – check back or buy Pro Pack for instant access)