Classification of binary string into 0 or 1 categories I observe a binary string that contains both 0's and 1's like this one 100111101. However the true process that created these strings are either all 1's or all 0's. Due to technical errors and measurement errors I observe a string that contains both 0's and 1's. For example if there are no technical or measurement errors the above example string should have been 111111111 or 000000000. I am interested in inferring whether my observed string is truly all 1's or all 0's. In addition to classifying them into two groups I am also interested in a confidence measure that tells me how confident that it comes from all 1's scenario vs all 0's scenario. 
Is there any statistical procedure that I can use to answer this type of question ?   
 A: I believe you can use the maximum likelihood method to perform the classification.
First you need to have the true value, or a good approximation, of the probability of a error occurring. Lets denote by $p$ this probability.
Lets assume your string of zeros and ones is $\delta = x_1x_2...x_n$. We also adopt the notation: $\theta = 0$ if this sequence would be a sequence of zeros if there were no errors. In the same fashion $\theta = 1$ if this sequence would be a sequence of one if there were no errors.
Now you can check that the log-likelihood of $\theta = 0$ given this string (which can be interpreted as the probability of getting the string when we suppose that it is really a sequence of zeros) is:
$$l(\theta = 0\,|\,\delta) = \log\left[\prod_{i = 1}^np^{x_i}(1-p)^{1-x_i}\right]=(\log p)\sum x_i+\log(1-p)\left(n-\sum x_i\right)$$
When you consider the case $\theta=1$ your log-likelihood is:
$$l(\theta = 1\,|\,\delta) = \log\left[\prod_{i = 1}^np^{1-x_i}(1-p)^{x_i}\right]=(\log p)\left(n-\sum x_i\right)+\log(1-p)\sum x_i$$
Now all you have to do is see which log-likelihood is bigger. The bigger one tells you what value of $\theta$ you should choose.
