arXiv is now an independent nonprofit! Learn more
License: arXiv.org perpetual non-exclusive license
arXiv:1809.02978v1 [cs.IT] 09 Sep 2018

Time-universal data compression and prediction

Boris Ryabko Affiliation: Institute of Computational Technologies of SB RAS
Novosibirsk state university
Novosibirsk, Russian Federation
Email: boris@ryabko.net
Abstract

Suppose there is a large file which should be transmitted (or stored) and there are several (say, mm) admissible data-compressors. It seems natural to try all the compressors and then choose the best, i.e. the one that gives the shortest compressed file. Then transfer (or store) the index number of the best compressor (it requires logm\lceil\log m\rceil bits) and the compressed file. The only problem is the time, which essentially increases due to the need to compress the file mm times (in order to find the best compressor). We propose a method that encodes the file with the optimal compressor, but uses a relatively small additional time: the ratio of this extra time and the total time of calculation can be limited by an arbitrary positive constant.

Generally speaking, in many situations it may be necessary find the best data compressor out of a given set, which is often done by comparing them empirically. One of the goals of this work is to turn such a selection process into a part of the data compression method, automating and optimizing it.

A similar result is obtained for the related problem of time-series forecasting.

I Introduction and preliminaries

I-A General description of the problems and results

Nowadays there are many efficient lossless data-compressors (or archivers) which are widely used in information technologies. These compressors are based on different ideas and approaches, among which we note the PPM universal code [1] (which is used along with the arithmetic code [2]), the Lempel-Ziv (LZ) compression methods [3], the Burrows-Wheeler transform [4] (which is used along with the book-stack (or MTF) code [5, 6, 7]) and the class of grammar-based codes [8, 9]. All these codes are universal. This means that, asymptotically, the length of the compressed file goes to the smallest possible value (i.e. the Shannon entropy per letter), if the compressed sequence is generated by a stationary source.

Currently, several dozens of archivers are known, each of which has certain merits and it is impossible to single out one of the best or even remove the worst ones. The main part of them are universal codes (as far as a computer program can meet asymptotic properties). Thus, the one faces the problem of choosing the best method to compress a given file.

Suppose someone wants to compress a certain file in order to store it (or transfer it). It seems natural to use for compression the best compressor: the one which gives the shortest compressed file. In such a case one can try to compress the file in turn by all the compressors and then store the name of the best compressor (as a prefix) and the file, compressed by the best method. An obvious drawback of this approach is the need to spend a lot of time in order to first compress the file by all the compressors.

In this paper we show that there exists a method that encodes the file with the optimal compressor, but uses a relatively small additional time. Very briefly, the main idea of the suggested approach is as follows: in order to find the best, try all the archivers, but, when doing it, use for compression only a small part of the file. Then apply the best archiver for the compression of the whole file. It turns out, that under certain conditions on the source of the files, the total time can be made as close to the minimal as required. Thus, we call such methods ”time-universal”. This scheme can be extended to the problem of time-series forecasting, which is considered in a framework of the Laplace approach (This approach is shortly described in Appendix 2.)

In this paper we suggest time-universal methods for data compression and forecasting. To the best of our knowledge, the suggested approach to prediction and compression is new, but close ideas have been considered in algorithmic information theory and artificial intelligence, where they were developed for solving other problems [10, 11].

I-B The over-fitting problem

If someone wants to find the best method of prediction or data compression, she/he should take into account the so-called over-fitting problem. The over-fitting problem is the phenomenon in which the accuracy of the model on unseen data is poor whereas the training accuracy is nearly perfect.

In our case, there is a set of either data compressors F={φ1,φ2,}F=\{\varphi_{1},\varphi_{2},...\} or predictors Π={π1,π2,}\Pi=\{\pi_{1},\pi_{2},...\}. Besides, there is a sequence x1x2xn,n>1x_{1}x_{2}...x_{n},n>1, and one should choose a good method from the set of predictors (or data compressors) based on investigating of a short initial part x1x2xl,l<n.x_{1}x_{2}...x_{l},\,l<n. In the case of data compression, it is natural to choose such a method φ^F\hat{\varphi}\in F, for which |φ^(x1x2xl)||\hat{\varphi}(x_{1}x_{2}...x_{l})| is minimal. In the case of forecasting, it is natural to choose such a predictor π^Π\hat{\pi}\in\Pi for which the probability π^(x1x2xl)\hat{\pi}(x_{1}x_{2}...x_{l}) is maximal (the maximum likelihood principle.)

In this situation the problem of over-fitting is as follows: if x1xlx_{1}...x_{l} is a relatively short sequence and the set of methods FF is large or even infinite, it is possible that a performance of the chosen method φ\varphi on x1xlx_{1}...x_{l} is good, but on the whole sequence x1xnx_{1}...x_{n} it is bad. The over-fitting problem for prediction is similar: the error of the chosen predictor on unseen data is large whereas the training error is nearly zero.

