0% found this document useful (0 votes)
11 views11 pages

Bayes

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)
11 views11 pages

Bayes

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/ 11

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/361402449

Bayes Theorem and Real-life Applications

Article · June 2022

CITATION READS

1 14,321

1 author:

Yasmin Youssef
Pädagogische Hochschule Ludwigsburg, Germany & Helwan University, Cairo
10 PUBLICATIONS 10 CITATIONS

SEE PROFILE

All content following this page was uploaded by Yasmin Youssef on 18 June 2022.

The user has requested enhancement of the downloaded file.


Cairo University

Faculty of Economics and Political Science

Socio-Computing Department

Bayes Theorem and real-life applications

Abstract:
Bayes' theorem is an important part of inference statistics and many advanced machine
learning models. Bayesian inference is a logical approach to updating the potential of
hypotheses in the light of new knowledge, and therefore naturally plays a central role in
science. It explains the likelihood of an event based on prior knowledge of circumstances that
may be relevant to the event. Bayes' theorem provides a method of calculating the degree of
uncertainty. (Berrar, 2018). It can be applied in our daily lives when we are attempting to
make a decision based on new information. The aim of this research is to shed light on the
various fields in which this theory is applied.
Keywords:
Bayes’ Theorem, Probability, Total Probability, Conditional Probability.
Introduction
The Bayes Theorem is a statistical and probability-based mathematical paradigm that seeks
to compute the likelihood of one situation based on its relationship with another scenario. It
is the single most important rule for good decision-making. Bayes theorem uses the available
information and incorporates “conditional probabilities” into conclusions. It can produce
posterior probability distributions that are biased by prior probabilities.
Bayes' Theorem has made significant progress in history. During World War II, the theorem
was employed to crack the famed Nazi Enigma encryption. The translations taken from the
Enigma encryption machine used to crack the German message code were assessed using
Bayes Theorem by Alan Turing, a British mathematician. Turing and his team deciphered the
German Enigma code by using probability models to break down the nearly unlimited number
of possible translations of the messages that were most likely to be translated. (McNamara,
Green, & Olsson, 2006)
Bayes Theorem Formula
The most popular and pervasive formula used for Bayes' Theorem is as follows:
P(A ∣ B) = P(B ∣ A)P(A) / P(B)

Yasmin Youssef – Ph.D. studies 2022


Broken down, A and B are two events, and P(B) ≠ 0
P(A ∣ B) is the conditional probability of event A occurring given that B is true.
P(B ∣ A) is the conditional probability of event B occurring given that A is true.
P(A) and P(B) are the probabilities of A and B occurring independently of one another (the
marginal probability). The Bayes Theorem is based on probability in this case. More
specifically, given existing information of previous scenarios, what is the likelihood that a
scenario would occur?

https://www.slideshare.net/anniyappa/bayes-theorem-250281464

Bayes' theorem and its applications in animal behaviour:


Bayesian decision theory can be used to model animal behavior. To survive, animals must act
on uncertain data and with limited cognitive abilities. Our sensory and sensorimotor
processing is well known for using probabilistic estimation to overcome these limitations.
Indeed, probabilistic estimation explains how animals learn, forage, and choose mates (Pérez-
Escudero, 2011). The Bayes theorem is central to the theoretical considerations of how
animals integrate prior information and observations. However, we're not interested in what
inferences can be drawn about unknown parameters; rather, we're interested in whether
animals make optimal decisions given the appropriate posterior probabilities. This could be,
for example, a previously observed distribution of food patch qualities or potential mate
qualities. The animal is then assumed to be able to form a "posterior opinion" based on
sampling data, such as the quality of a given food patch or the average qualities of mates over
a year. (McNamara, Green, & Olsson, 2006) Their priors can come from one or both of two
places: either their own personal experience gained while sampling the environment, or
previous generations' adaptation to the environment. As a result, we should expect to see
"Bayesian-like" decision-making in nature on a regular basis.

Yasmin Youssef – Ph.D. studies 2022


