http://bo-yang.github.io/2014/08/09/retrive-string-from-slices/
Given a string, such as 01001010101001101011, we can randomly sliced multiple substrings. Assume that during the slicing, due to some unexpected noises, some characters may flip(0->1 or 1->0). For example:
- Position: 0123456789.........
- String: 01001010101001101011
- slice1: 1001110101000
- slice2: 1010111001111
- slice3: 10101
- slice4: 1101011
In above sample, slice1
starts from position 1(assume that the index of a string begins with 0), slice2
starts from position 4, slice3
starts from 4, and slice4
starts from 13. In slice1, 0
flips to 1
at position 5 and 1
flips to 0
at position 13.
For one specific position in the original string, if it is 1
, then the probability of flipping to 0 in a slicing is 0.1; and vice versa(i.e.Prob(0->1)=0.1).
The problem is: if we only have multiple slices(the length of each slice may vary) and their starting positions in the string, and we don’t know the original string, given an arbitrary position in the original string, how can we calculate the probability that position is a 1
?
Assume most positions will be covered at least once in slices, and we have following parameters:
p01=0.1; // Probability a ‘0’ in string but flipped to a ‘1’ in a slice
p10=0.1; // Probability a ‘1’ in string but flipped to a ‘0’ in a slice
p1=0.5; // Prior probability that any given position in string is a ‘1’
We can also assume that the string is a random string of 0
s and 1
s, and during slicing, each position is sampled independently.
For the above example string and four slices, we already have following probabilities for each position:
- See more at: http://bo-yang.github.io/2014/08/09/retrive-string-from-slices/#sthash.yq8MpikN.dpuf
Pos Prob
0 0.500
1 0.900
2 0.100
3 0.100
4 0.999
5 0.100
6 0.999
7 0.001
8 0.999
9 0.500
10 0.988
11 0.012
12 0.012
13 0.900
14 0.988
15 0.500
16 0.988
17 0.100
18 0.900
19 0.900