We consider a solution to this problem based on the approach developed in the theory of universal coding [12, 13], but note that a similar solution can be obtained in the framework of MDL (minimal description length) method suggested by J. Rissanen [14, 15] and developed in numerous papers [16, 17, 18]. For this we need such a probability distribution ω\omega on the set 1,2,3,1,2,3,... for which all ωi>0\omega_{i}>0. For example, the following:

ωk=1k(k+1),k=1,2,3,.\omega_{k}=\frac{1}{k(k+1)}\,,\,\,k=1,2,3,...\,\,. (1)

(Clearly, this is a probability distribution, because ωk=1/k1/(k+1)\omega_{k}=1/k-1/(k+1).) The described approach to problem of over-fitting is to find a data-compressor φs\varphi_{s} for which logωs+|φs(x1x2xl)|-\log\omega_{s}\,+|\varphi_{s}(x_{1}x_{2}...x_{l})| is minimal: logωs+|φs(x1x2xl)|-\log\omega_{s}\,+|\varphi_{s}(x_{1}x_{2}...x_{l})| =mini=1,2,=\min_{i=1,2,...} (logωi+|φi(x1x2xl)|)(-\log\omega_{i}\,+|\varphi_{i}(x_{1}x_{2}...x_{l})|). Note that, if the set of data-compressors is finite, it is possible to use an uniform distribution ωi=1/|F|\omega_{i}=1/|F|, i=1,,|F|i=1,...,|F|. It is worth noting that there is a natural interpretation of the considered solution. The value logωi+|φi(x1x2xn)|\lceil-\log\omega_{i}\rceil+|\varphi_{i}(x_{1}x_{2}...x_{n})| can be considered as a codeword length, where the first part logωi\lceil-\log\omega_{i}\rceil encodes the number ii, whereas the second part φi(x1x2xn)\varphi_{i}(x_{1}x_{2}...x_{n}) encodes x1x2xnx_{1}x_{2}...x_{n} by the data compressor φi\varphi_{i}.

In the case of prediction the solution of the over-fitting problem is similar: find a predictor πs\pi_{s} for which ωsπs(x1x2xl)\omega_{s}\pi_{s}(x_{1}x_{2}...x_{l}) is maximal.

II Description of problems and the main notations

In this section we first consider the following problem: There is a set of data compressors F={φ1,φ2,}F=\{\varphi_{1},\varphi_{2},...\} and let x1x2x_{1}x_{2}... be a sequence of letters from a finite alphabet AA whose initial part x1xnx_{1}...x_{n} should be compressed by some φF\varphi\in F. Let, as before, viv_{i} be the time spent on encoding one letter by the data compressor φi\varphi_{i} and suppose that all viv_{i} are upper-bounded by a certain constant vv, i.e. supi=1,2,,viv.\sup_{i=1,2,...,}v_{i}\,\leq\,v\,. (Note, that viv_{i} can be unknown beforehand, but vv should be known.)

The goal is to find a good data compressor from FF in order to compress x1xnx_{1}...x_{n} in such a way that the total time spent for all calculations and compressions does not exceed T(1+δ),δ>0T(1+\delta),\delta>0, where T=vnT=v\,n is the minimum time that must be reserved for compression and δT\delta T is an additional time that can be used to find the good compressor (among φ1,φ2,\varphi_{1},\varphi_{2},...). In order to accurately describe the problem, we suppose also that there is a probability distribution ω=\omega= ω1,ω2,\omega_{1},\omega_{2},... such that all ωi>0\omega_{i}>0. The goal is to fined such φi\varphi_{i} that the value

logωi+|φi(x1x2xn)|\lceil-\log\omega_{i}\rceil\,+|\varphi_{i}(x_{1}x_{2}...x_{n})|

is close to minimal. (Here the first part logωi\lceil-\log\omega_{i}\rceil is used for encoding number ii.) The decoder first finds ii and then x1x2xnx_{1}x_{2}...x_{n} using the decoder corresponding φi\varphi_{i}.

Definition 1

We call any method that encodes a sequence x1x2xnx_{1}x_{2}...x_{n}, n1n\geq 1, xiAx_{i}\in A, by the binary word of the length logωj+|φj(x1x2xn)|\lceil-\log\omega_{j}\rceil\,+\,|\varphi_{j}(x_{1}x_{2}...x_{n})| for some φjF\varphi_{j}\in F, a time-adaptive code and denote it by Φ^comprδ\hat{\Phi}^{\delta}_{compr}. The output of Φ^comprδ\hat{\Phi}^{\delta}_{compr} is the following word:

Φ^comprδ(x1x2xn)=<ωi>φi(x1x2xn),\hat{\Phi}^{\delta}_{compr}(x_{1}x_{2}...x_{n})\,=<\omega_{i}>\,\,\varphi_{i}(x_{1}x_{2}...x_{n})\,, (2)

