Machine Learning (ML)

Build models that learn from data for prediction, classification, and decision-making.

Level: Beginner–Advanced Beginner: 2 months β€’ Intermediate: 3 months β€’ Advanced: 6 months Contact for pricing

Prerequisites

No prior experience required β€” open to beginners.

Certificate

Awarded by Rescue Academy on successful completion of the program's assessments and final project.

Learn Online β€” Live Classes

Register, receive your schedule, and join live instructor-led Machine Learning (ML) classes on Zoom. Assignments, instructor feedback, and a certificate on completion.

Learn In Person

Attend Machine Learning (ML) classes in person in Juba with hands-on labs, instructor mentorship, and a certificate on completion.

What You'll Learn

  • Supervised vs unsupervised learning
  • Training/testing split and evaluation metrics
  • Common models: linear regression, decision trees
  • Overfitting, underfitting, and model selection
  • Practical workflow: clean data β†’ train β†’ evaluate

Curriculum

Beginner

Full lessons available below

Module 1: What is Machine Learning? & Types of Learning

Learning objectives

  • Distinguish supervised, unsupervised, and reinforcement learning

Lessons

  • Supervised vs Unsupervised Learning
  • Where ML Fits Within AI

Module 2: The Machine Learning Workflow

Learning objectives

  • Follow the standard ML project workflow

Lessons

  • Data Collection & Preparation
  • Training, Validation & Testing

Module 3: Key ML Algorithms & When to Use Them

Learning objectives

  • Choose an appropriate algorithm for a task

Lessons

  • Regression & Classification Algorithms
  • Choosing the Right Algorithm

Module 4: Model Evaluation & Avoiding Overfitting

Learning objectives

  • Evaluate models and recognize overfitting

Lessons

  • Accuracy, Precision & Recall
  • Overfitting & How to Avoid It

Module 5: Real-World ML: Ethics, Data Quality & Deployment

Learning objectives

  • Apply ML responsibly in practice

Lessons

  • Data Quality Issues
  • Ethics & Basic Deployment Concepts

Intermediate

Outline β€” full lessons coming soon

Module 1: Feature Engineering

Learning objectives

  • Prepare features that improve model performance

Lessons

  • Feature Selection Basics
  • Handling Missing Data

Module 2: Working with Scikit-learn

Learning objectives

  • Build and evaluate models with scikit-learn

Lessons

  • Training a Model in Scikit-learn
  • Cross-Validation

Module 3: Unsupervised Learning in Practice

Learning objectives

  • Apply clustering to a real dataset

Lessons

  • Clustering Algorithms
  • Interpreting Clusters

Module 4: Model Tuning

Learning objectives

  • Improve a model's performance systematically

Lessons

  • Hyperparameter Tuning
  • Comparing Model Versions

Module 5: Intermediate Project

Learning objectives

  • Train and evaluate a model on a real dataset

Lessons

  • Planning an ML Project
  • Train, Evaluate & Present

Advanced

Outline β€” full lessons coming soon

Module 1: Ensemble Methods

Learning objectives

  • Combine models for better performance

Lessons

  • Bagging & Boosting
  • Random Forests & Gradient Boosting

Module 2: Working with Larger Datasets

Learning objectives

  • Handle data that doesn't fit basic workflows

Lessons

  • Data Pipelines
  • Working with Imbalanced Data

Module 3: Model Deployment Basics

Learning objectives

  • Move a trained model toward production use

Lessons

  • Saving & Loading Models
  • Serving a Model via a Simple API

Module 4: ML Ethics & Governance

Learning objectives

  • Apply responsible ML practices at scale

Lessons

  • Fairness & Bias Auditing
  • Monitoring Models Over Time

Module 5: Capstone Project

Learning objectives

  • Build and deploy a complete ML solution

Lessons

  • Planning the Capstone
  • Train, Deploy & Present

Full Lessons β€” Beginner Level

