1. A method for determining an output compressed state sequence ŝ from an input data sequence x, where a probability of a compressed state sequence s 0 is given by a marginalization over all segmentations y of the input data sequence according to p ⁡ ( s = s 0 | x ) = ∑ ∀ y : ⁢ ( y ) = s 0 ⁢ p ⁡ ( y | x ) , where the symbol represents a compress function, comprising the steps of: determining probabilities of lengths c of possible compressed state sequences corresponding to the input data sequence x={x 1 , x 2 ,. .. , x T } according to p(c=c 0 |x); estimating a length ĉ, of the output compressed state sequence ŝ, wherein the length ĉ has a maximum probability according to ĉ=arg max p(c=c 0 |x); determining a probability of each state s i in a possible output compressed state sequence having the length ĉ according to p(s i =j|x, ĉ), wherein i=1,. .. , ĉ; and estimating each compressed state ŝ i that has a maximum probability according to ŝ i = arg max p(s i =j|x, ĉ) to estimate the output compressed state sequence ŝ, wherein the steps are performed in a processor.