where <ωi><\omega_{i}> is logωi\lceil-\log\omega_{i}\rceil-bit word that encodes ii, whereas the time of encoding is not grater than T(1+δ)T(1+\delta).

If for a time-adaptive code Φ^comprδ\hat{\Phi}^{\delta}_{compr} the following equation is valid

limtΦ^comprδ(x1xt)/t=inf1=1,2,limtφi(x1xt)/t,\lim_{t\to\infty}\hat{\Phi}^{\delta}_{compr}(x_{1}...x_{t})/t\,=\inf_{1=1,2,...}\lim_{t\to\infty}\varphi_{i}(x_{1}...x_{t})/t\,,

this code is called time-universal.

The definition for the forecast is as follows: Let there be a set of predictors Π={π1,π2,}\Pi=\{\pi_{1},\pi_{2},...\}. By definition, the goal of the time-adaptive predictor Φ^predδ\hat{\Phi}^{\delta}_{pred} is to spend the extra time δT\delta\,T in order to find such πi\pi_{i} that the value

ωiπi(x1x2xn)\omega_{i}\,\pi_{i}(x_{1}x_{2}...x_{n})

is close to maximal. By definition, the output of the time-adaptive predictor Φ^predδ\hat{\Phi}^{\delta}_{pred} is the following set of forecasts (conditional probabilities):

{πj(a|x1xn),aA},\{\pi_{j}(a|x_{1}...x_{n}),\,\,a\in A\},

for a certain πjΠ\pi_{j}\in\Pi. It will be convenient to define

Φ^predδ(x1x2xn)=ωiπj(x1xn).\hat{\Phi}^{\delta}_{pred}(x_{1}x_{2}...x_{n})\,=\,\omega_{i}\,\pi_{j}(x_{1}...x_{n})\,\,. (3)

If for a predictor Φ^predδ\hat{\Phi}^{\delta}_{pred} the following equation is valid

limt(logΦ^predδ(x1xt))/t=\lim_{t\to\infty}(-\log\hat{\Phi}^{\delta}_{pred}(x_{1}...x_{t}))/t=
inf1=1,2,limt(logπi(x1xt))/t,\inf_{1=1,2,...}\lim_{t\to\infty}(-\log\pi_{i}(x_{1}...x_{t}))/t\,,

and, for any tt, time of calculation is not grater than T(1+δ)T(1+\delta) this predictor is called time-universal.

Comment 1. Here and below we did not take into account the time required for the calculation of logωi\log\omega_{i} and some other auxiliary calculations. If in a certain situation this time is not negligible, it is possible to reduce T^\hat{T} in advance by the required value.

III Finite number of data-compressors or predictors

Suppose that there is a file x1x2xnx_{1}x_{2}...x_{n} and data compressors φ1,,φm\varphi_{1},...,\varphi_{m}, n1,m1n\geq 1,m\geq 1. Let, as before, viv_{i} be the time spent on encoding one letter by the data compressor φi\varphi_{i},

v=maxi=1,,nvi,T=nv,v=\max_{i=1,...,n}v_{i},\,\,\,T=n\,v\,, (4)

and let

T^=T(1+δ),δ>0.\hat{T}=T(1+\delta)\,,\,\,\delta>0. (5)

The goal is to find the data compressor φj\varphi_{j}, j=1,,mj=1,...,m, that compresses the file x1x2xnx_{1}x_{2}...x_{n} in the best way in time T^\hat{T}. Seemingly, the simplest method is as follows:

Step 1 Calculate r=δT/vr=\lfloor\delta T/v\rfloor.

Step 2 Compress the file x1x2xrx_{1}x_{2}...x_{r} by φ1\varphi_{1} and find the length of compressed file |φ1(x1xr)||\varphi_{1}(x_{1}...x_{r})|, then , likewise, find |φ2(x1xr)||\varphi_{2}(x_{1}...x_{r})|, |φ3(x1xr)||\varphi_{3}(x_{1}...x_{r})|, etc.

Step 3 Calculate s=argmini=1,,ms=\arg\min_{i=1,...,m} |φi(x1xr)||\varphi_{i}(x_{1}...x_{r})|

Step 4 Compress the whole file x1x2xnx_{1}x_{2}...x_{n} by φs\varphi_{s} and compose the codeword s\langle s\rangle φs(x1xn)\varphi_{s}(x_{1}...x_{n}), where s\langle s\rangle is logm\lceil\log m\rceil-bit word with the presentation of ss.

The decoding is obvious. Denote this method by Φ1δ\Phi^{\delta}_{1}.

Comment 2. We considered the case of data compression. It is possible to apply the described method for time-universal prediction. In this case one should calculate πi(x1xr)\pi_{i}(x_{1}...x_{r}) instead of |φi(x1xr)||\varphi_{i}(x_{1}...x_{r})| and the third step should be changed as follows:

Calculate s=argmaxi=1,,ms=\arg\max_{i=1,...,m} πi(x1xr).\pi_{i}(x_{1}...x_{r}).

The asymptotic properties of the method Φ1δ\Phi_{1}^{\delta} are as follows:

Claim 1. Let there be an infinite sequence x1,x2,x_{1},x_{2},... and data compressors φ1,,φm\varphi_{1},...,\varphi_{m} such that there exist the following limits

limn|φi(x1x2xn)|/n,\lim_{n\to\infty}|\varphi_{i}(x_{1}x_{2}...x_{n})|/n\,\,, (6)

for all i=1,,mi=1,...,m. Then, for any δ>0\delta>0

limn|Φ1δ(x1x2xn)|/n=minlimn1,,m|φi(x1x2xn)|/n,\lim_{n\to\infty}|\Phi^{\delta}_{1}(x_{1}x_{2}...x_{n})|/n\,\,=\min_{1,...,m}\lim_{n\to\infty}|\varphi_{i}(x_{1}x_{2}...x_{n})|/n\,\,,

i.e. Φ1δ\Phi^{\delta}_{1} is time-universal.

Next we describe a more general method, for which Claim 1 is a special case.

IV General method

Generally speaking, it is possible to offer many reasonable strategies for finding the optimal data compressor (or predictor) for a given time. For the finite set of data-compressors such a strategy can be as follows: try all the compressors on a (very) short sequence x1x2xkx_{1}x_{2}...x_{k} and choose a few of the best ones. Then try those chosen data-compressors on a larger sequence x1x2xlx_{1}x_{2}...x_{l}, k<lk<l, and choose the best which will be used for compression of the whole sequence x1x2xnx_{1}x_{2}...x_{n}. Another reasonable strategy can be based on maximization of the probability to determine the optimal data compressor as a function of the extra time δT\delta\,T and other parameters.

So, we can see that there are a lot of reasonable strategies and each of them has a lot of parameters. That is why, it could be useful to use multidimensional optimization methods, such as machine learning, so-called deep learning, etc. Since this is the first paper devoted to time-adaptive and time-universal data compression and prediction, we consider only some general conditions needed for time-universality.

For a time-adaptive data-compressor Φ^\hat{\Phi} and x1xtx_{1}...x_{t} we define for any φi\varphi_{i}

τφi(t)=max{r:φi(x1xr)iscaculated,\tau_{\varphi_{i}}(t)=\max\{r:\varphi_{i}(x_{1}...x_{r})\,\,is\,\,caculated,
whenΦ^(x1xn)isapplied.\,\,when\,\,\hat{\Phi}(x_{1}...x_{n})\,\,is\,\,applied.
Theorem 1

If the following properties are valid:

i) for all i=1,2,i=1,2,...

limtτi(t)=,\lim_{t\to\infty}\tau_{i}(t)=\infty, (7)

ii) for any tt the method Φ^\hat{\Phi} uses such a compressor φs(t)\varphi_{s(t)} for which, for any ii and r=min{τi,τs(t)}r=\min\{\tau_{i},\tau_{s(t)}\}

logωs(t)+|φs(t)(x1xr)|logωi+|φi(x1xr)|,-\log\omega_{s(t)}+|\varphi_{s(t)}(x_{1}...x_{r})|\leq-\log\omega_{i}+|\varphi_{i}(x_{1}...x_{r})|\,, (8)

iii) the limits limtφi(x1xt)/t\lim_{t\to\infty}\varphi_{i}(x_{1}...x_{t})/t exist for all φi\varphi_{i}.

Then Φ^(x1xn)\hat{\Phi}(x_{1}...x_{n}) is time universal, i.e., in a case of data compression,

limtΦ^(x1xt)/t=infi=1,2,limt|φi(x1xt)|/t\lim_{t\to\infty}\hat{\Phi}(x_{1}...x_{t})/t\,=\inf_{i=1,2,...}\lim_{t\to\infty}|\varphi_{i}(x_{1}...x_{t})|/t (9)

A proof is given in Appendix 1, but here we note that Claim 1 is a particular case of this theorem.

Comment 3. If the sequence x1x2x_{1}x_{2}... is generated by a stationary source and all φi\varphi_{i} are universal codes, the property iii) is valid with probability 1 (See, for example, [19]). Hence, this theorem (and the claim 1) are valid for this case.

In general, the property iii) shows that the sequence under consideration has some stability. In turn, it gives a possibility to estimate characteristics of the whole sequence x1x2x_{1}x_{2}... based on its initial part.

V The time-universal code for stationary ergodic sources

In this subsection we describe a time-universal code (and the corresponding predictor) for stationary sources. It is based on optimal universal codes for Markov chains, developed by Krichevsky [20, 21] and the twice-universal code [12]. Denote by MiM_{i}, i=1,2,i=1,2,... the set of Markov chains with memory (connectivity) ii, and let M0M_{0} be the set of Bernoulli sources. For stationary ergodic μ\mu and an integer rr we denote by hr(μ)h_{r}(\mu) the rr-order entropy (per letter) and let h(μ)h_{\infty}(\mu) be the limit entropy; see for definitions [19].

