KEMBAR78
Introduction To Machine Learning | PDF | Machine Learning | Artificial Intelligence
0% found this document useful (0 votes)
47 views25 pages

Introduction To Machine Learning

The document provides an introduction to machine learning (ML), explaining its definition, types, and importance in modern technology. It outlines the ML workflow, key terms, common tools, and real-world applications, while also addressing challenges such as data quality and bias. The lecture emphasizes the evolution of ML and its capabilities in automating tasks, personalizing experiences, and solving complex problems.

Uploaded by

mwascoder
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views25 pages

Introduction To Machine Learning

The document provides an introduction to machine learning (ML), explaining its definition, types, and importance in modern technology. It outlines the ML workflow, key terms, common tools, and real-world applications, while also addressing challenges such as data quality and bias. The lecture emphasizes the evolution of ML and its capabilities in automating tasks, personalizing experiences, and solving complex problems.

Uploaded by

mwascoder
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Murang’a University of Technology

Innovation for Prosperity


Lecture 1

Introduction to Machine
Learning
Contextualizing Machine Learning
Let’s start with this scenario:
• Imagine an Intern joins your team. You give them a stack of
emails and say, “Sort these into work emails and spam.” The
intern spends days looking for patterns—like how all spam has
phrases like “Congratulations, you’ve won!” or “Buy now!”—and
eventually becomes great at it.
• Now imagine replacing that intern with a computer program.
You feed it a dataset of labeled emails (work vs. spam), and
voilà! It learns to classify new emails on its own.
• That’s Machine Learning for starters!

3
Contextualizing Machine Learning
Scenario 2:
• Imagine you’re teaching your cat to recognize when it's dinner time.
At first, the cat doesn’t know what "dinner time" means, so you
show it food and say "dinner time!" each day. The cat starts to learn
that when you say those words, food appears. Eventually, the cat
gets it, and when you say "dinner time!" it comes running, even
before you show the food.
• This is like machine learning – the cat is the "model," the words
and food are the "data," and the cat learns by repeatedly
connecting the two until it knows exactly what to do when it hears
"dinner time!

4
So, What is Machine Learning?
• As per Herbert Simon: “Learning is any process by which a system
improves performance from experience.”
• Machine learning is about teaching computers to learn from
examples and make predictions or decisions based on the patterns
they identify in the data.
– It's like teaching a student to recognize and categorize things by showing
them a variety of examples.
• Therefore; Machine learning is a subset of artificial intelligence
where algorithms learn from data to improve their performance
over time without explicit programming by enabling systems to
recognize patterns, make predictions, and improve based on
experience.

5
Why Is Machine Learning a Big Deal?

Think of ML as the Swiss Army knife of technology—it does “almost”


everything:

1. Automation: Automates repetitive tasks (e.g., tagging photos on


social media).
2. Personalization: Powers recommendation systems (e.g., Netflix
suggesting shows).
3. Scalability: Handles massive datasets (e.g., analyzing millions of
tweets).
4. Problem-Solving: Finds solutions in medicine (predicting diseases),
finance (detecting fraud), and transportation (self-driving cars).
5. Others (Research on them)

6
The History of Machine Learning
Let’s take a trip back in time to see how machine learning evolved
from a quirky idea to a driving force behind today’s technology;

• 1950s: Alan Turing’s Turing Test and Arthur Samuel’s checkers program.
• 1980s: Neural networks revived with backpropagation (1986).
• 1990s: Data-driven ML; Support Vector Machines (SVM) introduced.
• 2000s: Big Data revolution; ML powers Amazon recommendations and
Google search.
• 2010s: Deep learning revolution; breakthroughs in vision (self-driving cars)
and NLP (Siri).
• 2020s: Transformers (GPTs) dominate; generative AI and autonomous
systems thrive.

7
Key ML Terms to Know
1. Training Data: The data used to teach the model.
2. Testing Data: The data used to test the model's performance.
3. Features: The input variables (e.g., age, income). Features are
the properties of the training data that will be fed to the
model.
4. Labels: The target outputs that you will get from the model
after training (e.g., spam or not spam).
5. Model: The machine’s representation of the learned patterns.
This is the relationship between the features and the labels.

8
Common Machine Learning Tools
i. scikit-learn: Ideal for basic ML tasks (classification,
regression).
ii. TensorFlow/PyTorch: Heavy-duty frameworks for deep
learning.
iii. Google Colab: Free online coding environment for
experimentation
iv. Keras: A user-friendly interface for TensorFlow.
v. Jupyter Notebooks: An interactive coding environment.

9
Types of Machine Learning
1. Supervised Learning
The machine learns with a cheat sheet—labeled data. Meaning that
the data is already tagged with the correct labels
- It can be compared to learning which takes place in the
presence of a supervisor (teacher)

Example 1: Predicting house prices: Input (size, location) → Output


(price).
Example 2: Dog detector: Show it 1,000 dog photos labeled “dog”
and 1,000 goat photos labeled “not a dog.” Soon, it’s a dog expert.

10
Types of Machine Learning
2. Unsupervised Learning:
The machine gets no labels—it has to find patterns on its own.
The model works on its own to discover patterns within the
unlabeled data.

