SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
Graphs and Markov chains
Graphs as matrices
0 1 2 3 4
If there is an edge
(arrow) from node ! to
node ", then #!" = 1
(otherwise zero)
Matrix-vector multiplication:
! = # $ = %! # : , 1 + %" * : , 2 + ⋯ + %# * : , - … + %$ * : , /
Contain all the nodes that are
reachable from node !
Hence, if we multiply $ by the %" unit vector, we get a vector that
indicates all the nodes that are reachable by node !. For example,
# =
1
1
1
0
1
1
0
1
0
0
0
0
1
1
1
0
0
0
0
0
0
1
0
0
0
# '! =
1
1
1
0
1
1
0
1
0
0
0
0
1
1
1
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
=
0
0
1
1
1
Using graphs to represent the transition
from one state to the next
After collecting data about the weather for many years, you observed
that the chance of a rainy day occurring after a rainy day is 50% and that
the chance of a rainy day after a sunny day is 10%.
SUNNY RAINY
Sunny Rainy
Sunny
Rainy
The graph can be represented as an adjacency
matrix, where the edge weights are the probabilities
of weather conditions (transition matrix)
Transition (or Markov) matrices
• Note that only the most recent state matters to determine the
probability of the next state (in this example, the weather predictions
for tomorrow will only depend on the weather conditions of today) –
memoryless process!
• This is called the Markov property, and the model is called a
Markov chain
SUNNY RAINY
10% Sunny Rainy
Sunny
Rainy
50%
50%
90%
Transition (or Markov) matrices
• The transition matrix describe the transitions of a Markov chain. Each
entry is a non-negative real number representing a probability.
• (I,J) entry of the transition matrix has the probability of transitioning
from state J to state I.
• Columns add up to one.
SUNNY RAINY
10% Sunny Rainy
Sunny
Rainy
50%
50%
90%
What if I want to know the probability of days that are
sunny in the long run?
• Initial guess for weather condition on day 1: &+
• Use the transition matrix to obtain the weather probability on the
following days:
• Predictions for the weather on more distant days are increasingly
inaccurate.
• What does this look like? Power iteration method!
• Power iteration method converges to steady-state vector, that gives
the weather probabilities in the long-run.
&∗ = $ &∗
$∗ is the eigenvector corresponding to eigenvalue ( = 1
• This “long-run equilibrium state” is reached regardless of the current
state.
&- = $ &+ &. = $ &- &/ = $ &0
…
D
H - E '
' 990,0 ,
o ]
DO
Page Rank
Webpage 3
Webpage 2
Webpage 1
Webpage 4
Problem: Consider + linked webpages (above we have + = 4). Rank
them.
• A link to a page increases the perceived importance of a webpage
• We can represent the importance of each webpage . with the scalar /1
Page Rank
Webpage 3
Webpage 2
Webpage 1
Webpage 4
A possible way to rank webpages…
• /1 is the number of links to page . (incoming links)
• /- = 2, /. = 1, /2 = 3, /0 = 2
• Issue: when looking at the links to webpage 1, the link from webpage 3
will have the same weight as the link from webpage 4.Therefore, links
from important pages like “The NYTimes” will have the same weight as
other less important pages, such as “News-Gazette”.
Mariana
New Gaz NY
Page Rank
Another way… Let’s think of Page Rank as an stochastic process.
http://infolab.stanford.edu/~backrub/google.html
“PageRank can be thought of as a model of user behavior.We assume there
is a random surfer who is given a web page at random and keeps clicking
on links, never hitting “back”…”
So the importance of a web page can be determined by the probability of a
random user to end up on that page.
Page Rank
Let us write this graph problem
(representing webpage links) as a matrix
(adjacency matrix).
0 1 2 3 4 5
2 2 3 1 1 1
Number of outgoing links for each webpage "
dotted
It
Page Rank
• The influence of each page is split
evenly between the pages it links to
(i.e., equal weights for each outgoing
link)
• Therefore, we should divide each row
entry by the total column sum
0 1 2 3 4 5
0 1 1
1 0
1 0
1 1 0
1 0
1 1 1 0
0 1 2 3 4 5
0 1.0 1.0
0.5 0
0.5 0
0.5 0.33 0
0.33 0
0.5 0.33 1.0 0
A-
-
a
'¥ff n
-
Page Rank
Note that the sum of each column is equal
to 1.This is the Markov matrix!
0 1.0 1.0
0.5 0
0.5 0
0.5 0.33 0
0.33 0
0.5 0.33 1.0 0
# =
We want to know the probability of a user to end up in each one of the
above 6 webpages, when starting at random from one of them.
Suppose that we start with the following probability at time step 0:
&+ = (0.1,0.2,0.1,0.3,0.1,0.2)
What is the probability that the user will be at “webpage 3” at time step 1?
# =
0
0.5
0
0
0
0.5
0
0
0.5
0.5
0
0
0
0
0
0.33
0.33
0.33
1.0
0
0
0
0
0
0
0
0
0
0
1.0
1.0
0
0
0
0
0
5" =
0.1
0.2
0.1
0.3
0.1
0.2
5# = # 5" =
0.5
0.05
0.1
0.133
0.033
0.184
The user will have a probability of about 13% to
be at “webpage 3” at time step 1.
At steady-state, what is the most likely page the user will end up at, when
starting from a random page?
Perform &9 = $ &9:- until convergence!
Page Rank
The plot below shows the probabilities of a user
ending up at each webpage for each time step.
0
1
2
3
4
5
The most “important” page is the one with the highest probability. Hence, the
ranking for these 6 webpages would be (starting from the most important):
Webpages 0,5,1,3,2,4
Page Rank
0 1 2 3 4 5
0 1
1 0
1 0
1 1 0
1 0
1 1 1 0
Note that we can no longer
divide the entries of the last
column by the total column
sum, which in this case is zero
(no outgoing links).
What if we now remove the link
from webpage 5 to webpage 0?
'
16
'
16
46
46
46
'
16
"
o
0 1 2 3 4 5
0 1
1 0
1 0
1 1 0
1 0
1 1 1 0
0 1 2 3 4 5
0 1.0 0.166
0.5 0 0.166
0.5 0 0.166
0.5 0.33 0 0.166
0.33 0 0.166
0.5 0.33 1.0 0.166
Approach: Since a random user
will not stay on the same webpage
forever, we can assume that all the
other webpages have the same
probability to be linked from
“webpage 5”.
Page Rank
# =
0
0.5
0
0
0
0.5
0
0
0.5
0.5
0
0
0
0
0
0.33
0.33
0.33
1.0
0
0
0
0
0
0
0
0
0
0
1.0
0.166
0.166
0.166
0.166
0.166
0.166
The plot below shows the probabilities
of a user ending up at each webpage for
each time step.
The most “important” page is the one with the highest probability. Hence, the
ranking for these 6 webpages would be (starting from the most important):
Webpages 5,0,3,1,2,4
0
1
2
3
4
5
-
-
-0
8080
Page Rank
One remaining issue: the Markov matrix does not guarantee a unique solution
! =
0
1
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
1 2
3
4
5
MatrixA has two eigenvectors corresponding to the same eigenvalue 1
5∗ =
0.33
0.33
0.33
0
0
5∗ =
0
0
0
1
1
Perron-Frobenius theorem (CIRCA 1910):
If $ is a Markov matrix with all positive
entries, then M has unique steady-state
vector &∗.
Ax
Page Rank
Brin-Page (1990s) proposed:“PageRank can be thought of as a model of user
behavior.We assume there is a random surfer who is given a web page at random
and keeps clicking on links, never hitting “back”, but eventually gets bored and
starts on another random page.”
So a surfer clicks on a link on the current page with probability 0.85 and opens a
random page with probability 0.15.
This model makes all entries of ! greater than zero, and guarantees a unique
solution.
" = 0.85 ( +
0.15
+
Breatht
"
105
it::
0
1
2
3
4
5
" = 0.85 ( +
0.15
+
Page Rank
Iclicker question
For the Page Rank problem, we have to compute
6 = 0.85 $ +
0.15
+
And then perform a matrix-vector multiplications &9= 6 &9:-
What is the cost of the matrix-vector multiplication : &9:-?
A) ; 1
B) ; +
C) ; +.
D) ; +2
G =
a M t
that 8
Fett e
G x =
a
Mmx
tunIEw
* I:µnn÷Tj:

Weitere ähnliche Inhalte

Ähnlich wie 15-Markov-Chains-post.pdf

Google finalversionfixed
Google finalversionfixedGoogle finalversionfixed
Google finalversionfixedJohnels
 
c++ Data Types and Selection
c++ Data Types and Selectionc++ Data Types and Selection
c++ Data Types and SelectionAhmed Nobi
 
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)Ivan Corneillet
 
654719957459169719-gann-markov-games-presentation.pptx
654719957459169719-gann-markov-games-presentation.pptx654719957459169719-gann-markov-games-presentation.pptx
654719957459169719-gann-markov-games-presentation.pptxBiswajitLohar
 
Position Analysis One-DOF LinkageVector Loop Represent.docx
Position Analysis One-DOF LinkageVector Loop Represent.docxPosition Analysis One-DOF LinkageVector Loop Represent.docx
Position Analysis One-DOF LinkageVector Loop Represent.docxharrisonhoward80223
 
PageRank_algorithm_Nfaoui_El_Habib
PageRank_algorithm_Nfaoui_El_HabibPageRank_algorithm_Nfaoui_El_Habib
PageRank_algorithm_Nfaoui_El_HabibEl Habib NFAOUI
 
How does Google Google: A journey into the wondrous mathematics behind your f...
How does Google Google: A journey into the wondrous mathematics behind your f...How does Google Google: A journey into the wondrous mathematics behind your f...
How does Google Google: A journey into the wondrous mathematics behind your f...David Gleich
 