Krichevsky [20, 21] described the codes ψ0,ψ1,\psi_{0},\psi_{1},... which are asymptotically optimal for M0,M1,M_{0},M_{1},..., correspondingly. If the sequence x1x2xnx_{1}x_{2}...x_{n} , xiAx_{i}\in A, is generated by a source μ\mu Mi\in M_{i}, the following inequalities are valid almost surely (a.s.):

hi(μ)|ψi(x1xt)|/thi(μ)+((|A|1)|A|i+C)/t,h_{i}(\mu)\leq|\psi_{i}(x_{1}...x_{t})|/t\,\leq h_{i}(\mu)+((|A|-1)|A|^{i}+C)/t, (10)

where tt grows. (Here CC is a constant.) The length of a codeword of the twice-universal code ρ\rho is defined as the following ”mixture”:

|ρ(x1xt)|=logi=0ωi+1 2|ψi(x1xt)||\rho(x_{1}...x_{t})|=-\log\,\sum_{i=0}^{\infty}\omega_{i+1}\,2^{-|\psi_{i}(x_{1}...x_{t})|}\, (11)

(It is well-known in Information Theory [19] that there exists a code with such codeword lengths, because x1xtAt\sum_{x_{1}...x_{t}\in A^{t}} 2|ρ(x1xt)|2^{-|\rho(x_{1}...x_{t})|} =1=1.) This code is called twice-universal because for any MiM_{i}, i=0,1,i=0,1,..., and μMi\mu\in M_{i} the equality (10) is valid (with different CC). Besides, for any stationary ergodic source μ\mu a.s.

limt|ρi(x1xt)|/t=h(μ).\lim_{t\to\infty}|\rho_{i}(x_{1}...x_{t})|/t\,=h_{\infty}(\mu). (12)

Let us estimate the time of calculations necessary when using ρ\rho. First, note that it suffices to sum a finite number of terms in (11), because all the terms 2|ψi(x1xt)|2^{-|\psi_{i}(x_{1}...x_{t})|} are equal for iti\geq t. On the other hand, the number of different terms grows, where tt\to\infty and, hence, the encoder should calculate 2|ψi(x1xt)|2^{-|\psi_{i}(x_{1}...x_{t})|} for growing number ii’s. It is known [12] that the time spent for encoding one letter is close for different codes ψi\psi_{i}. Hence, the time spent for encoding one letter by the code ρ\rho grows to infinity, when tt grows. The described below time-universal code Ψδ\Psi^{\delta} has the same asymptotic performance, but the time spent for encoding one letter is a constant.

In order to describe the time-universal code Ψδ\Psi^{\delta} we give some definitions. Let, as before, vv be an upper-bound of the time spent for encoding one letter by any ψi\psi_{i}, x1xtx_{1}...x_{t} be the generated word,

T=tv,N(t)=δT/v=δt,T=t\,v,\,N(t)=\delta T/v=\delta\,t,
m(t)=loglogN(t),s(t)=N(t)/m(t).m(t)=\lfloor\log\log N(t)\rfloor,\,s(t)=\lfloor N(t)/m(t)\rfloor\,. (13)

Denote by Ψδ\Psi^{\delta} the following method:

Step 1 Calculate m(t),s(t)m(t),s(t) and

|ψ0(x1xs(t))|,|ψ1(x1xs(t))|,,|ψm(t)(x1xs(t))|.|\psi_{0}(x_{1}...x_{s(t)})|,|\psi_{1}(x_{1}...x_{s(t)})|,...,|\psi_{m(t)}(x_{1}...x_{s(t)})|\,.

Step 2 Find such a jj that

log|ψj(x1xs(t))|=mini=0,,m(t)|ψi(x1xs(t))|.-\log|\psi_{j}(x_{1}...x_{s(t)})|=\min_{i=0,...,m(t)}|\psi_{i}(x_{1}...x_{s(t)})|.

Step 3 Calculate the codeword ψj(x1xt)\psi_{j}(x_{1}...x_{t}) and output

Ψδ(x1xt)=<j>ψj(x1xt),\Psi^{\delta}(x_{1}...x_{t})=\,<j>\psi_{j}(x_{1}...x_{t})\,,

where <j><j> is the logωj+1\lceil-\log\omega_{j+1}\rceil-bit codeword of jj.

The decoding is obvious.

Theorem 2

Let x1x2x_{1}x_{2}... be a sequence generated by a stationary source and the code Ψδ\Psi^{\delta} be applied. Then this code is time-universal, i.e. a.s.

