Data Science & Machine Learning
77.8K subscribers
896 photos
1 video
68 files
815 links
Join this channel to learn data science, artificial intelligence and machine learning with funny quizzes, interesting projects and amazing resources for free

For collaborations: @love_data
Download Telegram
What is the Mode of the following dataset?
2, 4, 4, 5, 6, 6, 6, 8
Anonymous Quiz
6%
2
8%
4
9%
5
78%
6
โค4๐Ÿ˜1
Which measure of central tendency is least affected by outliers?
Anonymous Quiz
15%
A) Mean
41%
B) Median
26%
C) Mode
18%
D) Range
โค3
๐Ÿš€ Data Science Roadmap 2026

๐Ÿ“˜ Phase 2: Mathematics for Data Science

๐Ÿ“– Topic 3: Variance & Standard Deviation

Welcome back! ๐Ÿ‘‹

In the previous lesson, you learned about Mean, Median, and Mode, which help us find the center of a dataset.

But knowing the average alone is not enough.

Imagine these two datasets:

Dataset A

40, 45, 50, 55, 60

Dataset B

10, 20, 50, 80, 90

Both datasets have the same mean (50), but they are very different.

โ€ข Dataset A has values close to the mean.

โ€ข Dataset B has values spread far away from the mean.

To measure this spread, we use Variance and Standard Deviation.

These are among the most important statistical concepts in Data Science and Machine Learning.

๐Ÿ”น 1. What is Variance?

Variance measures how far each value is from the mean.

โ€ข Small variance โ†’ Data points are close together.

โ€ข Large variance โ†’ Data points are widely spread.

Formula (Population Variance)

Variance = ฮฃ(x โˆ’ Mean)ยฒ / N

Where:

โ€ข ฮฃ = Sum

โ€ข x = Each data point

โ€ข Mean = Average

โ€ข N = Total number of observations

๐Ÿ”น 2. Example of Variance

Dataset: 10, 20, 30

Step 1: Find the Mean

(10 + 20 + 30) / 3 = 20

Step 2: Find the Difference from the Mean

10 โˆ’ 20 = -10

20 โˆ’ 20 = 0

30 โˆ’ 20 = 10

Step 3: Square the Differences

100, 0, 100

Step 4: Calculate Variance

(100 + 0 + 100) / 3 = 66.67

๐Ÿ”น 3. What is Standard Deviation? โญ

Standard Deviation (SD) is simply the square root of the variance.

Formula

Standard Deviation = โˆšVariance

Using the previous example:

Variance = 66.67

SD = โˆš66.67 โ‰ˆ 8.16

๐Ÿ”น 4. Why Standard Deviation is Preferred?

Variance is measured in squared units, making it harder to interpret.

Standard Deviation is measured in the same units as the original data, making it easier to understand.

Example:

If salaries are measured in rupees:

โ€ข Variance โ†’ Rupeesยฒ โŒ

โ€ข Standard Deviation โ†’ Rupees โœ…

๐Ÿ”น 5. Python Example

Using the "statistics" module:

import statistics

numbers = [10, 20, 30]

print(statistics.pvariance(numbers))
print(statistics.pstdev(numbers))
โค5๐Ÿ‘2
Output

66.67

8.16

๐Ÿ”น 6. Real-World Example

Student A

Marks: 78, 80, 82, 79, 81

Very consistent performance.

Low Standard Deviation โœ…

Student B

Marks: 40, 95, 65, 100, 50

Highly inconsistent performance.

High Standard Deviation โœ…

Even if both students have a similar average, their consistency is very different.

๐Ÿ”น 7. Variance vs Standard Deviation

Variance: Average squared distance from the mean | Measured in squared units | Harder to interpret

Standard Deviation: Square root of variance | Measured in original units | Easier to interpret 

๐Ÿ”น 8. Why Are They Important in Data Science?

Variance and Standard Deviation are used in:

โœ… Exploratory Data Analysis (EDA)

โœ… Feature Scaling

โœ… Outlier Detection

โœ… Data Distribution Analysis

โœ… Risk Analysis

โœ… Machine Learning Algorithms 

