CSC 413 Machine Learning With Python
CSC 413 Machine Learning With Python
Course Description
This course introduces students to the principles and practical implementation of Machine Learning
(ML) using Python. It covers data preprocessing, supervised and unsupervised learning, model
evaluation, and real-world applications using popular libraries.
Course Objectives
By the end of this course, students should be able to:
Course Modules
➢ Types of ML:
✓ Supervised Learning
✓ Unsupervised Learning
✓ Reinforcement Learning
➢ Key libraries:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
1
✓ NumPy (numerical computing)
✓ Matplotlib (visualization)
➢ Train-test split
➢ Correlation analysis
➢ Linear Regression
➢ Multiple Regression
➢ Evaluation metrics:
✓ R² Score
➢ Logistic Regression
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
2
➢ K-Nearest Neighbors (KNN)
➢ Decision Trees
➢ Confusion Matrix
➢ Cross-validation
➢ Overfitting vs Underfitting
➢ Clustering:
✓ K-Means
✓ Hierarchical Clustering
➢ Dimensionality Reduction:
➢ Bagging
➢ Boosting
➢ Random Forest
➢ Perceptron model
➢ Activation functions
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
3
Module 11: Deep Learning Basics
➢ Using frameworks:
✓ TensorFlow
✓ Keras
➢ Data privacy
➢ Responsible AI
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
4
Introduction to Machine Learning
What is Machine Learning?
Machine Learning (ML) is a part of Machine Learning where we teach computers how to learn from
experience, just like humans do.
Simple Definition:
Machine Learning is when a computer learns from data instead of being told every single step.
Example:
✓ It learns patterns
Real-life Example:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
5
Types of Machine Learning
There are 3 main types. Let’s make them very easy:
Example:
Real-life Example:
Simple Illustration:
Example:
✓ Apples together
✓ Bananas together
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
6
That’s unsupervised learning!
Real-life Example:
✓ Trying something
Example:
Real-life Example:
✓ Self-driving cars
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
7
Applications of Machine Learning
Machine Learning is used everywhere!
1. Healthcare
✓ Detecting fraud
3. Education
✓ Automatic grading
Everyday Life
✓ Netflix/YouTube recommendations
✓ Face recognition
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
8
Summary (Very Simple)
Final Idea
Machine Learning is like teaching computers to think and learn like humans, but using data instead
of a brain.
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
9
Python for Machine Learning
What is Python for Machine Learning?
Python is a programming language (a way we talk to computers).
✓ Analyze data
✓ Make predictions
Simple Example:
2. Study it
✓ It is easy to learn
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
10
NumPy (Number Expert )
Simple Example:
import numpy as np
print(average)
Output:
65
What happened?
Real-life Idea:
Simple Example:
import pandas as pd
data = {
"Name": ["John", "Mary", "Paul"],
"Score": [80, 90, 70]
}
df = [Link](data)
print(df)
Output:
Name Score
0 John 80
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
11
1 Mary 90
2 Paul 70
What happened?
Real-life Idea:
Simple Example:
[Link](scores)
[Link]()
What happened?
Real-life Idea:
What is Scikit-learn?
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
12
Simple Definition:
✓ Recognize patterns
✓ Make predictions
Imagine This...
Example:
1 20
2 40
3 60
4 80
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
13
It Learns the Pattern
Ask It a Question
It Gives an Answer
It predicts:
print(prediction)
What’s happening?
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
14
✓ [Link]() → Asking the computer
Example:
Example:
Example:
Real-Life Examples
Student Performance
Healthcare
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
15
Simple Analogy
Scikit-learn is like:
Student Model
Learning fit()
✓ Easy to use
✓ Saves time
2. Understands patterns
Tool Job
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
16
Tool Job
1. Collect data
✓ NumPy → numbers
✓ Pandas → tables
✓ Matplotlib → graphs
✓ Scikit-learn → learning
They can:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
17
Data Preprocessing
What is Data Preprocessing?
Simple Idea:
Example:
You collect:
✓ Name
✓ Age
✓ Hours studied
✓ Score
✓ Errors
✓ Wrong values
✓ Duplicates
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
18
Example:
Bad data:
John - 5 hours - 80
Mary - ??? - 90
John - 5 hours - 80
Problems:
import pandas as pd
data = {
"Name": ["John", "Mary", "John"],
"Hours": [5, None, 5],
"Score": [80, 90, 80]
}
df = [Link](data)
# Remove duplicates
df = df.drop_duplicates()
print(df)
Example:
Option 1: Remove it
19
Option 2: Fill it
Python Example:
df["Hours"].fillna(df["Hours"].mean(), inplace=True)
3. Feature Scaling
Example:
Feature Value
Age 15
Income 500,000
Problem:
Two Methods:
Normalization (0 to 1 range)
Python Example:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
20
scaler = StandardScaler()
scaled_data = scaler.fit_transform([[15], [20], [25]])
print(scaled_data)
Simple Idea:
Example:
Name Gender
John Male
Mary Female
Python Example:
le = LabelEncoder()
print(encoded)
Output:
[1 0 1]
Simple Idea:
21
5. Train-Test Split
Idea:
Part Purpose
Example:
✓ 80 → for training
✓ 20 → for testing
Real-life Example:
✓ Study (training)
Python Example:
print(X_train, X_test)
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
22
Full Process (Very Simple)
1. Collect data
2. Clean data
4. Scale numbers
If you do it well:
Smart predictions
One-Line Idea
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
23
Exploratory Data Analysis (EDA)
What is EDA?
EDA means looking at your data carefully to understand it before using it.
Simple Definition:
You:
✓ Ask questions
✓ Find clues
Example:
That is EDA!
Why?
Because:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
24
Types of Simple Graphs
[Link](scores)
[Link]("Student Scores")
[Link]()
[Link](names, scores)
[Link]()
[Link](values, labels=labels)
[Link]()
Simple Idea:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
25
2. Correlation Analysis
What is Correlation?
Correlation means:
How two things are related
Example:
1 20
2 40
3 60
Types of Correlation
Positive Correlation
Negative Correlation
No Correlation
✓ No clear relationship
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
26
Python Example:
import pandas as pd
data = {
"Hours": [1, 2, 3, 4],
"Score": [20, 40, 60, 80]
}
df = [Link](data)
print([Link]())
Simple Idea:
Example:
Example:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
27
Real-Life Example:
Week Score
1 50
2 60
3 70
Trend = Going up
Python Example:
weeks = [1, 2, 3]
scores = [50, 60, 70]
[Link](weeks, scores)
[Link]()
One-Line Idea
“EDA helps you understand your data before teaching the computer.”
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
28
Supervised Learning – Regression
What is Regression?
predict numbers
Simple Examples:
✓ Predict temperature
Easy Idea:
1. Linear Regression
Example:
1 20
2 40
3 60
4 80
We can see:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
29
Don’t worry about the big letters
• y = output (score)
Python Example:
model = LinearRegression()
[Link](X, y)
prediction = [Link]([[5]])
print(prediction)
Output:
100
Meaning:
2. Multiple Regression
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
30
It uses more than one factor to predict
Example:
2 8 50
3 7 60
4 6 70
✓ Study time
✓ Sleep
Python Example:
X=[
[2, 8],
[3, 7],
[4, 6]
]
model = LinearRegression()
[Link](X, y)
Simple Idea:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
31
3. Model Training and Prediction
Training
Training means:
teaching the computer using data
Example:
[Link](X, y)
Prediction
Prediction means:
asking the computer a question
Example:
[Link]([[5]])
Simple Idea:
✓ Training = learning
✓ Prediction = answering
What is MSE?
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
32
Formula:
1
𝑀𝑆𝐸 = ∑(𝑦𝑡𝑟𝑢𝑒 − 𝑦𝑝𝑟𝑒𝑑 )2
𝑛
Simple Example:
80 78
90 85
Errors:
✓ 80 - 78 = 2
✓ 90 - 85 = 5
Meaning:
What is R²?
Simple Idea:
• R² = 1 → Perfect prediction
• R² = 0 → Very bad
Python Example:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
33
print(mean_squared_error(y_true, y_pred))
print(r2_score(y_true, y_pred))
1. Collect data
2. Train model
3. Make predictions
4. Check accuracy
✓ Training → teaching
✓ Prediction → answering
✓ R² → how good
One-Line Idea
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
34
Supervised Learning – Classification
What is Classification?
Simple Examples:
Easy Idea:
1. Logistic Regression
Example:
1 Fail
5 Pass
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
35
Python Example:
model = LogisticRegression()
[Link](X, y)
print([Link]([[3]]))
Output: 1 (Pass)
Simple Idea:
What is KNN?
Example:
✓ Apple
✓ Apple
✓ Orange
Majority = Apple
So it predicts: Apple
Python Example:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
36
X = [[1], [2], [3], [4]]
y = [0, 0, 1, 1]
model = KNeighborsClassifier(n_neighbors=3)
[Link](X, y)
print([Link]([[2.5]]))
Simple Idea:
3. Decision Trees
Example:
Python Example:
model = DecisionTreeClassifier()
[Link](X, y)
print([Link]([[2]]))
Simple Idea:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
37
“Ask questions step by step to decide”
What is SVM?
Example:
Imagine this:
Separation Line:
𝑎𝑥 + 𝑏𝑦 + 𝑐 = 0
Python Example:
model = SVC()
[Link](X, y)
print([Link]([[3]]))
Simple Idea:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
38
Putting It All Together
Real-Life Examples
Spam Detection
Shopping Recommendation
Student Result
Image Recognition
✓ Logistic → Yes/No
One-Line Idea
39
Model Evaluation and Validation
What is Model Evaluation?
Simple Idea:
✓ Writing an exam
Name Meaning
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
40
Name Meaning
Simple Idea:
These are scores that tell us how good the model is.
Formula:
𝑇𝑃 + 𝑇𝑁
𝐴𝑐𝑐𝑢𝑟𝑎𝑐𝑦 =
𝑇𝑃 + 𝑇𝑁 + 𝐹𝑃 + 𝐹𝑁
𝑇𝑃 + 𝑇𝑁
𝐴𝑐𝑐𝑢𝑟𝑎𝑐𝑦 =
𝑇𝑃 + 𝑇𝑁 + 𝐹𝑃 + 𝐹𝑁
It tells us:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
41
Accuracy means:
“How many predictions were correct out of all predictions?”
TP = True Positive
Example:
✓ Email is Spam
TN = True Negative
Example:
FP = False Positive
Example:
FN = False Negative
Example:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
42
✓ Email is Spam
Formula meaning:
Accuracy =
Type Count
TP (correct Spam) 4
FP (wrong Spam) 2
Now calculate:
Correct = 4 + 3 = 7
Total = 4 + 3 + 2 + 1 = 10
Accuracy:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
43
7
𝐴𝑐𝑐𝑢𝑟𝑎𝑐𝑦 =
10
“Out of everything the computer tried, how many did it get right?”
Imagine a game:
Formula:
𝑇𝑃
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 =
𝑇𝑃 + 𝐹𝑃
𝑇𝑃
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 =
𝑇𝑃 + 𝐹𝑃
Simple Meaning
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
44
Precision means:
TP = True Positive
Example:
✓ Email is Spam
FP = False Positive
Example:
Precision is:
“Out of everything the computer called YES, how many were actually correct?”
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
45
Case Result
Now calculate:
5
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 =
5+2
Real-Life Example
But:
“How many times was your friend correct when they said ‘apple’?”
Easy Comparison
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
46
Term Meaning
Example:
• 4 correct
• 1 wrong
Simple Idea:
Formula:
𝑇𝑃
𝑅𝑒𝑐𝑎𝑙𝑙 =
𝑇𝑃 + 𝐹𝑁
Example:
• You detect 7
Recall = 70%
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
47
Simple Idea:
Formula:
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 ⋅ 𝑅𝑒𝑐𝑎𝑙𝑙
𝐹1 = 2 ⋅
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 + 𝑅𝑒𝑐𝑎𝑙𝑙
Simple Idea:
3. Cross-Validation
What is Cross-Validation?
Example:
✓ Train on 4 parts
✓ Test on 1 part
✓ Repeat 5 times
Real-Life Example:
48
Simple Idea:
4. Overfitting vs Underfitting
Example:
A student:
✓ Memorizes answers
Problem:
Example:
A student:
✓ Fails exam
Problem:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
49
Good Model (Balanced )
Simple Table:
Type Problem
✓ F1 → Balance
50
✓ Overfitting/Underfitting → Avoid extremes
One-Line Idea
“Model evaluation helps us know if our computer is truly smart or just guessing.”
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
51
Unsupervised Learning
What is Unsupervised Learning?
Simple Idea:
✓ No teacher
✓ No correct answers
Example:
✓ Apples
✓ Oranges
✓ Bananas
What is Clustering?
Clustering means:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
52
Example:
What is K-Means?
Simple Example:
You choose K = 3:
✓ 3 groups of students
1. Pick K groups
4. Move centers
Python Example:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
53
data = [[1], [2], [3], [10], [11], [12]]
model = KMeans(n_clusters=2)
[Link](data)
print(model.labels_)
Simple Idea:
What is it?
Example:
Then:
Picture Idea:
All Students
/ \
Group A Group B
/ \ / \
A1 A2 B1 B2
Simple Idea:
54
2. Dimensionality Reduction
What is it?
It means:
Example:
✓ Age
✓ Height
✓ Weight
✓ Study hours
✓ Sleep hours
✓ Attendance
What is PCA?
Simple Example:
Instead of 6 features:
Real-Life Example:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
55
Imagine compressing a big photo:
✓ Original: 10 MB
✓ After PCA: 2 MB
Python Example:
pca = PCA(n_components=1)
new_data = pca.fit_transform(data)
print(new_data)
Simple Idea:
Summary of Module 8
✓ Without instructions
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
56
✓ But still finding patterns
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
57
Ensemble Learning
What is Ensemble Learning?
Simple Idea:
✓ 10 people
Because:
What is Bagging?
Bagging means:
“Train many models on different random parts of data, then combine results.”
Simple Example:
You ask:
✓ Friend 1
✓ Friend 2
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
58
✓ Friend 3 (wrong)
✓ Friend 4
How it works:
Python Example:
model = BaggingClassifier(
estimator=DecisionTreeClassifier(),
n_estimators=10
)
Simple Idea:
2. Boosting
What is Boosting?
Boosting means:
“Train models one after another, each one fixes mistakes of the previous one.”
Simple Example:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
59
✓ Teacher focuses on those mistakes
✓ Student 2 improves
How it works:
1. Model 1 learns
4. Continue improving
Python Example:
model = AdaBoostClassifier(
estimator=DecisionTreeClassifier(max_depth=1),
n_estimators=50
)
Simple Idea:
3. Random Forest
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
60
Simple Example:
Imagine asking:
“Should I play football today?”
✓ Tree 1 → Yes
✓ Tree 2 → No
✓ Tree 3 → Yes
✓ Tree 4 → Yes
Why “Random”?
Because:
Python Example:
model = RandomForestClassifier(n_estimators=100)
Simple Idea:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
61
Summary Table
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
62
Introduction to Neural Networks
What are Neural Networks?
They are computer systems that try to think like the human brain.
Simple Idea:
Real-Life Example:
You say:
✓ Has whiskers
✓ Has ears
✓ Says meow
What is ANN?
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
63
Simple Structure:
Example:
Inputs:
✓ Cloudy
✓ Humidity
✓ Wind
Output:
✓ Rain or No Rain
Simple Idea:
2. Perceptron Model
What is a Perceptron?
It:
✓ Takes inputs
✓ Adds them
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
64
Example:
“Should I go outside?”
Inputs:
✓ Is it raining?
✓ Do I have an umbrella?
Decision:
Condition Result
Simple Idea:
3. Activation Functions
They decide:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
65
Simple Example:
✓ If OFF → no light
1. Step Function
✓ 0 (OFF)
✓ 1 (ON)
Example:
✓ Else → Fail
2. Sigmoid Function
Example:
Used in:
Yes/No predictions (like spam detection )
3. ReLU Function
If number is:
✓ Negative → becomes 0
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
66
✓ Positive → stays the same
Example:
✓ -5 → 0
✓ 10 → 10
Simple Idea:
Summary Table
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
67
Deep Learning Basics
What is Deep Learning?
Simple Idea:
✓ Deep learning computer = learns from lots of data (thousands or millions of examples)
Real-Life Example:
“Deep” means:
Simple Structure:
68
✓ Layer 1 → simple shapes (lines, edges)
Simple Idea:
Example:
Self-driving car
It learns:
✓ Road lines
✓ Traffic signs
2. TensorFlow
What is TensorFlow?
It is like:
Simple Example:
✓ Screws
✓ Wires
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
69
✓ Engine
import tensorflow as tf
model = [Link]([
[Link](10, activation='relu'),
[Link](1)
])
Simple Idea:
3. Keras
What is Keras?
✓ Easier
✓ Faster
✓ More beginner-friendly
Simple Example:
Think of:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
70
from tensorflow import keras
model = [Link]([
[Link](8, activation='relu'),
[Link](1, activation='sigmoid')
])
Simple Idea:
Summary Table
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
71
Model Deployment
What is Model Deployment?
It means:
“Putting your trained AI model into real life so people can use it.”
Simple Idea:
Real-Life Example:
✓ Putting it in an app
✓ Or a website
1. Saving Models
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
72
Simple Example:
Think of it like:
1.1 Pickle
Example:
import pickle
# save model
with open("[Link]", "wb") as file:
[Link](model, file)
Load it back:
Simple Idea:
1.2 Joblib
Example:
import joblib
[Link](model, "[Link]")
Load it:
model = [Link]("[Link]")
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
73
Simple Idea:
What is an API?
An API (Application Programming Interface) is like a messenger that helps two different systems talk
to each other.
How it works:
✓ Waiter = API
Example:
“I want a burger”
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
74
In Technology
An API lets:
Simple Example:
Imagine a restaurant :
In AI:
app = Flask(__name__)
model = [Link]("[Link]")
@[Link]('/predict', methods=['POST'])
def predict():
data = [Link]
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
75
result = [Link]([data['value']])
return {"prediction": [Link]()}
Simple Idea:
Simple Example:
Think of:
Real-Life Example:
✓ Google Cloud
✓ AWS
✓ Azure
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
76
Simple Idea:
Summary Table
✓ Putting it online
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
77
Ethics in Machine Learning
Ethics in Machine Learning is part of Machine Learning.
It means:
✓ Schools
✓ Hospitals
✓ Banks
✓ Social media
What is Bias?
Bias means:
Simple Example:
Boys will perform better just because they got more attention
That is unfair learning
In AI:
• Men’s faces
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
78
• It may not recognize women’s faces well
That is bias
Another Example:
Fairness means:
✓ Gender
✓ Race
✓ Age
✓ Background
2. Data Privacy
Simple Example:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
79
In AI:
✓ Your name
✓ Your location
✓ Your photos
Example:
Simple Rule:
3. Responsible AI
Responsible AI means:
Simple Example:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
80
✓ It does not harm people
In Real Life:
Responsible AI means:
Example:
A responsible AI:
Summary Table
Ethics in AI means:
✓ AI should be fair
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
81
Real-World Applications
This module shows how Machine Learning is used in real life every day.
It means:
1. Predictive Analytics
What is it?
Simple Example:
In AI:
Example:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
82
2. Fraud Detection
What is it?
Simple Example:
In AI:
✓ Fake transactions
✓ Unusual spending
Example:
• Nigeria 🇳🇬
3. Recommendation Systems
What is it?
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
83
Simple Example:
In AI:
Used in:
✓ Netflix (movies)
✓ YouTube (videos)
✓ Amazon (shopping)
✓ Spotify (music)
Example:
✓ Football highlights
What is Classification?
Classification means:
Image Classification
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
84
Example:
AI sees a picture:
✓ → “Cat”
✓ → “Dog”
✓ → “Car”
Real Life:
Text Classification
Example:
Email:
Used in:
✓ Spam detection
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
85
Summary Table
✓ A smart helper
✓ Detects problems
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
86
HOW TO SET UP VS CODE FOR MACHINE LEARNING (STEP BY STEP)
Download here:
[Link]
Install it normally:
Download Python:
[Link]
python --version
Python 3.x.x
Install:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
87
1. Python (by Microsoft)
ML_Project
2. Open VS Code
3. Click:
Inside VS Code:
Create file:
[Link]
Click:
Terminal → New Terminal
Then run:
CSC 413: MACHINE LEARNING WITH PYTHON. Compiled By: Mr Michael Dominic
88