Biological examples are the following: foraging in patches, mate choice during an annual
breeding season, growth under predation risk.
Mate choice during an annual breeding season:
Assume that each female member of a population must choose a male to mate with every
year. Males vary in quality, and a female can judge a male's quality by inspecting him. The
female examines a series of males, attempting to mate with one of the population's highest-
quality males. However, the distribution of male attributes fluctuates from year to year, so a
female does not know what range of traits are high for that year at the start of the breeding
season, before she has evaluated any male. She does, however, know how the quality
distribution changes from year to year. This information originates from the environment in
which ancestors originated for a semelparous species. For an iteroparous species, the female
has this knowledge as well as prior years' experience. The female updates her estimation of
the distribution of quality this year when she inspects males during the current breeding
season. Assume male quality has a normal distribution with mean m and variation σ 2 during
a particular year to demonstrate the updating procedure. The mean m changes from year to
year, while the within-year variation σ2 remains constant. We assume that the variation in the
2
yearly mean m across years follows a normal distribution with mean µ0 and variance v 0 In this
situation, the female learns the value of m for that year by inspecting males during the mating
season. The female has only knowledge at the start of the mating season that has been
defined by her evolutionary history and previous years' experience, therefore the prior
2
distribution of m is normal with mean µ0 and the variance v 0 . If the female has inspected a
total of n males later in the breeding season and discovered that the average quality of these
males is X̄ The posterior distribution of m given this information can then be shown to be
normal with mean using Bayes theorem. (Pérez-Escudero, 2011)

Bayes Theorem weather forecasting


The scientific process is built on the foundations of observation, knowledge gathering, and
prediction. The precision of our predictions is determined by the quality of our current
knowledge and the precision of our observations. (Puga & Krzywinski, 2015).

Yasmin Youssef – Ph.D. studies 2022


Weather forecasts are a common example—the more we understand about how weather
works, the better we can use current observations and seasonal records to predict whether
it will rain tomorrow, and any discrepancy between prediction and observation can be used
to refine the weather model.
Let’s imagine that we want to know how likely it is that it will rain when Alexa predicts rain.
Rather than the likelihood of Alexa correctly predicting rain on days when it has already
rained.
It can be written as P(Rain|RainPrediction) and read as the conditional probability of rain if
Alexa predicted rain.
1. P(Rain) which is the probability of it raining
2. P(RainPrediction) which is the probability of Alexa 'saying' it will rain
3. P(RainPrediction|Rain) which is the probability we will have a rain prediction on the
days it actually rains
4. P(Rain|RainPrediction) which is the probability of it actually raining on the days we
have a rain prediction
Some of this data is already available, while others must be calculated.
Calculating what we need to know:
-Assume it rains once every ten days where you live. You live in a dependable location with
pleasant weather and no seasons.
• Probability of rain or P(Rain) = 1/10 or 10% or .1
• P(Rain) = .1
-Alexa predicts 90% of those rainy days according to sources
So far, we've got P(Rain) and P(RainPrediction|Rain).
P(RainPrediction|Rain) is not the question we wanted answered, so this is counterintuitive.
If someone predicts an apocalypse every day of the week and the world ends one day, they
have predicted the apocalyptic day with 100% accuracy. Are they all-knowing? No.
We need one more probability before we can calculate P(Rain|RainPrediction).
The probability of Alexa making a rainy prediction, or P, is required (RainPrediction). This is
the chance of getting a rainy forecast, regardless of whether it rains or not. You can think of
it as a combination of true positives and false positives.
We know that it rains 10% of the time, and Alexa is 90% accurate in her predictions. We also
know that Alexa can predict dry weather with an accuracy of 80%. You can think of it as
being 20% off when it comes to predicting dry weather.

• In a hundred days, it rains 10 times; Alexa predicts 9 rainy days.

Yasmin Youssef – Ph.D. studies 2022


• When it didn't rain for the next 90 days, Alexa predicted that 20% of them would be
dry.
• This means that 18 days were incorrectly predicted to be rainy because 90 days *
20% = 18.
9 days that were correctly predicted + 18 days that were incorrectly predicted.
In 100 days, there will be 27 total days of rain predicted.
P(Rain|RainPredicton) is the probability of it raining when Alexa has given us a rain
prediction, and it is calculated as follows:
Rain P(Rain) =.1
RainPrediction|Rain) P(RainPrediction|Rain) P(RainPrediction|Rain) P(RainPrediction|Rain)
P
P(RainPrediction) =.27
Finally, we know that in 100 days, Alexa makes 27 rain predictions, 9 of which are correct.
• 9 correct predictions / 27 incorrect predictions = .333333
• P(Rain|RainPrediction) = 33%
We figured it out using basic mathematics. 33 percent accuracy. This type of observation is
quite common. Let's use Bayes' theorem to get the same result.
P(Rain|Prediction) = P(Prediction|Rain) x P(Rain) / P(Rain) x P(Rain) x P(Rain) x P(Rain) x
P(Rain) (Prediction)
P(Rain|Prediction) = (.9) x (.1) / (.27) =.33
Rain|Prediction P(Rain|Prediction) = 33%
(Premi, 2019)