limt|Ψδ(x1xt)|/t=infi=0,1,limt|ψi(x1xt)|/t.\lim_{t\to\infty}|\Psi^{\delta}(x_{1}...x_{t})|/t=\inf_{i=0,1,...}\lim_{t\to\infty}|\psi_{i}(x_{1}...x_{t})|/t\,. (14)

In the case of prediction

limt(logΨδ(x1xt))/t=supi=0,1,limt(logψi(x1xt))/t.\lim_{t\to\infty}(\log\Psi^{\delta}(x_{1}...x_{t}))/t=\sup_{i=0,1,...}\lim_{t\to\infty}(\log\psi_{i}(x_{1}...x_{t}))/t\,.

A proof is given in Appendix 1.

VI Conclusion

Here we note some possible generalisations. We consider mainly the case of off-line prediction and data compression, where the whole sequence x1xnx_{1}...x_{n} can be investigated in order to find a suitable data-compressor or predictor. There are situations where the forecast should be made step-by-step, i.e. xi+1x_{i+1} should be predicted based on x1xtx_{1}...x_{t}, xi+2x_{i+2} should be predicted based on x1xi+1x_{1}...x_{i+1} and so on. The suggested approach and methods can be naturally extended to this case, too, if we take into account the possibility to store results of calculations done on previous steps.

Another generalization is connected with the need to know in advance the speed of computing the forecast (or data compression). In such a case the goal of time-universal method can be the same: it should limit the time of calculation by T(1+δ)T(1+\delta), where TT is (unknown beforehand) the time of the optimal method (from a given set). In such a case the speeds can be evaluated during the calculation.

VII Appendix 1

Proof of Theorem 1. Define λi=limt|φi(x1xt)|/t\lambda_{i}=\lim_{t\to\infty}|\varphi_{i}(x_{1}...x_{t})|/t, and let

λo=miniλi,limt|φo(x1xt)|/t=λo.\lambda_{o}=\min_{i}\lambda_{i},\,\lim_{t\to\infty}|\varphi_{o}(x_{1}...x_{t})|/t\,=\,\lambda_{o}\,. (15)

Let ϵ\epsilon be any positive number. Having taken into account that the set FF is finite, from these definitions we can see that there exists such t1t_{1} that

||φi(x1xt)|/tλi|<ϵforφiF,t>t1.|\,\,|\varphi_{i}(x_{1}...x_{t})|/t-\lambda_{i}|<\epsilon\,\,for\,\varphi_{i}\in F,\,t>t_{1}\,. (16)

Taking into account the property i), we can see that there exists such a number t2t_{2} for which τi(t)\tau_{i}(t) is defined for all φi\varphi_{i} and t>t2t>t_{2}, and denote t3t_{3} =max{t1,t2}=\max\{t_{1},t_{2}\}. Take any n>t3n>t_{3} and suppose that a data-compressor φs\varphi_{s} was chosen, when Φ^\hat{\Phi} was applied to x1x2xnx_{1}x_{2}...x_{n}. Hence, from the property ii) we can see that there exists t4>t3t_{4}>t_{3}, such that

(logωs+|φs(x1xt4)|)/t4(logωo+|φo(x1xt4)|)/t4.(-\log\omega_{s}+|\varphi_{s}(x_{1}...x_{t_{4}})|)/t_{4}\leq(-\log\omega_{o}+|\varphi_{o}(x_{1}...x_{t_{4}})|)/t_{4}\,. (17)

From (15) we obtain the following two inequalities

(logωs+|φs(x1xt4)|)/t4λsϵ,(-\log\omega_{s}+|\varphi_{s}(x_{1}...x_{t_{4}})|)/t_{4}\geq\lambda_{s}-\epsilon\,,
(logωo+|φo(x1xt4)|)/t4λ0+ϵ.(-\log\omega_{o}+|\varphi_{o}(x_{1}...x_{t_{4}})|)/t_{4}\,\leq\lambda_{0}+\epsilon\,.

Having taken into account (17) we can see from the two latest inequalities that λsϵ<λo+ϵ\lambda_{s}-\epsilon<\lambda_{o}+\epsilon and, hence, λs<λo+2ϵ\lambda_{s}<\lambda_{o}+2\epsilon. Taking into account, that, by definition (15), λo<λs\lambda_{o}<\lambda_{s}, we obtain

λoλs<λo+2ϵ.\lambda_{o}\leq\lambda_{s}<\lambda_{o}+2\epsilon\,. (18)

Since n>t1n>t_{1}, we can see from (16) that

λsϵ<(logωs+|φs(x1xn)|)/n<λs+ϵ.\lambda_{s}-\epsilon<(-\log\omega_{s}+|\varphi_{s}(x_{1}...x_{n})|)/n<\lambda_{s}+\epsilon\,.

Taking into account that (logωs+|φs(x1xn)|)/n(-\log\omega_{s}+|\varphi_{s}(x_{1}...x_{n})|)/n =Φ^(x1xn)/n=\hat{\Phi}(x_{1}...x_{n})/n we obtain from (18) that