page rank explication et exemple formule
page rank explication et exemple  formulepage rank explication et exemple  formule
page rank explication et exemple formuleRamiHarrathi1
 
Theory of probability and probability distribution
Theory of probability and probability distributionTheory of probability and probability distribution
Theory of probability and probability distributionpolscjp
 
Link analysis .. Data Mining
Link analysis .. Data MiningLink analysis .. Data Mining
Link analysis .. Data MiningMustafa Salam
 
A/B test with problematic data
A/B test with problematic dataA/B test with problematic data
A/B test with problematic dataBen Paul
 
Random Variable & Probability Distribution 1.pptx
Random Variable & Probability Distribution 1.pptxRandom Variable & Probability Distribution 1.pptx
Random Variable & Probability Distribution 1.pptxJAYARSOCIAS3
 
Link Prediction in Evolving Networks Base on Information Propagation Screenshots
Link Prediction in Evolving Networks Base on Information Propagation ScreenshotsLink Prediction in Evolving Networks Base on Information Propagation Screenshots
Link Prediction in Evolving Networks Base on Information Propagation ScreenshotsVenkat Projects
 
Behind the Performance of Quake 3 Engine: Fast Inverse Square Root
Behind the Performance of Quake 3 Engine: Fast Inverse Square RootBehind the Performance of Quake 3 Engine: Fast Inverse Square Root
Behind the Performance of Quake 3 Engine: Fast Inverse Square RootMaksym Zavershynskyi
 
Week 3-4 solutions
Week 3-4 solutionsWeek 3-4 solutions
Week 3-4 solutionsBrian Larson
 
1Linear Regression and Time Studies 2Linear Regres
1Linear Regression and Time Studies 2Linear Regres1Linear Regression and Time Studies 2Linear Regres
1Linear Regression and Time Studies 2Linear RegresAnastaciaShadelb
 
algebra lineal ada5c97a-340b-4ae9-afce-b864c9f851df.pdf
algebra lineal ada5c97a-340b-4ae9-afce-b864c9f851df.pdfalgebra lineal ada5c97a-340b-4ae9-afce-b864c9f851df.pdf
algebra lineal ada5c97a-340b-4ae9-afce-b864c9f851df.pdfenigmagb9
 