Bayes’ theorem and its application to cardiovascular nursing


Nurses are frequently called upon to make clinical decisions for complex problems in the face
of uncertainty and unpredictability. This decision-making is frequently based on best guesses
based on available evidence. Furthermore, nurses are increasingly being asked to order and
interpret diagnostic tests, necessitating an understanding of the importance of predicting the
likelihood of specific outcomes. Chance, or a numerical measure of the uncertainty associated
with an event or events, is represented by probabilities. The probabilistic approach reveals
the degree of uncertainty associated with a specific outcome, such as a diagnosis or test
result. As a result, Bayesian statistics can be useful in clinical nursing judgments and decision-
making (Thompson & Martin, 2017). The axiomatic bases of Bayesian premises allow for
direct comparisons of nursing diagnoses in various realities in order to determine whether
the information discovered can be used as valid information in the form of a prior distribution.

Yasmin Youssef – Ph.D. studies 2022


The available knowledge and research data can then be summarised in a posterior
distribution that presents punctual and interval estimates of the actual probability of a
nursing diagnosis, providing a more intuitive interpretation that is more accurate (Lopes &
Martins da Silva, 2012). In contrast to classical statistical methods, which treat each study on
the same theme independently, ignoring the existence of previous data, Bayesian methods
use significantly more information about a phenomenon, expressed in the form of a single
probability distribution. The application of Bayesian methods in cardiovascular nursing
research can, for example, be useful for analysing the probability of diagnoses in specific
groups, as well as analysing rare events, regardless of sample size. Furthermore, the Bayesian
paradigm works with the concept of uncertainty, allowing it to be used in approaches that
aim to determine factors like accuracy, sensitivity, and specificity (Thompson & Martin, 2017).
Despite the advantages listed, it's important to note that using Bayesian analysis has its own
set of challenges and limitations. These drawbacks include the need for statistical
distributions and calculus knowledge, the use of specialized software with difficult-to-use
interfaces, and the requirement to create a prior distribution based on prior knowledge. Due
to the lack of prior information, the latter is always simple. Uniform distributions are used in
some cases, or the prior distribution is defined subjectively. (Lopes & Martins da Silva, 2012).
Applications of Bayes' theorem for predicting environmental damage
Predicting water quality conditions
The suitability of a water body for its intended use (such as drinking water, recreation, or
agricultural use) is determined by whether or not the measured pollutant concentrations
exceed water quality standard numeric limits. Scientists typically measure indicators that
serve as potential surrogates for the pollutant of concern because these pollutants can't
always be measured directly. Depending on the type of pollutant, the strength of the
relationship between an indicator concentration and the concentration of the pollutant it is
supposed to represent varies greatly. The concentration of nonpathogenic faecal indicator
bacteria (FIB) such as faecal coliforms and Escherichia coli, for example, is used to determine
water quality in recreational and shellfish-harvesting waters across the United States. These
bacteria are employed as a conservative indication of faecal contamination and the presence
of potentially hazardous waterborne pathogens, which are more directly connected to human
and environmental health but also more difficult and expensive to assess. Depending on the
specific pollutant and associated indicator, it is clear that not only the pollutant-indicator
relationship, but also the spatial and temporal frequency of sampling, as well as other factors,
may all contribute to uncertainty and variability in environmental condition forecasts. We
present a Bayesian approach to assessing water quality conditions in a shellfish harvesting
area using faecal coliform concentration measurements (reported in organisms per 100 ml)
as an example.
FIB concentrations are commonly assumed to follow a lognormal LN (μ, σ) probability
distribution with log-concentration mean (μ) and log-concentration standard deviation
(σ). Even though this common probability model recognises natural spatial and temporal
variability in FIB dispersion patterns, it (like other simple probability models) frequently fails
to explicitly acknowledge other, more subtle sources of variability, such as intrinsic sources

Yasmin Youssef – Ph.D. studies 2022


