This function calculates the complexity of a finite binary sequence, according to the work presented by Abraham Lempel and Jacob Ziv in the paper "On the Complexity of Finite Sequences", published in "IEEE Transactions on Information Theory", Vol. IT-22, no. 1, January 1976.
From that perspective, the algorithm could be referred to as "LZ76".
The function supports two methods of evaluating sequence complexity:
1. Decomposition into an exhaustive production process
2. Decomposition into a primitive production process
Exhaustive complexity can be considered a lower limit of the complexity measurement approach proposed in LZ76, and primitive complexity an upper limit.
Currently, only sequences with binary alphabets (0, 1) are supported.
Feel free to email me if you find this function useful, find bugs with it, or have any suggestions for improvements.
Thanks a lot for your help Mr. Bjørn, your answer is very helpful
One way to do it would be to take the Hilbert transform (matlab function 'hilbert'), of the timeseries data to get the analytic signal. Taking the absolute value of this (matlab function 'abs'), you get a new set of time series indicating the amplitude of the signal at each timepoint. You can binarize the data by thresholding this this time series. Schartner et al 2015-2016 suggest using the mean of the signal amplitude as a threshold.
How can i convert a time series data into binary sequences in order to work with this algorithm? Thanks
The eigenfunction that corresponds with the input sequence, and calculated internally, can now be obtained by the caller of calc_lz_complexity() as a return value.
Another optimisation tweak that should result in this implementation running faster again for most sequences than the previous version.
Major speed improvement. The old version was actually very inefficient and slow. A rethink of the eigenfunction calculation was warranted.
On my PC, this new version runs about 140x faster than the previous version!!!
Changed the way normalized complexity was calculated. It is now normalized against (n/log2(n)), rather than n, where n is the length of the sequence.
Upon reviewing Lempel-Ziv's paper, this normalization seems to make more sense.
Forgot to include a helper function that's used by the main calc_lz_complexity() function.
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.