๐Ÿ”น 9. Real-World Applications

Finance: Measure stock market volatility.

Manufacturing: Check consistency in product quality.

Healthcare: Analyze variation in patient test results.

Machine Learning: Standardize features before training models. 

๐Ÿ”น 10. Common Mistakes

โŒ Thinking a higher standard deviation is always better.

A higher standard deviation simply means greater variability, not better or worse.

โŒ Confusing Variance with Standard Deviation.

Remember: Standard Deviation = โˆšVariance

๐ŸŽฏ Practice Questions 

1. Calculate the mean of: "5, 10, 15". 

2. Find the variance of: "2, 4, 6". 

3. What is the relationship between variance and standard deviation? 

4. Which dataset is more consistent: one with SD = 2 or SD = 20? 

5. Name three real-world applications of standard deviation.

๐ŸŽฏ Key Takeaways

โœ… Variance measures how spread out data is.

โœ… Standard Deviation is the square root of variance.

โœ… Low Standard Deviation means data points are close to the mean.

โœ… High Standard Deviation means data points are widely spread.

โœ… Standard Deviation is easier to interpret because it uses the same units as the original data. 

Variance and Standard Deviation are fundamental concepts used throughout Data Science, Machine Learning, statistics, finance, and business analytics. Understanding them will help you analyze data variability and build more reliable machine learning models.

Double Tap โค๏ธ For More
โค9๐Ÿ‘1
What will be the output of the following Python code?
import statistics
numbers = [10, 20, 30] print(round(statistics.pstdev(numbers), 2))
Anonymous Quiz
12%
10
33%
20
15%
8
40%
8.16
โค2
In Data Science, Standard Deviation is commonly used for which of the following?
Anonymous Quiz
3%
A) Creating folders
91%
B) Measuring data variability and feature scaling
2%
C) Designing web pages
4%
D) Connecting to databases
โค2
๐Ÿš€ Data Science Roadmap 2026

๐Ÿ“˜ Phase 2: Mathematics for Data Science

๐Ÿ“– Topic 4: Probability Basics

Welcome back! ๐Ÿ‘‹

In the previous lesson, you learned about Variance and Standard Deviation, which help us understand how data is spread out.

Now let's learn another fundamental concept in Data Science: Probability.

Probability helps us measure the likelihood that an event will happen. It plays an important role in Machine Learning, Statistics, Bayesian inference, risk analysis, forecasting, and decision-making.

๐Ÿ”น 1. What is Probability?

Probability is a measure of how likely an event is to occur.

Its value ranges from: 0 โ‰ค Probability โ‰ค 1

Where:

0 โ†’ Impossible event

1 โ†’ Certain event

0.5 โ†’ 50% chance

Probability can also be expressed as a percentage.

0.25 = 25%

0.50 = 50%

0.75 = 75%

1.00 = 100%

๐Ÿ”น 2. Basic Probability Formula

When all possible outcomes are equally likely:

Probability(Event) =

Number of favorable outcomes

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

Total number of possible outcomes

Example

Roll a standard six-sided die: 1, 2, 3, 4, 5, 6

What is the probability of getting a "4"?

1 favorable outcome, 6 possible outcomes

P(4) = 1/6 โ‰ˆ 0.167 = 16.7%

๐Ÿ”น 3. Experiment, Outcome & Event

Experiment: An action that produces an outcome. Ex: Rolling a die

Outcome: A possible result. Ex: 1, 2, 3, 4, 5, or 6

Event: A specific outcome or group of outcomes we're interested in. Ex: Getting an even number โ†’ 2, 4, 6

๐Ÿ”น 4. Sample Space

The set of all possible outcomes.

Coin toss: S = {Head, Tail}

Die: S = {1, 2, 3, 4, 5, 6}

๐Ÿ”น 5. Probability of an Event

Roll a die and want an even number.

Favorable: 2, 4, 6

P(Even) = 3/6 = 0.5 = 50%

๐Ÿ”น 6. Complementary Probability โญ

The complement of an event means the event does not happen.

If P(A) = 0.7

Then: P(Not A) = 1 - P(A) = 1 - 0.7 = 0.3