1. What is Machine Learning? & Types of 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?"

Try it Yourself β€” Supervised vs Unsupervised in Python

Python (Simulation)

# 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()

2. The Machine Learning Workflow

Building an ML model follows a standard workflow. Understanding this process is more important than memorizing algorithms β€” because real-world ML is mostly about data preparation and evaluation, not just writing code.

  1. Define the Problem: What are you trying to predict? Is it a category (classification) or a number (regression)?
  2. Collect & Prepare Data: Gather data, handle missing values, remove errors, and split into training (80%) and testing (20%) sets.
  3. Choose & Train a Model: Pick an algorithm (e.g., Linear Regression, Decision Tree), feed it the training data.
  4. Evaluate the Model: Test on the unseen testing data. Measure accuracy (classification) or error (regression).
  5. Deploy & Monitor: Use the model on new data. Monitor its performance over time β€” models can "drift" as data changes.

πŸ’‘ Practical Skill: The training/testing split is critical. If you test on the same data you trained on, you'll get misleadingly high accuracy (this is called overfitting). Always hold out a test set!

Try it Yourself β€” Train/Test Split & Simple Model (scikit-learn)

# Complete ML workflow using scikit-learn
# Install: pip install scikit-learn matplotlib

import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeRegressor
from sklearn.metrics import mean_absolute_error

# Step 1: Create a synthetic dataset
# Feature: hours_studied => Target: exam_score
np.random.seed(42)
hours = np.random.uniform(1, 20, 100).reshape(-1, 1)
scores = hours.flatten() * 4.5 + np.random.normal(0, 8, 100)

# Step 2: Split into training (80%) and testing (20%)
X_train, X_test, y_train, y_test = train_test_split(
    hours, scores, test_size=0.2, random_state=42
)

print(f"Training samples: {len(X_train)}, Testing samples: {len(X_test)}")

# Step 3: Train a Decision Tree model
model = DecisionTreeRegressor(max_depth=4)
model.fit(X_train, y_train)

# Step 4: Evaluate on test data
predictions = model.predict(X_test)
error = mean_absolute_error(y_test, predictions)
print(f"Mean Absolute Error on test set: {error:.1f} points")

# Step 5: Make a prediction for a new student
new_student = np.array([[12]])  # studied 12 hours
predicted_score = model.predict(new_student)[0]
print(f"Predicted score for 12 hours of study: {predicted_score:.1f}%")

# Compare: a rule-based estimate (simple linear)
simple_pred = 12 * 4.5 + 40  # baseline
print(f"Simple baseline estimate: {simple_pred:.1f}%")

3. Key ML Algorithms & When to Use Them

Different problems call for different algorithms. Here are the most common ones you'll encounter as a beginner. The key is knowing which algorithm to apply based on your data and your goal.

  • Linear Regression: Predicts a continuous number (e.g., house price, temperature). Simple and interpretable β€” you can see exactly which features matter most.
  • Decision Trees: Works for both classification (spam/not spam) and regression (price prediction). Easy to understand β€” like a flowchart of if/else questions.
  • K-Nearest Neighbors (KNN): Classifies based on the "votes" of the K closest data points. Good for small datasets with clear clusters.
  • K-Means Clustering: Unsupervised β€” groups data into K clusters based on similarity. Used for customer segmentation and pattern discovery.

πŸ’‘ Practical Skill: Start with Decision Trees β€” they are easy to understand, require little data preprocessing, and work on both classification and regression problems. Use scikit-learn's DecisionTreeClassifier or DecisionTreeRegressor.

Try it Yourself β€” Decision Tree Classifier (Iris Dataset)

# Classic Iris flower classification using a Decision Tree
# Install: pip install scikit-learn

from sklearn.datasets import load_iris
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
import numpy as np

# Load the famous Iris dataset
iris = load_iris()
X = iris.data  # Features: sepal length, sepal width, petal length, petal width
y = iris.target  # Labels: 0=setosa, 1=versicolor, 2=virginica

