Machine Learning Starter · free course

Free course · Lesson 1 of 5

What is Machine Learning? & Types of Learning

In this lesson you will

  • Explain what machine learning is
  • Distinguish supervised and unsupervised learning

Machine Learning (ML) is a subset of Artificial Intelligence where computers learn patterns from data without being explicitly programmed with rules. Instead of telling a computer "if x > 5, do y," you show it thousands of examples and let it figure out the rules on its own.

  • Supervised Learning: The model learns from labeled data — inputs with known correct outputs. Example: predicting house prices from features like size and location.
  • Unsupervised Learning: The model finds hidden patterns in data without labels. Example: grouping customers by purchasing behavior (clustering).
  • Reinforcement Learning: The model learns by trial and error, receiving rewards or penalties. Example: AI playing chess or a robot learning to walk.
  • The key to ML success: quality data. Garbage in = garbage out.

💡 Practical Skill: Start by looking at everyday ML: YouTube recommendations (unsupervised clustering), spam filters (supervised classification), and Google Maps traffic predictions. Ask: "What data is this model using?"

Worked exampleSupervised vs Unsupervised in Python

Python (Simulation)

Python
# Simulating two types of machine learning def supervised_learning_example():    """    Supervised: we have labeled data (known answers).    We "train" by memorizing the answers.    """    print("=== Supervised Learning ===")    # Training data: [size_sqft, bedrooms] => price    training_data = [        ([800, 2], 45000),        ([1200, 3], 75000),        ([1500, 3], 95000),        ([2000, 4], 130000),    ]        # Simple rule: price per sqft * rooms factor    def predict_price(size, bedrooms):        base_price = size * 55  # $55 per sqft        bedroom_bonus = bedrooms * 3000        return base_price + bedroom_bonus        print("Training examples:")    for features, label in training_data:        pred = predict_price(features[0], features[1])        print(f"  Size: {features[0]}, Bedrooms: {features[1]} => Actual: ${label}, Predicted: ${int(pred)}")        new_house = [1000, 2]    pred = predict_price(new_house[0], new_house[1])    print(f"\nPredicting new house (1000 sqft, 2 beds): ${int(pred)}") def unsupervised_learning_example():    """    Unsupervised: no labels — we find groups in the data.    """    print("\n=== Unsupervised Learning (Clustering) ===")    customers = [        {"name": "Alice", "age": 25, "spending": 120},        {"name": "Bob", "age": 45, "spending": 450},        {"name": "Charlie", "age": 30, "spending": 100},        {"name": "Diana", "age": 50, "spending": 500},        {"name": "Eve", "age": 22, "spending": 80},    ]        # Simple clustering by spending threshold    high_spenders = [c for c in customers if c["spending"] > 300]    low_spenders = [c for c in customers if c["spending"] <= 300]        print("Cluster 1 — High Spenders:")    for c in high_spenders:        print(f"  {c['name']} (Spending: ${c['spending']})")        print("Cluster 2 — Low Spenders:")    for c in low_spenders:        print(f"  {c['name']} (Spending: ${c['spending']})") supervised_learning_example()unsupervised_learning_example()

Practice exercise

List five decisions in your community and say for each whether it is a regression, classification or clustering problem — or not an ML problem at all.

Key takeaways

  • ML learns patterns from examples instead of following written rules
  • Regression predicts numbers; classification predicts categories
  • Many problems do not need ML
In the full program Module 1: Machine Learning Foundations See how this topic is taught in depth, with practical activities and an assessment.

Free self-study lesson — no certificate. For the full instructor-led program, see registration options.