Presentation_Binomial and poisson distribution (1).pdf
Presentation_Binomial and poisson distribution (1).pdfPresentation_Binomial and poisson distribution (1).pdf
Presentation_Binomial and poisson distribution (1).pdfMalika Fatma
 

Ähnlich wie 15-Markov-Chains-post.pdf (20)

Google finalversionfixed
Google finalversionfixedGoogle finalversionfixed
Google finalversionfixed
 
c++ Data Types and Selection
c++ Data Types and Selectionc++ Data Types and Selection
c++ Data Types and Selection
 
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)
Monte Carlo Simulations (UC Berkeley School of Information; July 11, 2019)
 
654719957459169719-gann-markov-games-presentation.pptx
654719957459169719-gann-markov-games-presentation.pptx654719957459169719-gann-markov-games-presentation.pptx
654719957459169719-gann-markov-games-presentation.pptx
 
Position Analysis One-DOF LinkageVector Loop Represent.docx
Position Analysis One-DOF LinkageVector Loop Represent.docxPosition Analysis One-DOF LinkageVector Loop Represent.docx
Position Analysis One-DOF LinkageVector Loop Represent.docx
 
PageRank_algorithm_Nfaoui_El_Habib
PageRank_algorithm_Nfaoui_El_HabibPageRank_algorithm_Nfaoui_El_Habib
PageRank_algorithm_Nfaoui_El_Habib
 
How does Google Google: A journey into the wondrous mathematics behind your f...
How does Google Google: A journey into the wondrous mathematics behind your f...How does Google Google: A journey into the wondrous mathematics behind your f...
How does Google Google: A journey into the wondrous mathematics behind your f...
 
page rank explication et exemple formule
page rank explication et exemple  formulepage rank explication et exemple  formule
page rank explication et exemple formule
 
Theory of probability and probability distribution
Theory of probability and probability distributionTheory of probability and probability distribution
Theory of probability and probability distribution
 
Link analysis .. Data Mining
Link analysis .. Data MiningLink analysis .. Data Mining
Link analysis .. Data Mining
 
A/B test with problematic data
A/B test with problematic dataA/B test with problematic data
A/B test with problematic data
 
Diff eq
Diff eqDiff eq
Diff eq
 
Random Variable & Probability Distribution 1.pptx
Random Variable & Probability Distribution 1.pptxRandom Variable & Probability Distribution 1.pptx
Random Variable & Probability Distribution 1.pptx
 
Link Prediction in Evolving Networks Base on Information Propagation Screenshots
Link Prediction in Evolving Networks Base on Information Propagation ScreenshotsLink Prediction in Evolving Networks Base on Information Propagation Screenshots
Link Prediction in Evolving Networks Base on Information Propagation Screenshots
 
Behind the Performance of Quake 3 Engine: Fast Inverse Square Root
Behind the Performance of Quake 3 Engine: Fast Inverse Square RootBehind the Performance of Quake 3 Engine: Fast Inverse Square Root
Behind the Performance of Quake 3 Engine: Fast Inverse Square Root
 
Week 3-4 solutions
Week 3-4 solutionsWeek 3-4 solutions
Week 3-4 solutions
 
1Linear Regression and Time Studies 2Linear Regres
1Linear Regression and Time Studies 2Linear Regres1Linear Regression and Time Studies 2Linear Regres
1Linear Regression and Time Studies 2Linear Regres
 
algebra lineal ada5c97a-340b-4ae9-afce-b864c9f851df.pdf
algebra lineal ada5c97a-340b-4ae9-afce-b864c9f851df.pdfalgebra lineal ada5c97a-340b-4ae9-afce-b864c9f851df.pdf
algebra lineal ada5c97a-340b-4ae9-afce-b864c9f851df.pdf
 
Presentation_Binomial and poisson distribution (1).pdf
Presentation_Binomial and poisson distribution (1).pdfPresentation_Binomial and poisson distribution (1).pdf
Presentation_Binomial and poisson distribution (1).pdf
 
1631 the binomial theorem
1631 the binomial theorem1631 the binomial theorem
1631 the binomial theorem
 

Kürzlich hochgeladen

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 