# Split the data
X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.3, random_state=42
)

# Train a Decision Tree
tree = DecisionTreeClassifier(max_depth=3, random_state=42)
tree.fit(X_train, y_train)

# Evaluate
predictions = tree.predict(X_test)
accuracy = accuracy_score(y_test, predictions)
print(f"Model Accuracy: {accuracy * 100:.1f}%")
print(f"Tested on {len(X_test)} flowers")

# Predict a new flower
# Example: [5.1, 3.5, 1.4, 0.2] -> should be setosa (0)
new_flower = np.array([[5.1, 3.5, 1.4, 0.2]])
pred = tree.predict(new_flower)[0]
species = iris.target_names[pred]
print(f"\nNew flower prediction: {species}")

# List feature importance
for name, importance in zip(iris.feature_names, tree.feature_importances_):
    if importance > 0:
        print(f"  {name}: importance = {importance:.3f}")

4. Model Evaluation & Avoiding Overfitting

A model that performs perfectly on training data but poorly on new data is overfitting. It has memorized the training examples instead of learning the general pattern. This is one of the most common mistakes in ML. The solution: cross-validation and regularization.

  • Overfitting: Model is too complex β€” it fits the noise in the training data. Symptoms: near-perfect training accuracy, poor test accuracy.
  • Underfitting: Model is too simple β€” it fails to capture patterns even in the training data.
  • Cross-Validation: Split data into K "folds," train on K-1 folds, test on the remaining fold. Repeat K times. This gives a more reliable estimate of model performance.
  • Regularization: Penalize model complexity to prevent overfitting (e.g., max_depth in Decision Trees, C in SVM).

πŸ’‘ Practical Skill: Always compare training accuracy with test accuracy. If training is much higher, you are overfitting. Use train_test_split with random_state for reproducible results, and start with a simple model before trying complex ones.

Try it Yourself β€” Detecting Overfitting

# Demonstrate overfitting vs good fit
# Install: pip install scikit-learn

import numpy as np
from sklearn.tree import DecisionTreeRegressor
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error

# Create synthetic data with noise
np.random.seed(42)
X = np.linspace(0, 10, 50).reshape(-1, 1)
y = np.sin(X).flatten() + np.random.normal(0, 0.3, 50)

# Split
X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.3, random_state=42
)

# Overfitted model (no depth limit β€” learns all the noise)
overfit_model = DecisionTreeRegressor(max_depth=None)
overfit_model.fit(X_train, y_train)
train_pred = overfit_model.predict(X_train)
test_pred = overfit_model.predict(X_test)

print("=== Overfitted Model (max_depth=None) ===")
print(f"Training error: {mean_squared_error(y_train, train_pred):.4f}")
print(f"Test error:     {mean_squared_error(y_test, test_pred):.4f}")
print("Training is much lower β€” model memorized the training data!")

# Good model (limited depth β€” learns general pattern)
good_model = DecisionTreeRegressor(max_depth=3)
good_model.fit(X_train, y_train)
train_pred2 = good_model.predict(X_train)
test_pred2 = good_model.predict(X_test)

print("\n=== Good Model (max_depth=3) ===")
print(f"Training error: {mean_squared_error(y_train, train_pred2):.4f}")
print(f"Test error:     {mean_squared_error(y_test, test_pred2):.4f}")
print("Both errors are close β€” model generalizes well!")

# Rule of thumb
print(f"\nOverfit ratio: {mean_squared_error(y_test, test_pred) / mean_squared_error(y_train, train_pred):.1f}x")
print("If this ratio is > 2x, you are overfitting.")

5. Real-World ML: Ethics, Data Quality & Deployment