λoϵ<Φ^(x1xn)/n<λo+3ϵ,\lambda_{o}-\epsilon<\hat{\Phi}(x_{1}...x_{n})/n<\lambda_{o}+3\epsilon\,,

and, hence,

λoϵ<limnΦ^(x1xn)/n<λo+3ϵ.\lambda_{o}-\epsilon<\lim_{n\to\infty}\hat{\Phi}(x_{1}...x_{n})/n<\lambda_{o}+3\epsilon\,.

It is true for any ϵ>0\epsilon>0, hence, limnΦ^(x1xn)/n=λo\lim_{n\to\infty}\hat{\Phi}(x_{1}...x_{n})/n=\lambda_{o}. The theorem is proven.

Proof of Theorem 2. It is known in Information Theory [19] that hr(μ)h_{r}(\mu) hr+1(μ)\geq h_{r+1}(\mu) h(μ)\geq h_{\infty}(\mu) for any rr and (by definition) limrhr(μ)\lim_{r\to\infty}h_{r}(\mu) =h(μ)=h_{\infty}(\mu). Let ϵ>0\epsilon>0 and rr be such an integer that hrhh_{r}-h_{\infty} <ϵ<\epsilon. From (V) we can see that there exists such t1t_{1} that m(t)rm(t)\geq r if tt1t\geq t_{1}. Taking into account (10) and (V), we can see that there exists t2t_{2} for which a.s. ||ψr(x1xt)|/thr(μ)|||\psi_{r}(x_{1}...x_{t})|/t-h_{r}(\mu)| <ϵ<\epsilon if t>t2t>t_{2}. From the description of Ψδ\Psi^{\delta} (the step 3) we can see that there exists such t3>max{t1,t2}t_{3}>\max\{t_{1},t_{2}\} for which a.s.

||ψr(x1xt)|/th(μ)|||ψr(x1xt)|/thr(μ)|||\psi_{r}(x_{1}...x_{t})|/t-h_{\infty}(\mu)|\leq||\psi_{r}(x_{1}...x_{t})|/t-h_{r}(\mu)|
+(hr(μ)h(μ))<2ϵ,+(h_{r}(\mu)-h_{\infty}(\mu))<2\epsilon\,,

if t>t3t>t_{3}. By definition,

|Ψδ(x1xt)|/t(|ψr(x1xt)|logωr+1)/t.|\Psi^{\delta}(x_{1}...x_{t})|/t\leq(|\psi_{r}(x_{1}...x_{t})|-\log\omega_{r+1})/t.

Having taken into account that ϵ\epsilon is an arbitrary number and two latest inequalities as well as the fact that a.s. infi=0,1,limt|ψr(x1xt)|/t\inf_{i=0,1,...}\lim_{t\to\infty}|\psi_{r}(x_{1}...x_{t})|/t =h(μ)=h_{\infty}(\mu), we obtain (14). The theorem is proven.

VIII Appendix 2: The Laplace approach to prediction

Let there be a source with unknown statistics which generates sequences x1x2x_{1}x_{2}\cdots of letters from some finite alphabet AA. Let the source generate a message x1xt1xtx_{1}\ldots x_{t-1}x_{t}, xiA\,x_{i}\in A, and the following letter xt+1x_{t+1} needs to be predicted. This problem can be traced back to Laplace who considered the problem of estimation of the probability that the sun will rise tomorrow, given that it has risen every day since Creation [22]. In our notation the alphabet AA contains two letters, 00\; (“the  sun  rises”) and 11\; (“the  sun  does  not  rise” ); tt is the number of days since Creation, x1xt1xt=000.x_{1}\ldots x_{t-1}x_{t}=00\ldots 0.

Laplace suggested the following predictor:

L0(a|x1xt)=(νx1xt(a)+1)/(t+|A|),L_{0}(a|x_{1}\cdots x_{t})=(\nu_{x_{1}\cdots x_{t}}(a)+1)/(t+|A|), (19)