So there is a 30% probability that A will not occur.

๐Ÿ”น 7. Independent Events

Two events are independent when the occurrence of one does not affect the other.

Ex: Tossing a coin twice.

For independent events: P(A and B) = P(A) ร— P(B)

Ex: P(Head and Head) = 1/2 ร— 1/2 = 1/4 = 25%

๐Ÿ”น 8. Dependent Events

Two events are dependent when the outcome of one affects the probability of the other.

Ex: Bag with 3 Red, 2 Blue balls. Pick one and don't put it back. The probability for the second pick changes.

๐Ÿ”น 9. Conditional Probability โญ

Probability of an event occurring given that another event has already occurred.

Written as: P(A | B) โ†’ "Probability of A given B"

Formula: P(A | B) = P(A โˆฉ B) / P(B)

๐Ÿ”น 10. Real-World Example of Conditional Probability

Company data:

60% customers using Mobile App

30% customers using Mobile App and making a purchase

P(Purchase | App) = P(Purchase โˆฉ App) / P(App) = 0.30 / 0.60 = 0.50

Therefore: 50% of app users make a purchase.

๐Ÿ”น 11. Addition Rule

For two events: P(A or B) = P(A) + P(B) - P(A and B)

If mutually exclusive: P(A or B) = P(A) + P(B)

๐Ÿ”น 12. Multiplication Rule

For independent events: P(A and B) = P(A) ร— P(B)

Ex: Rolling two sixes: P(6 and 6) = 1/6 ร— 1/6 = 1/36

๐Ÿ”น 13. Probability in Data Science โญ

Machine Learning: Models produce probabilities. Ex: P(Spam) = 0.92

Classification: P(Customer will churn) = 78%

Risk Analysis: Estimate likelihood of loan default, fraud, churn, equipment failure

๐Ÿ”น 14. Probability vs Statistics

Probability: Starts with assumptions and predicts possible outcomes. Known model โ†’ Predict outcomes

Statistics: Starts with observed data and tries to understand the underlying population. Observed data โ†’ Learn about the model

๐Ÿ”น 15. Python Example

favorable = 3
total = 6
probability = favorable / total
print(probability)
โค6
Output: 0.5 โ†’ 50%

๐Ÿ”น 16. Common Mistakes

โŒ Probability can be greater than 1 

Incorrect: Probability = 1.5 

Correct range: 0 โ‰ค P(A) โ‰ค 1

โŒ Confusing independent and mutually exclusive events

Independent: One event does not affect the other

Mutually exclusive: Both events cannot occur at the same time

๐ŸŽฏ Practice Questions

1. What is the probability of getting Heads when tossing a fair coin?

2. What is the probability of rolling an even number on a six-sided die?

3. If P(A) = 0.8, what is P(Not A)?

4. What is the probability of getting two Heads when tossing a fair coin twice?

5. Explain the difference between independent and dependent events.

๐ŸŽฏ Key Takeaways

โœ… Probability measures the likelihood of an event

โœ… Probability ranges from "0" to "1"

โœ… Sample space contains all possible outcomes

โœ… Complementary probability is "1 - P(A)"

โœ… Independent events do not affect each other

โœ… Dependent events affect each other's probabilities

โœ… Conditional probability measures the probability of an event given another event

โœ… Probability is fundamental to Machine Learning, classification, risk analysis, and statistical inference

Understanding probability is essential before moving into more advanced topics such as Bayes' Theorem, probability distributions, hypothesis testing, and machine learning algorithms.

Double Tap โค๏ธ For More
โค4๐Ÿ‘1
๐Ÿš€ Data Science Roadmap 2026

๐Ÿ“˜ Phase 2: Mathematics for Data Science

๐Ÿ“– Topic 5: Bayes' Theorem

Welcome back! ๐Ÿ‘‹

In the previous lesson, you learned the fundamentals of Probability. Now we're moving to one of the most important concepts in probability and statistics for Data Science: Bayes' Theorem.

Bayes' Theorem helps us update the probability of an event when we receive new information.

It is particularly important in:

โœ… Machine Learning

โœ… Classification

โœ… Medical diagnosis