ML is powerful, but it comes with responsibilities. Data quality determines model quality β€” if your training data is biased, incomplete, or outdated, your model will be too. Ethical ML means ensuring your models are fair, transparent, and accountable.

  • Data quality: Check for missing values, duplicate records, and outliers. Clean data = better predictions. The old saying applies: "garbage in, garbage out."
  • Bias in ML: A hiring model trained on historical data where most hires were men will "learn" to prefer men. Always audit your training data for representativeness.
  • Model interpretability: Can you explain why your model made a certain prediction? Decision Trees are interpretable; deep neural networks are not. For sensitive domains (healthcare, criminal justice), use interpretable models.
  • Deployment: Save trained models with joblib or pickle. Load them in production to make predictions without retraining. Monitor for "model drift" β€” when real-world data changes over time.

πŸ’‘ Practical Skill: Before deploying any ML model, ask: "Who could be harmed if this model makes a mistake?" and "Is my training data representative of the people this model will affect?" Use IBM AI Fairness 360 or Google's What-If Tool to audit your models for bias.

Try it Yourself β€” Data Quality Check & Saving a Model

# Data quality check + save/load a trained model
# Install: pip install scikit-learn joblib

import numpy as np
from sklearn.tree import DecisionTreeClassifier
import joblib  # for saving/loading models

# Simulate a dataset with quality issues
data = [
    {"math": 85, "english": 78, "passed": 1},
    {"math": 92, "english": 88, "passed": 1},
    {"math": None, "english": 65, "passed": 0},  # Missing value!
    {"math": 45, "english": 50, "passed": 0},
    {"math": 70, "english": None, "passed": 1},  # Missing value!
    {"math": 95, "english": 92, "passed": 1},
    {"math": 30, "english": 40, "passed": 0},
    {"math": 88, "english": 85, "passed": 1},
]

print("=== Data Quality Check ===")
missing_math = sum(1 for d in data if d["math"] is None)
missing_english = sum(1 for d in data if d["english"] is None)
print(f"Missing math scores: {missing_math}")
print(f"Missing english scores: {missing_english}")

# Clean data: drop rows with missing values (simple approach)
clean_data = [d for d in data if d["math"] is not None and d["english"] is not None]
print(f"Rows after cleaning: {len(clean_data)} (removed {len(data) - len(clean_data)})")

# Prepare features and labels
X = np.array([[d["math"], d["english"]] for d in clean_data])
y = np.array([d["passed"] for d in clean_data])

# Train a model
model = DecisionTreeClassifier(max_depth=3)
model.fit(X, y)

# Save the model to a file
joblib.dump(model, "student_pass_model.pkl")
print("\nβœ… Model saved as 'student_pass_model.pkl'")

# Load the model (in a real deployment, this would be a separate script)
loaded_model = joblib.load("student_pass_model.pkl")

# Predict a new student
new_student = np.array([[75, 80]])
prediction = loaded_model.predict(new_student)[0]
print(f"New student (Math: 75, English: 80) => {'PASS' if prediction == 1 else 'FAIL'}")

# Feature importance
print(f"Math importance: {model.feature_importances_[0]:.3f}")
print(f"English importance: {model.feature_importances_[1]:.3f}")

Quick Quiz β€” Machine Learning Basics

What is the main difference between supervised and unsupervised learning?
What does it mean when a model's training accuracy is much higher than its test accuracy?

πŸ’‘ Quick Tip: You are reading the free online version of this lesson. To get a certificate, attend in-person training and complete all assessments. Practice ML concepts using Google Colab (free, browser-based Python with scikit-learn pre-installed).

Tools & Technologies

  • Python
  • Google Colab
  • Scikit-learn

Career Opportunities

  • Data/AI analyst role at a bank, telecom, or NGO
  • Research or further-study pathway in AI/ML/Data Science
  • Remote/freelance AI or data work

Practical Projects

  • Train and evaluate a machine learning model on a real or public dataset
  • Build a simple prediction tool and document its accuracy and limitations

Ready to register for Machine Learning (ML)?

WhatsApp: +211926196668 Email: rescueacademy26@gmail.com