where νx1xt(a)\nu_{x_{1}\cdots x_{t}}(a) denotes the count of letter aa occurring in the word x1xt1xt.x_{1}\ldots x_{t-1}x_{t}. For example, if A={0,1},A=\{0,1\}, x1x5\>x_{1}...x_{5} =01010=01010, then the Laplace prediction is as follows: L0(x6=0|x1x5=01010)L_{0}(x_{6}=0|x_{1}...x_{5}=01010) =(3+1)/(5+2)=(3+1)/(5+2) =4/7,=4/7, L0(x6=1|x1x5=CLOSEL_{0}(x_{6}=1|x_{1}...x_{5}= (2+1)/(5+2)=3/7.(2+1)/(5+2)=3/7. In other words, 3/73/7 and 4/74/7 are estimations of the unknown probabilities P(xt+1=0|x1xt=01010)P(x_{t+1}=0|x_{1}\ldots x_{t}=01010) and P(xt+1CLOSEP(x_{t+1} == 1|x1xt1|x_{1}\ldots x_{t} == OPEN01010).01010). (In what follows we will use the shorter notation: P(0|01010)P(0|01010) and OPENP(1|01010)).P(1|01010)). We can see that Laplace considered prediction as a set of estimations of unknown (conditional) probabilities, because they contain all information about the future behaviour of any stochastic process. In general, we call as a predictor π\pi any conditional probabilities π(xi+1=a|\pi(x_{i+1}=a| OPENx1=a1,,xn=an)x_{1}=a_{1},...,x_{n}=a_{n}) defined for all integers nn, aAa\in A, a1,,ana_{1},...,a_{n} An\in A^{n}.

Proximity of the theory of universal coding and prediction, as well as asymptotically optimal methods of prediction in a framework of the Laplace approach were found for the cases of a finite alphabet and continues one in [13] and [23], correspondingly.

Acknowledgment

This work was supported by Russian Foundation for Basic Research (grant 15-07-01851).

References

  • [1] J. Cleary and I. Witten, “Data compression using adaptive coding and partial string matching,” IEEE transactions on Communications, vol. 32, no. 4, pp. 396–402, 1984.
  • [2] J. Rissanen and G. G. Langdon, “Arithmetic coding,” IBM Journal of research and development, vol. 23, no. 2, pp. 149–162, 1979.
  • [3] J. Ziv and A. Lempel, “A universal algorithm for sequential data compression,” IEEE Transactions on information theory, vol. 23, no. 3, pp. 337–343, 1977.
  • [4] M. Burrows and D. J. Wheeler, “A block-sorting lossless data compression algorithm,” 1994.
  • [5] B. Y. Ryabko, “Data compression by means of a “book stack”,” Problemy Peredachi Informatsii, vol. 16, no. 4, pp. 16–21, 1980.
  • [6] J. Bentley, D. Sleator, R. Tarjan, and V. Wei, “ A locally adaptive data compression scheme,” Communications of the ACM, vol. 29, no. 4, pp. 320–330, 1986.
  • [7] B. Ryabko, N. R. Horspool, G. V. Cormack, S. Sekar, and S. B. Ahuja, “Technical correspondence,” Communications of the ACM, vol. 30, no. 9, pp. 792–797, 1987.
  • [8] J. C. Kieffer and E.-H. Yang, “Grammar-based codes: a new class of universal lossless source codes,” IEEE Transactions on Information Theory, vol. 46, no. 3, pp. 737–754, 2000.
  • [9] E.-H. Yang and J. C. Kieffer, “Efficient universal lossless data compression algorithms based on a greedy sequential grammar transform. i. without context models,” IEEE Transactions on Information Theory, vol. 46, no. 3, pp. 755–777, 2000.
  • [10] M. Li and P. Vitanyi, An Introduction to Kolmogorov Complexity and Its Applications, 3rd edition. New York: Springer, 2008.
  • [11] M. Hutter, Universal Artificial Intelligence: Sequential Decisions based on Algorithmic Probability. Berlin: Springer, 2005.
  • [12] B. Ryabko, “Twice-universal coding,” Problems of Information Transmission, vol. 3, pp. 173–177, 1984.
  • [13] ——, “Prediction of random sequences and universal coding,” Problems of Information Transmission, vol. 24, pp. 87–96, 1988.
  • [14] J. J. Rissanen, “Modeling by shortest data description.” Automatica, vol. 14, pp. 465–471, 1978.
  • [15] ——, Stochastic Complexity in Statistical Inquiry. World Scientific Publ. Co., 1989.
  • [16] A. Barron, J. Rissanen, and B. Yu, “The mdl principle in modeling and coding’, special issue of ieee trans,” Information Theory to commemorate, vol. 50, pp. 2743–2760, 1998.
  • [17] P. Grünwald, The Minimum Description Length Principle. The MIT Press, Cambridge, 2007.
  • [18] P. Kontkanen, P. Myllymäki, T. Silander, H. Tirri, and P. Grünwald, “On predictive distributions and bayesian networks,” Statistics and Computing, vol. 10, no. 1, pp. 39–54, 2000.
  • [19] T. M. Cover and J. A. Thomas, Elements of information theory. New York, NY, USA: Wiley-Interscience, 2006.
  • [20] R. Krichevsky, “A relation between the plausibility of information about a source and encoding redundancy,” Problems Inform. Transmission, vol. 4, no. 3, pp. 48–57, 1968.
  • [21] ——, Universal Compression and Retrival. Kluwer Academic Publishers, 1993.
  • [22] W. Feller and P. M. Morse, “An introduction to probability theory and its applications,” Physics Today, vol. 11, p. 32, 1958.
  • [23] B. Ryabko,“Compression-based methods for nonparametric prediction and estimation of some characteristics of time series,” IEEE Transactions on Information Theory, vol. 55, pp. 4309–4315, 2009.