0% found this document useful (0 votes)
2 views4 pages

Machine Learning

The document explains the difference between traditional programming and machine learning, highlighting how machine learning allows computers to learn from data rather than relying on explicit rules. It outlines three main types of machine learning: supervised, unsupervised, and reinforcement learning, each with distinct methods and applications. Additionally, it details the machine learning workflow, which includes data collection, feature engineering, model selection, training, evaluation, and deployment.

Uploaded by

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

Machine Learning

The document explains the difference between traditional programming and machine learning, highlighting how machine learning allows computers to learn from data rather than relying on explicit rules. It outlines three main types of machine learning: supervised, unsupervised, and reinforcement learning, each with distinct methods and applications. Additionally, it details the machine learning workflow, which includes data collection, feature engineering, model selection, training, evaluation, and deployment.

Uploaded by

nabeelaameen498
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Part 1: The Definition and the Paradigm Shift

Let's start with a question. How do you write a program to tell if an email is
spam?

The Traditional (Procedural) Way:


You would sit down, think about all the rules that define spam, and write a
program like this:

text

IF email contains "Free" AND sender NOT in Contacts THEN Mark as Spam.

This is explicit programming. We tell the computer exactly what to do, step-
by-step. It works, but it's brittle. Spammers just change the wording to
"Fr33", and your rules fail. You would have to write thousands of rules, and
you'd still miss the clever ones.

The Machine Learning Way:


Instead of writing rules, we give the computer data. We feed it thousands of
emails, and for each one, we tell it the label: "Spam" or "Not Spam." We then
give the computer a powerful algorithm. This algorithm's job is to look at the
data and find the patterns on its own. It creates its own "rules" based on
the data it sees. It learns.

Definition: Machine Learning is a subfield of Artificial Intelligence that gives


computers the ability to learn without being explicitly programmed.

Think of it this way:

 Traditional Programming: Data + Rules = Answer

 Machine Learning: Data + Answer = Rules (The Model)

The computer generates a model—a mathematical function that maps inputs


to outputs. Once it has that model, it can make predictions on new, unseen
data.

Easy Example:
Think of a child learning to identify a "dog."

 You don't give them a checklist of biological traits (4 legs, tail, fur,
barks).

 You show them pictures of dogs and say "This is a dog." You show them
pictures of cats and say "This is a cat."
 Over time, their brain (the "algorithm") finds the patterns that
distinguish a dog from a cat. When they see a new animal, they can
tell you if it's a dog or a cat based on that learned experience. That is
precisely what Machine Learning does.

Part 2: The Three Pillars of Learning

Machine Learning isn't just one thing. It's divided into major categories based
on the type of data you have and the problem you want to solve. We will
focus on the three main ones.

1. Supervised Learning (Learning with a Teacher)

This is the most common type. The algorithm learns from labeled data.
Imagine you are a student, and I am your teacher. I give you problems (the
data) and the correct answers (the labels). You learn by adjusting your
thinking until you consistently get the right answer.

We can split Supervised Learning into two main sub-types:

 A) Classification: The output is a category.

o Example: "Is this email Spam or Not Spam?" (Two categories).

o Example: "Is this tumor Benign or Malignant?" (Two categories).

o Example: "What digit is this? 0, 1, 2, ... 9?" (Ten categories).

 B) Regression: The output is a continuous number.

o Example: "What will the price of this house be?" (Output is a


number, like $300,000).

o Example: "What will the temperature be tomorrow?" (Output is


a number, like 72 degrees).

2. Unsupervised Learning (Learning without a Teacher)

This algorithm learns from unlabeled data. You give the computer a pile of
data and say, "Figure this out. Find structure or patterns for me." It's like
giving a child a box of mixed LEGO bricks and asking them to sort them
without telling them the categories.

The most common type is Clustering.


 Example: Customer segmentation. A company has data on thousands
of customers (age, purchases, location) but no labels. The algorithm
groups customers into clusters (e.g., "Young Tech Enthusiasts,"
"Budget-Conscious Parents," "Luxury Buyers"). The company can then
target marketing campaigns to each cluster.

3. Reinforcement Learning (Learning through Trial and Error)

This is like training a pet. The algorithm is an agent that learns to make
decisions by interacting with an environment. It gets rewards for good
actions and penalties for bad ones. Its goal is to maximize the total reward.

 Example: A robot learning to walk. It takes a step (action), if it stays


upright (reward) it gets a treat. If it falls (penalty), it gets shocked.
Over millions of attempts, it learns the sequence of muscle movements
to walk perfectly.

 Famous Example: AlphaGo, the program that beat the world


champion in the complex game of Go. It played millions of games
against itself, learning from its wins and losses.

Part 3: The Machine Learning Workflow (The Process)

This is how we actually do ML in the real world. It's not magic; it's a
structured process.

Step 1: Data Collection and Preparation


"This is the most important step." Machine Learning is all about the
data. Garbage in, garbage out. We need to collect data and clean it. What if
our house price data is missing the number of bedrooms for half the houses?
We must handle missing data, remove duplicates, and fix formatting errors.

Step 2: Feature Engineering


This is where human intuition helps. What are the columns in our data?
These are called "features." For house price prediction, features might be:

 Square Footage

 Number of Bedrooms

 Neighborhood
 Age of the House
We might create a new feature, like Age of House, from the Year
Built data. Good features make the model's job much easier.

Step 3: Model Selection


This is where we choose the algorithm. Do we use a Decision Tree, a Neural
Network, or a simpler Linear Regression? It depends on the problem, the
amount of data, and the complexity.

Step 4: Training
This is the learning phase. We feed the data and its answers into the chosen
algorithm. The algorithm "adjusts its knobs" (its parameters) to find the best
patterns. This process is called "fitting the model."

Step 5: Evaluation
How do we know if our model is any good? We don't test it on the data it
used to learn. That would be like a student taking a test on the same
questions they practiced with. We would see a perfect score, which is
misleading.
So, we split the data. We use 80% to train and 20% to test.
We then use the trained model to make predictions on the "unseen" 20%. We
compare the predictions to the actual answers. The model is evaluated on
this test data.

Step 6: Deployment and Monitoring


Once the model is good enough, we deploy it. The spam filter now runs on
the email server. But it's not "set and forget." We must monitor its
performance. If spammers evolve, the model's accuracy drops, and we need
to retrain it with new data.

You might also like