Example 1: Netflix grouping viewers into clusters: action


junkies, rom-com lovers, and documentary enthusiasts.
Example 2: Organizing socks after laundry—group by color or
size without anyone telling you how.

11
Types of Machine Learning
3. Semi-Supervised Learning
A type of machine learning that uses a small amount of labeled data
combined with a large amount of unlabeled data to train a model.
It falls between supervised and unsupervised learning.

Example:
• Image Classification: In a scenario where only a few images are
labeled (e.g., "cat" or "dog") but many more images are
unlabeled, semi-supervised learning can be used to train a
model that can classify new images by learning from both
labeled and unlabeled data.

12
Types of Machine Learning
4. Reinforcement Learning
A type of machine learning where an agent learns to make decisions
by performing actions in an environment to maximize cumulative
reward.
The agent learns from the consequences of its actions (feedback)
rather than being given explicit labels.

Example:
• Game Playing (e.g., AlphaGo): In reinforcement learning, a
model learns to play a game like Go by playing many rounds,
adjusting its strategy based on winning or losing, ultimately
improving its play to win the game more often.

13
ML Pipeline/Steps/Workflow
The steps in a typical machine learning (ML) workflow are as follows:
1. Problem Definition:
Define the problem you want to solve. This includes identifying whether it is a
classification, regression, clustering, or other type of problem.
2. Data Collection:
Gather the data that will be used to train and test the model. This can come from
various sources such as databases, surveys, web scraping, or publicly available
datasets.
3. Data Preprocessing:
1. Clean and prepare the data by handling missing values, removing duplicates,
and correcting errors.
2. Transform features (e.g., scaling, encoding categorical variables, normalizing)
to make them suitable for the model.
3. Split the data into training, validation, and test sets.

14
ML Pipeline/Steps/Workflow
4. Choosing the Model:
Select an appropriate machine learning model based on the problem
type (e.g., linear regression, decision tree, random forest, neural
network).

5. Model Training:
Train the model using the training data. This involves feeding data into
the model, adjusting its parameters, and minimizing the loss function.

6. Hyperparameter Tuning:
Fine-tune the model by adjusting hyperparameters (e.g., learning rate,
number of trees in a forest, layers in a neural network) to improve
performance.

15
ML Pipeline/Steps/Workflow
7. Model Validation
Validate the trained model using the validation set to assess its
performance.

8. Model Testing:
Test the final model on the unseen test data to check how well it
generalizes to new data. This step provides an estimate of how the model
will perform in a real-world scenario.

9. Model Deployment:
Once satisfied with the model's performance, deploy it into production
where it can make predictions on new data. This may involve integrating
the model into an application or service.

16
Practical Example for this Lecture

Scenario:
You’re developing a system to predict if students will pass an exam
based on:
• Features: Study hours, attendance, and previous grades.
• Label: Pass (1) or Fail (0).

Steps:
1. Collect past student data.
2. Train a supervised learning model (e.g., Logistic Regression).
3. Evaluate the model using new data.
4. Deploy the model to help educators identify at-risk students.

17
Components of ML Algorithms
Every ML algorithm has three key components:

1. Representation:
This defines how the data is represented within the model, this
includes selecting relevant features or transforming the raw data
into a format that the model can process.
Examples include:
Features: The specific characteristics extracted from the data
(e.g., height, weight, color).
Parameters: The internal variables that the model learns
during training (e.g., weights in a neural network).

18
Components of ML Algorithms
2. Evaluation:
– This determines how well the model performs on both
the training and test datasets.
– It involves defining a metric to measure the model's
accuracy or effectiveness.
– Common evaluation metrics include accuracy, precision,
recall, F1-score, mean squared error, etc.

19
Components of ML Algorithms
3. Optimization:
– This is the process of finding the best set of parameters
for the model.
– It often involves minimizing a loss function (the
difference between the model's predictions and the
actual values).
– Optimization algorithms like gradient descent are used
to iteratively adjust the parameters to improve the
model's performance.

20
Real-World Applications of ML
Healthcare:
• Diagnosing cancer from X-rays using image recognition algorithms.
Finance:
• Detecting fraudulent transactions in real-time.
Retail:
• Chatbots providing 24/7 customer service.
Entertainment:
• Spotify generating playlists tailored to individual tastes.
Transportation:
• Enabling self-driving cars to navigate streets safely.

,,,and many others (research on them)

21
Challenges in Machine Learning
Data Quality: Bad data = bad models.
Example: Training a self-driving car with blurry images. It’ll think
a lamppost is a pedestrian.
Overfitting: The model is too obsessed with the training data.
Example: It memorizes all dog breeds in training but calls a wolf
a “fluffy husky.”
Bias in Data: The model mirrors biases in training data.
Example: A hiring algorithm trained on biased historical data
might favor certain groups.

22
Class Activity
At the end of the class;

1. Each student should mention a certain system (like Netflix,


Siri, or self-driving cars) (any of your choice) and state
whether it uses supervised, unsupervised, or reinforcement
learning.

2. Volunteer students can think of a problem (e.g., reducing


food waste in a cafeteria) and tell us how ML could solve it.

23
What are your takes on this claim?

24
Will you be Replaced by AI?

25

You might also like