Machine Learning
The Evolution of Machine Learning
1.Rule Based Programming:-
Rule-based programming is an approach where humans manually write rules to make a computer take decisions. The computer follows those rules to produce an output.
Example: Email Spam Detection
Suppose we want to identify spam emails.
We manually define rules:
- Rule 1: If an email contains the word “WIN MONEY,” mark it as spam.
- Rule 2: If an email contains “Claim your prize,” mark it as spam.
- Rule 3: Otherwise, mark it as a normal email.
Limitations:
- Too many rules are required :-
For example ,In Email Spam Detection we have to write many rules to find a mail is spam or not .Writing and maintaining that many rules is difficult.
2. Difficult to Handle the Exceptions:-
Suppose write a rule:
If an Email contain free then make it as spam
Then based on rule every email that contain free become spam, if a mail contain like this “Here is your free educational course” may this mail is genuine. It can’t handle these types of problems.
3. Cannot Learn From New Data:-
Suppose your system has never seen the phrase “Congratulations, you’ve won a free iPhone!”It may not identify this as spam because you haven’t written a rule for it.
So It cannot learn patterns from new data
2. The Evolution and Need for Machine Learning
Machine Learning is needed because it enables computers to learn patterns from data and make predictions or decisions without requiring humans to write every rule manually.
- To handle large amounts of data
- To solve complex problems
- To make predictions
- To learn from patterns
3. The Role of Data Analysis in Building Machine Learning Models
Data analysis plays an important role in Machine Learning because it helps us understand, clean, and prepare data before training a model.
A Machine Learning model learns patterns from data.
If the data is incorrect, incomplete, or poorly prepared, the model may produce inaccurate predictions.
- Understand Data
- Clean the Data
- Performs Exploratory Data Analysis
- Prepare the data
- Build a model
Understanding How ML Models Learn
1.Parametric and Non-Parametric Models
1. Parametric Model
A parametric model learns using a fixed number of parameters from the data.
Example: Linear Regression
Imagine predicting marks based on study hours.
The model learns a formula like:
Marks = 10 × Study Hours + 20
It learns the values in the formula and uses them to predict marks.
2. Non-Parametric Model
A non-parametric model learns patterns more flexibly from the data. Its complexity can grow as more data is added.
Example: KNN (K-Nearest Neighbors)
To predict a student’s marks, KNN looks at students with similar study hours and uses their marks to make a prediction.
2 . Generalization and Memorization
Generalization:-
Generalization means a model learns patterns from training data and applies them correctly to new, unseen data.
Example:-
A student understands a mathematical concept and can solve new problems.
Memorization:-
Memorization means a model remembers the training examples instead of learning patterns that work well on new data.
Example:-
Get Rushikanettem’s stories in your inbox
Join Medium for free to get updates from this writer.
A student memorizes answers but cannot solve a question when it is changed.
Types of Machine Learning
- Supervised Learning:-
The model learns from data that already has the correct answers, called labels.
Example :- Email spam detection
Imagine we give the model 1,000 emails, and each email is labeled as either Spam or Not Spam.
- Email: “You won a free prize!” → Spam
- Email: “Your college timetable is ready” → Not Spam
The model learns patterns from these labeled examples. When a new email arrives, it predicts whether it is spam.
2. Unsupervised Learning
The model learns patterns from data that has no predefined labels or correct answers.
Example: Customer segmentation
Imagine a shopping company has information about 1,000 customers but does not know their customer groups.
The model analyzes shopping behavior and groups similar customers:
- Group 1: Customers who buy expensive products.
- Group 2: Customers who mostly buy discounted products.
- Group 3: Customers who shop frequently.
Data without labels → Discover hidden patterns or groups.
3. Reinforcement Learning
An agent learns by taking actions and receiving rewards or penalties from its environment.
Example : Self-driving car
magine a self-driving car learning how to drive safely in a simulation.
- It maintains a safe distance from other cars → Reward.
- It follows traffic rules → Reward.
- It collides with an obstacle → Penalty.
4.Semi-Supervised Learning :-
Meaning: The model learns using a small amount of labeled data and a large amount of unlabeled data.
Example : Identifying cats and dogs 🐱🐶
Suppose you have 10,000 animal images.
- 500 images are labeled as Cat or Dog.
- 9,500 images have no labels.
- The model learns from the labeled images and uses patterns in the unlabeled images to improve its learning.
This can reduce the amount of manual labeling needed.
Types of ML Problems
- Classification
Classification is used when we want to predict a category or class.
Example: Email spam detection.
Suppose we give an ML model different emails.
- “You won a free prize!” → Spam
- “Your college timetable is ready” → Not Spam
The model predicts which category the email belongs to.
2. Regression
Regression is used when we want to predict a numerical value.
Example: House price prediction.
Suppose we give an ML model information about houses, including their size, location, and number of bedrooms.
The model predicts prices such as:
- House A → ₹30 lakh
- House B → ₹45 lakh
- House C → ₹62 lakh
The output is a numerical value.





