We will also talk about maximum likelihood decoding a code (under the assumption that the input codeword is chosen uniformly at random) for a given channel, meaning the following
[maximum likelihood decoding]
Maximum likelihood decoding of a binary code \(\lbrace 0,1\rbrace ^n\)  over a BIMS channel with transitions probabilities \((p(y|b))_{\begin{array}{c}y \in {{Y}}\\ b \in \lbrace 0,1\rbrace \end{array}}\) 
corresponds, given a received word \({\mathbf {y}}\in {{Y}}^n\) , to output the (or one of them if there are several equally likely candidates) codeword \({\mathbf {x}}\) 
which maximizes \(p({\mathbf {y}}|{\mathbf {x}})\) . Here
\(p({\mathbf {y}}|{\mathbf {x}})\mathop {=}\limits ^{\triangle }p(y_i|x_i)\cdots p(y_n|x_n)\)  denotes the probability of receiving \({\mathbf {y}}\)  given that
\({\mathbf {x}}\)  was sent.

In a sense, this is the best possible decoding algorithm for a given channel model.
There is a variation of Shannon's theorem (see for instance [1]}) which says that a family of random binary linear codes \((n)_{n}\)  attain the capacity of a BIMS channel

Consider a BIMS channel of capacity \(C\) .
Let \(\delta >0\)  and consider a family of random binary linear codes \(n\)  of length \(n\)  and rate smaller than \((1-\delta ) C\)  obtained by choosing their generator matrix uniformly at random. Then under maximum likelihood decoding, the probability of error after decoding goes to 0 as \(n\)  tends to infinity.