โœ… Fraud detection

โœ… Spam detection

โœ… Risk analysis

โœ… Recommendation systems

๐Ÿ”น 1. What is Bayes' Theorem?

Bayes' Theorem calculates the probability of an event based on prior knowledge and new evidence.

In simple terms:

ยซStart with what you already know โ†’ receive new evidence โ†’ update your belief.ยป

๐Ÿ”น 2. Bayes' Theorem Formula โญ

The formula is:

P(A|B) = P(B|A) ร— P(A)/P(B)

Where:

โ€ข P(A|B) โ†’ Probability of A given B

โ€ข P(B|A) โ†’ Probability of B given A

โ€ข P(A) โ†’ Prior probability of A

โ€ข P(B) โ†’ Probability of B

๐Ÿ”น 3. Understanding the Terms

Suppose we're trying to determine whether an email is spam.

Event A: Email is Spam

Evidence B: Email contains the word "Free"

Then: P(Spam | "Free") means: Probability that the email is spam given that it contains the word "Free".

๐Ÿ”น 4. Prior Probability

The prior probability represents what we believe before considering new evidence.

Suppose: 10% of all emails are spam.

P(Spam) = 0.10

This is our initial belief.

๐Ÿ”น 5. Likelihood

Now suppose: 80% of spam emails contain the word "Free".

P("Free" | Spam) = 0.80

This tells us how likely the evidence is if the email is actually spam.

๐Ÿ”น 6. Posterior Probability

After seeing the evidence, we want to calculate:

P(Spam | "Free")

This is called the posterior probability.

It represents our updated belief after receiving new information.

๐Ÿ”น 7. Simple Numerical Example โญ

Suppose:

โ€ข P(Spam) = 0.10

โ€ข P(Free | Spam) = 0.80

โ€ข P(Free) = 0.20

Using Bayes' Theorem:

P(Spam | Free) = P(Free | Spam) ร— P(Spam)/P(Free)

= 0.80 ร— 0.10/0.20

= 0.08/0.20

= 0.40

Therefore: P(Spam | Free) = 40%

So after seeing the word "Free", our estimated probability that the email is spam increases from 10% to 40%.

๐Ÿ”น 8. Why Does Bayes' Theorem Matter?

Bayes' Theorem allows us to update probabilities when new evidence becomes available.

This is extremely useful when working with uncertain information.

Initial belief โ†’ New evidence โ†’ Updated probability

๐Ÿ”น 9. Bayes' Theorem in Machine Learning โญ

One of the most famous applications is Naive Bayes.

Naive Bayes is a classification algorithm based on Bayes' Theorem.

It can be used for:

โ€ข Spam detection

โ€ข Sentiment analysis

โ€ข Text classification

โ€ข Document classification

โ€ข News classification

Example: Email โ†’ Extract words โ†’ Calculate probabilities โ†’ Spam probability = 92% โ†’ Classify as Spam

๐Ÿ”น 10. Medical Diagnosis Example

Suppose a disease is relatively rare. 1% of people have a disease.

A medical test is positive for 90% of people who have the disease.

At first glance, a positive test might seem to mean that the person almost certainly has the disease.
โค5
But that's not necessarily true. We also need to consider: 

โ€ข How common the disease is 

โ€ข How often the test produces false positives 

โ€ข How accurate the test is 

Bayes' Theorem combines all of this information to calculate the probability of actually having the disease given a positive test. This is called the base-rate effect.

๐Ÿ”น 11. Fraud Detection Example

Suppose a bank monitors transactions. Initially: P(Fraud) = 1%

A transaction contains unusual characteristics.

The system uses historical data to determine: P(Unusual | Fraud)

Bayes' Theorem can then help estimate: P(Fraud | Unusual)

The bank can use this probability to decide whether the transaction should be investigated.

๐Ÿ”น 12. Bayes' Theorem vs Conditional Probability

Conditional Probability answers: "What is the probability of A given B?" โ†’ $P(A|B)$

Bayes' Theorem provides a way to calculate that probability by using the reverse conditional probability:

P(A|B) = P(B|A)P(A)/P(B)

So Bayes' Theorem allows us to reverse conditional probabilities and update our beliefs using evidence.

๐Ÿ”น 13. Prior vs Likelihood vs Posterior โญ

Prior: What we believe before seeing new evidence. โ†’ $P(A)$

Likelihood: How likely the evidence is assuming A is true. โ†’ $P(B|A)$

Posterior: What we believe after considering the evidence. โ†’ $P(A|B)$ 

A simple way to remember: Prior + Evidence โ†’ Posterior

๐Ÿ”น 14. Python Example

Bayes' Theorem can be implemented directly in Python:
prior = 0.10
likelihood = 0.80
evidence = 0.20

posterior = (likelihood * prior) / evidence
print(posterior)

Output:
0.4

So the posterior probability is: 40%

๐Ÿ”น 15. Common Mistake โญ

A common mistake is confusing: P(A|B) with P(B|A)

They are generally not equal.

For example: P(Disease | Positive Test) is not necessarily the same as P(Positive Test | Disease)

This distinction is extremely important in statistics and Machine Learning.

๐ŸŽฏ Practice Questions

1. Write the formula for Bayes' Theorem.

2. What is the difference between prior and posterior probability?

3. What does "P(A|B)" mean?

4. Give two real-world applications of Bayes' Theorem.

5. Why is Bayes' Theorem useful in spam detection?

๐ŸŽฏ Key Takeaways

โœ… Bayes' Theorem updates probability using new evidence.

โœ… The basic formula is: P(A|B)=P(B|A)P(A)/P(B)

โœ… Prior probability represents our initial belief.

โœ… Likelihood measures how likely the evidence is under an assumption.

โœ… Posterior probability represents our updated belief.

โœ… Bayes' Theorem is the foundation of algorithms such as Naive Bayes.

โœ… It is widely used in spam detection, medical diagnosis, fraud detection, classification, and risk analysis.

The key idea to remember is:

ยซBayes' Theorem helps us update what we believe when new evidence becomes available.ยป

Double Tap โค๏ธ For More
โค8๐Ÿ”ฅ3
๐Ÿš€ ๐—š๐—ผ๐—ผ๐—ด๐—น๐—ฒ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ ๐ŸŽ“

Want to upgrade your resume with Google skills and certifications Explore FREE learning opportunities and build in-demand skills for today's job market.

๐Ÿ‘‰Artificial Intelligence & Generative AI
๐Ÿ“Š Data Analytics
โ˜๏ธ Cloud Computing
๐Ÿ“ข Digital Marketing
๐Ÿ” Cybersecurity
๐Ÿ’ป Tech & Career Skills

๐—˜๐—ป๐—ฟ๐—ผ๐—น๐—น ๐—™๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜๐Ÿ‘‡:- 

https://pdlink.in/4z9pdgf

๐Ÿ”ฅ Don't just collect certificates โ€” build skills that can help you stand out in 2026!
โค2๐Ÿ‘1๐Ÿ”ฅ1
Which Machine Learning algorithm is directly based on Bayes' Theorem?
Anonymous Quiz
18%
A) K-Means
11%
B) Random Forest
63%
C) Naive Bayes
8%
D) Linear Regression
๐Ÿš€ DATA ANALYTICS + AI: YOUR NEXT CAREER MOVE!

Data is everywhere. The right skills can put you ahead.
Join the PW Skills Data Analytics With AI Course and learn Excel, SQL, Python, Power BI & AI tools through live sessions and real-world projects.

โœจ What you get:
โœ… Industry-relevant Data Analytics skills
โœ… AI-powered learning
โœ… Microsoft collaboration
โœ… Hands-on projects
โœ… Job assistance*
โœ… Live classes in Hinglish

๐Ÿ“… Starts: 14th August 2026
โณ Duration: 5 Months
๐Ÿ”ฅ Ready to become a future-ready Data Analyst?
๐Ÿ‘‰
Enroll Now & Start Your Upskilling Journey!
https://lp.pwskills.com/data-analytics-with-gen-ai-online-course?utm_source=telegram&utm_medium=influencer&utm_campaign=deepakDAonline
โค8๐ŸŽ‰1