arising from FIB concentration measurements and how FIB concentrations are calculated, all
of which can lead to uncertainty not only in FIB concentration predictions, but also in
probability distributions. We can explicitly acknowledge these uncertainties in a Bayesian
framework by first applying a prior probability distribution to the population parameters μ
and σ (which may account for a priori beliefs about their potential values), then developing a
likelihood function for and based on empirical evidence (in this case, water quality samples),
and finally deriving a joint posterior probability distribution for both. The smoothed contour
plot of the joint posterior probability density for the faecal coliform log-concentration mean
(μ) and standard deviation (σ) for a sample site in eastern North Carolina shows the results of
this procedure. (Gronewold & Vallero, 2010)

Applications of Bayes' theorem in Machine learning


Bayes Theorem is likewise broadly used in the field of machine learning. The Bayes theorem
allows us to calculate P(B|A) in terms of P(A|B), P(B), and P(A) (A). This rule comes in handy
when we need to determine the fourth term and have a high probability of P(A|B), P(B), and
P(A). The simplest application of the Bayes theorem is the Naive Bayes classifier, which is used
in classification algorithms to isolate data based on accuracy, speed, and classes. Let's look at
an example of how Bayes theorem is used in machine learning.
Assume we have a vector A with the attribute I. It signifies A = A1, A2, A3, A4,.............. Ai
We also have n classes represented as C1, C2, C3, C4, ............Cn.
These are two conditions that have been supplied to us, and our Machine Language-based
classifier must predict A, with the best possible class being the first option. So, using Bayes'
theorem, we can formulate it as follows:

Yasmin Youssef – Ph.D. studies 2022


Here, P(Ci/A)= [P(A/Ci) * P(Ci)] / P(A)
The condition-independent entity is P(A).
P(A) will remain constant throughout the class, which means that its value will not change
while the class changes. To maximise P(Ci/A), we must increase the value of P(A/Ci) * P. (Ci).
Let's assume that there are n number of classes on the probability list and that any class
could be the correct answer.
P(C1)=P(C2)-P(C3)=P(C4)=P(C5)=P(C6)=P(C7)=P(C8)=P(C9)=P(C10)=P( (Cn).
This method aids in the reduction of computing costs and time. This is how the Bayes
theorem is important in Machine Learning, and the Naive Bayes theorem has made
conditional probability jobs easier without sacrificing precision.
As a result, we can deduce: P(Ai/C) = P(A1/C) * P(A2/C) * P(A3/C) *......*P(An/C)
As a result, we can easily describe the possibilities of smaller events using Bayes theorem in
Machine Learning.
The supervised method Naive Bayes theorem is based on Bayes theorem and is used to
solve classification problems. It's one of the most straightforward and successful
classification algorithms in Machine Learning, allowing us to create a variety of ML models
for quick predictions. It's a probabilistic classifier, which means it makes predictions based
on the likelihood of an object.
Spam filtration, sentiment analysis, and article classification are all examples of popular
Naive Bayes algorithms. (JavaTpoint, 2021)

Applications of Bayes' theorem in Business and Finance


In business and life, making the right decision the right decision is the most essential thing
you can do with the Bayes Theorem. Wrong judgments can haunt you for the rest of your life,
but the right decision can mean billions of dollars, years of happiness, serenity, riches, and
health, among other things. It's always beneficial to plan for a bright future.
(Nagarani, Karpagam, Vasuki, & Sundarakannan, 2021)
Consider the following scenarios:
a) When assessing interest rates.
Companies rely on interest rates for a variety of reasons, including borrowing money,
investing in the fixed income market, and trading currencies internationally. Unexpected
changes in interest rate values can be costly to a company's bottom line and have a negative
impact on profits and revenues. Companies can better evaluate systematic changes in interest

Yasmin Youssef – Ph.D. studies 2022


rates and direct their financial resources to take advantage using the Bayes Theorem and
estimated probabilities.
b) With a profit.
Businesses want to be on top of their net income streams, or the profit earned after deducting
expenses from the equation. For starters, net income is highly vulnerable to external events
such as legal proceedings, weather, the cost of necessary equipment and materials, and
geopolitical events. When probability scenarios arise, financial decision-makers have a
stronger platform to manage resources and make critical decisions by plugging them into the
net income equation.
c) For extending credit.
Under the Bayes Theorem conditional probability model, financial companies can make
better decisions and better evaluate the risk of lending cash to unfamiliar or even existing
borrowers. For example, an existing client may have had a good previous track record of
repaying loans, but lately, the client has been slow in playing This additional information,
based on probability theory, can lead the company to treat the slow payment history as a red
flag, and either hike interest rates on the loan or reject it altogether. (O'Connell, 2018)
In business and in life, making the correct decision is the most essential thing you can do with
the Bayes Theorem. It might imply making the Organization, Institution, or Company worth
billions of dollars, years of enjoyment, peace, riches, and health, and so on. It is always quite
beneficial to decide on a nice future.

Conclusion:
As discussed above application of Bayes’ Theorem can be found in the field of medicine
involving uncertainty related to diagnosis, treatment selection, and prediction of prognosis.
It can be used in finance and business, in machine learning for creating a spam filter
application, used for classifying whether an email is spam or otherwise, and in predicting
environmental damage, weather forecasting, and animal behavior. IT also includes fields like
dating, by examining your current friendships or partners you have had, you can better
understand the selection effects and modify your actions or behaviors in order to form
more relationships that you think are most valuable. Fields like psychology, bioinformatics,
legal applications, and searching for lost objects also apply the Bayes theorem. Bayes'
theorem gives a simple approach to reasoning and computing. It enables us to use past
information and observations to develop predictions about the event under consideration
or study. All unknowns in a system are modelled in Bayesian inference by utilizing Bayes'
theorem to update probability distributions when the evidence mounts. Despite the fact
that Thomas Bayes developed it in the 18th century, we can see that it still benefits mankind
in many ways today.

Yasmin Youssef – Ph.D. studies 2022


References
Berrar, D. (2018). Bayes' Theorem and Naive Bayes Classifier. Tokyo, Japan: Data Science Laboratory,
Tokyo Institute of Technology. doi:DOI: 10.1016/B978-0-12-809633-8.20473-1

Gronewold, A. D., & Vallero, D. A. (2010). Applications of Bayes' theorem for predicting
environmental damage. Access Science - The Science Authority.
doi:https://doi.org/10.1036/1097-8542.YB100249 (https://doi.org/10.1036/1097-
8542.YB100249)

JavaTpoint. (2021). Bayes Theorem in Machine learning. Retrieved May 5, 2022, from javatpoint.:
https://www.javatpoint.com/bayes-theorem-in-machine-learning

Lopes, M. V., & Martins da Silva, V. (2012, 12 22). Nursing diagnoses analysis under the bayesian
perspective. Revista da Escola de Enfermagem da USP, 46(4), 985-91. Retrieved April 26,
2022, from
https://www.scielo.br/j/reeusp/a/V6YvhpLPBFSRtwYzW3Qz7yz/?format=pdf&lang=en

McNamara, J. M., Green, R. F., & Olsson, O. (2006). Bayes’ theorem and its applications in animal
behaviour. Oikos, 112(2), 243-251. Retrieved from . https://doi.org/10.1111/j.0030-
1299.2006.14228.x

Nagarani, V., Karpagam, A., Vasuki, B., & Sundarakannan, N. (2021, February ). Real Life Applications
of Bayes Theorem. JAC : A Journal Of Composition Theory, Volume XIV,(II). Retrieved April 19,
2022, from http://www.jctjournal.com/gallery/21-feb2021.pdf

O'Connell, B. (2018, December 3). The Street . Retrieved from What is Bayes Theorem and why is it
important in Business and Finance?: https://www.thestreet.com/personal-
finance/education/what-is-bayes-theorem-14797035

Pérez-Escudero, A. (2011). Collective Animal Behavior from Bayesian Estimation and Probability
Matching. PLOS Computional Biology. doi: doi:10.1371/journal.pcbi.1002282

Premi, A. (2019, July 17). A Quick Introduction to Bayes' Theorem or Why Weather Predictions Can
Suck. Retrieved from https://www.linkedin.com/pulse/quick-introduction-bayes-theorem-
why-weather-can-suck-awal-premi/

Puga, J. L., & Krzywinski, M. &. (2015, March 31). Bayes’ theorem. Nature Methods, 277–278.
doi:doi:10.1038/nmeth.3335

Thompson, D. R., & Martin, C. R. (2017, Deecmber 1). Bayes’ theorem and its application to
cardiovascular nursing. European Journal of Cardiovascular Nursing, 16(8) , 659–661.
doi:https://doi.org/10.1177/1474515117712317

Yasmin Youssef – Ph.D. studies 2022

View publication stats

You might also like