Kürzlich hochgeladen (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

15-Markov-Chains-post.pdf

  • 2. Graphs as matrices 0 1 2 3 4 If there is an edge (arrow) from node ! to node ", then #!" = 1 (otherwise zero)
  • 3. Matrix-vector multiplication: ! = # $ = %! # : , 1 + %" * : , 2 + ⋯ + %# * : , - … + %$ * : , / Contain all the nodes that are reachable from node ! Hence, if we multiply $ by the %" unit vector, we get a vector that indicates all the nodes that are reachable by node !. For example, # = 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 # '! = 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 = 0 0 1 1 1
  • 4. Using graphs to represent the transition from one state to the next After collecting data about the weather for many years, you observed that the chance of a rainy day occurring after a rainy day is 50% and that the chance of a rainy day after a sunny day is 10%. SUNNY RAINY Sunny Rainy Sunny Rainy The graph can be represented as an adjacency matrix, where the edge weights are the probabilities of weather conditions (transition matrix)
  • 5. Transition (or Markov) matrices • Note that only the most recent state matters to determine the probability of the next state (in this example, the weather predictions for tomorrow will only depend on the weather conditions of today) – memoryless process! • This is called the Markov property, and the model is called a Markov chain SUNNY RAINY 10% Sunny Rainy Sunny Rainy 50% 50% 90%
  • 6. Transition (or Markov) matrices • The transition matrix describe the transitions of a Markov chain. Each entry is a non-negative real number representing a probability. • (I,J) entry of the transition matrix has the probability of transitioning from state J to state I. • Columns add up to one. SUNNY RAINY 10% Sunny Rainy Sunny Rainy 50% 50% 90%
  • 7. What if I want to know the probability of days that are sunny in the long run? • Initial guess for weather condition on day 1: &+ • Use the transition matrix to obtain the weather probability on the following days: • Predictions for the weather on more distant days are increasingly inaccurate. • What does this look like? Power iteration method! • Power iteration method converges to steady-state vector, that gives the weather probabilities in the long-run. &∗ = $ &∗ $∗ is the eigenvector corresponding to eigenvalue ( = 1 • This “long-run equilibrium state” is reached regardless of the current state. &- = $ &+ &. = $ &- &/ = $ &0 … D H - E ' ' 990,0 , o ] DO
  • 8. Page Rank Webpage 3 Webpage 2 Webpage 1 Webpage 4 Problem: Consider + linked webpages (above we have + = 4). Rank them. • A link to a page increases the perceived importance of a webpage • We can represent the importance of each webpage . with the scalar /1
  • 9. Page Rank Webpage 3 Webpage 2 Webpage 1 Webpage 4 A possible way to rank webpages… • /1 is the number of links to page . (incoming links) • /- = 2, /. = 1, /2 = 3, /0 = 2 • Issue: when looking at the links to webpage 1, the link from webpage 3 will have the same weight as the link from webpage 4.Therefore, links from important pages like “The NYTimes” will have the same weight as other less important pages, such as “News-Gazette”. Mariana New Gaz NY
  • 10. Page Rank Another way… Let’s think of Page Rank as an stochastic process. http://infolab.stanford.edu/~backrub/google.html “PageRank can be thought of as a model of user behavior.We assume there is a random surfer who is given a web page at random and keeps clicking on links, never hitting “back”…” So the importance of a web page can be determined by the probability of a random user to end up on that page.
  • 11. Page Rank Let us write this graph problem (representing webpage links) as a matrix (adjacency matrix). 0 1 2 3 4 5 2 2 3 1 1 1 Number of outgoing links for each webpage " dotted It
  • 12. Page Rank • The influence of each page is split evenly between the pages it links to (i.e., equal weights for each outgoing link) • Therefore, we should divide each row entry by the total column sum 0 1 2 3 4 5 0 1 1 1 0 1 0 1 1 0 1 0 1 1 1 0 0 1 2 3 4 5 0 1.0 1.0 0.5 0 0.5 0 0.5 0.33 0 0.33 0 0.5 0.33 1.0 0 A- - a '¥ff n -
  • 13. Page Rank Note that the sum of each column is equal to 1.This is the Markov matrix! 0 1.0 1.0 0.5 0 0.5 0 0.5 0.33 0 0.33 0 0.5 0.33 1.0 0 # = We want to know the probability of a user to end up in each one of the above 6 webpages, when starting at random from one of them. Suppose that we start with the following probability at time step 0: &+ = (0.1,0.2,0.1,0.3,0.1,0.2) What is the probability that the user will be at “webpage 3” at time step 1?
  • 14. # = 0 0.5 0 0 0 0.5 0 0 0.5 0.5 0 0 0 0 0 0.33 0.33 0.33 1.0 0 0 0 0 0 0 0 0 0 0 1.0 1.0 0 0 0 0 0 5" = 0.1 0.2 0.1 0.3 0.1 0.2 5# = # 5" = 0.5 0.05 0.1 0.133 0.033 0.184 The user will have a probability of about 13% to be at “webpage 3” at time step 1. At steady-state, what is the most likely page the user will end up at, when starting from a random page? Perform &9 = $ &9:- until convergence! Page Rank
  • 15. The plot below shows the probabilities of a user ending up at each webpage for each time step. 0 1 2 3 4 5 The most “important” page is the one with the highest probability. Hence, the ranking for these 6 webpages would be (starting from the most important): Webpages 0,5,1,3,2,4 Page Rank
  • 16. 0 1 2 3 4 5 0 1 1 0 1 0 1 1 0 1 0 1 1 1 0 Note that we can no longer divide the entries of the last column by the total column sum, which in this case is zero (no outgoing links). What if we now remove the link from webpage 5 to webpage 0? ' 16 ' 16 46 46 46 ' 16 " o
  • 17. 0 1 2 3 4 5 0 1 1 0 1 0 1 1 0 1 0 1 1 1 0 0 1 2 3 4 5 0 1.0 0.166 0.5 0 0.166 0.5 0 0.166 0.5 0.33 0 0.166 0.33 0 0.166 0.5 0.33 1.0 0.166 Approach: Since a random user will not stay on the same webpage forever, we can assume that all the other webpages have the same probability to be linked from “webpage 5”.
  • 18. Page Rank # = 0 0.5 0 0 0 0.5 0 0 0.5 0.5 0 0 0 0 0 0.33 0.33 0.33 1.0 0 0 0 0 0 0 0 0 0 0 1.0 0.166 0.166 0.166 0.166 0.166 0.166 The plot below shows the probabilities of a user ending up at each webpage for each time step. The most “important” page is the one with the highest probability. Hence, the ranking for these 6 webpages would be (starting from the most important): Webpages 5,0,3,1,2,4 0 1 2 3 4 5 - - -0 8080
  • 19. Page Rank One remaining issue: the Markov matrix does not guarantee a unique solution ! = 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 2 3 4 5 MatrixA has two eigenvectors corresponding to the same eigenvalue 1 5∗ = 0.33 0.33 0.33 0 0 5∗ = 0 0 0 1 1 Perron-Frobenius theorem (CIRCA 1910): If $ is a Markov matrix with all positive entries, then M has unique steady-state vector &∗. Ax
  • 20. Page Rank Brin-Page (1990s) proposed:“PageRank can be thought of as a model of user behavior.We assume there is a random surfer who is given a web page at random and keeps clicking on links, never hitting “back”, but eventually gets bored and starts on another random page.” So a surfer clicks on a link on the current page with probability 0.85 and opens a random page with probability 0.15. This model makes all entries of ! greater than zero, and guarantees a unique solution. " = 0.85 ( + 0.15 + Breatht " 105 it::
  • 21. 0 1 2 3 4 5 " = 0.85 ( + 0.15 + Page Rank
  • 22. Iclicker question For the Page Rank problem, we have to compute 6 = 0.85 $ + 0.15 + And then perform a matrix-vector multiplications &9= 6 &9:- What is the cost of the matrix-vector multiplication : &9:-? A) ; 1 B) ; + C) ; +. D) ; +2 G = a M t that 8 Fett e G x = a Mmx tunIEw * I:µnn÷Tj: