title: How to find probability of subsequences obtained from sequences in the given dataset?
body: <p>I have a dataset(CSV file) of sequence of links with their order placed status for each sequence. I have got the subsequences with their count with the help of prefixSpan algorithm(as described <a href="https://github.com/sequenceanalysis/sequenceanalysis.github.io/blob/master/notebooks/part2.ipynb" rel="nofollow noreferrer">here</a>).
  But I also want to find probability of each subsequences in leading to order placed =1. Suppose links are <code>a</code> ,<code>b</code>,<code>c</code>,<code>d</code> and their sequences and order status are as follows in data frame:</p>
  
  <pre><code>   Link sequences   Order status
      a,b,c,a,c,c                 0
      a,c,b,c                       1
      a,b,d,c,b,c                 1
      a,c,b,c                       0
  </code></pre>
  
  <p>Subsequences I get if I put minimum Support =4 with help of prefixSpan algorithm</p>
  
  <pre><code>    Subsequences            Support
       [a]                                    4
       [a,b]                                 4
       [a,b,c]                              4
       [a,c]                                 4
       [a,c,c]                              4
       [b]                                   4
       [b,c]                                4
       [c]                                   4
       [c,c]                                4
  </code></pre>
  
  <p>What changes should I make in prefixSpan algorithm code as mentioned in above link to get probability also as following :</p>
  
  <pre><code>Subsequence   Support     Prob
   [a]                          4             0.5
   [a,b]                       4             0.5
   [a,b,c]                    4             0.5
   [a,c]                       4             0.5
   [a,c,c]                    4             0.5
   [b]                          4             0.5
   [b,c]                       4             0.5
   [c]                          4             0.5
   [c,c]                       4             0.5
  </code></pre>
  
  <p>The procedure used to calculate probability of the subsequence is:</p>
  
  <p>Add order placed status of all sequences where the subsequence is present and divide it by count of sequences where it is present eg : </p>
  
  <pre><code>P(subsequence [a,c,c]) =( 0+1+1+0)/4 = 0.5
  </code></pre>