{"id":4518,"date":"2021-03-29T06:36:29","date_gmt":"2021-03-29T06:36:29","guid":{"rendered":"https:\/\/www.aiproblog.com\/index.php\/2021\/03\/29\/defining-and-measuring-chaos-in-data-sets-why-and-how-in-simple-words\/"},"modified":"2021-03-29T06:36:29","modified_gmt":"2021-03-29T06:36:29","slug":"defining-and-measuring-chaos-in-data-sets-why-and-how-in-simple-words","status":"publish","type":"post","link":"https:\/\/www.aiproblog.com\/index.php\/2021\/03\/29\/defining-and-measuring-chaos-in-data-sets-why-and-how-in-simple-words\/","title":{"rendered":"Defining and Measuring Chaos in Data Sets: Why and How, in Simple Words"},"content":{"rendered":"<p>Author: Vincent Granville<\/p>\n<div>\n<p>There are many ways chaos is defined, each scientific field and each expert having its own definitions. We share here a few of the most common metrics used to quantify the level of chaos in univariate time series or data sets. We also introduce a new, simple definition based on metrics that are familiar to everyone. Generally speaking, chaos represents how predictable a system is, be it the weather, stock prices, economic time series, medical or biological indicators, earthquakes, or anything that has some level of randomness.\u00a0<\/p>\n<p>In most applications, various statistical models (or data-driven, model-free techniques) are used to make predictions. Model selection and comparison can be based on testing various models, each one with its own level of chaos. Sometimes, time series do not have an auto-correlation function due to the high level of variability in the observations: for instance, the theoretical variance of the model is infinite. An example is provided in section 2.2 <a href=\"https:\/\/www.datasciencecentral.com\/profiles\/blogs\/hurwitz-riemann-zeta-and-other-special-probability-distributions\" target=\"_blank\" rel=\"noopener\">in this article<\/a>\u00a0 (see picture below), used to model extreme events. In this case, chaos is a handy metric, and it allows you to build and use models that are otherwise ignored or unknown by practitioners.\u00a0\u00a0<\/p>\n<p><a href=\"https:\/\/storage.ning.com\/topology\/rest\/1.0\/file\/get\/8725268092?profile=original\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/storage.ning.com\/topology\/rest\/1.0\/file\/get\/8725268092?profile=RESIZE_710x\" width=\"450\" class=\"align-center\"><\/a><\/p>\n<p style=\"text-align: center;\"><strong>Figure 1<\/strong>: <em>Time series with indefinite autocorrelation; instead, chaos is used to measure predictability<\/em><\/p>\n<p>Below are various definitions of chaos, depending on the context they are used for. References about how to compute these metrics, are provided in each case.<\/p>\n<p><strong>Hurst exponent<\/strong><\/p>\n<p>The <a href=\"https:\/\/en.wikipedia.org\/wiki\/Hurst_exponent\" target=\"_blank\" rel=\"noopener\">Hurst exponent<\/a>\u00a0<em>H<\/em> is used to measure the level of smoothness in time series, and in particular, the level of long-term memory.\u00a0<em>H<\/em> takes on values between 0 and 1, with <em>H<\/em> = 1\/2 corresponding to the Brownian motion, and <em>H<\/em> = 0 corresponding to pure white noise. Higher values correspond to smoother time series, and lower values to more rugged data. Examples of time series with various values of <em>H<\/em> are found <a href=\"https:\/\/www.datasciencecentral.com\/profiles\/blogs\/long-range-correlation-in-time-series-tutorial-and-case-study\" target=\"_blank\" rel=\"noopener\">in this article<\/a>, see picture below. In the same article, the relation to the <em>detrending moving average<\/em> (another metric to measure chaos) is explained. Also, <em>H<\/em> is related to the fractal dimension. Applications include stock price modeling.<\/p>\n<p><a href=\"https:\/\/storage.ning.com\/topology\/rest\/1.0\/file\/get\/8725551894?profile=original\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/storage.ning.com\/topology\/rest\/1.0\/file\/get\/8725551894?profile=RESIZE_710x\" width=\"350\" class=\"align-center\"><\/a><\/p>\n<p style=\"text-align: center;\"><strong>Figure 2<\/strong>: <em>Time series with H = 1\/2 (top), and H close to 1 (bottom)<\/em><\/p>\n<p><strong>Lyapunov exponent<\/strong><\/p>\n<p>In dynamical systems, the Lyapunov exponent is used to quantify how a system is sensitive to initial conditions. Intuitively, the more sensitive to initial conditions, the more chaotic the system is. For instance, the system <em>x<span style=\"font-size: 8pt;\">n<\/span><\/em><span style=\"font-size: 8pt;\">+1<\/span> = <em>x<span style=\"font-size: 8pt;\">n<\/span><\/em> &#8211; INT(<em>x<span style=\"font-size: 8pt;\">n<\/span><\/em>), where INT represents the integer function, is very sensitive to the initial condition <em>x<\/em><span style=\"font-size: 8pt;\">0<\/span>. A very small change in the value of <em>x<\/em><span style=\"font-size: 8pt;\">0<\/span> results in values of <em>x<span style=\"font-size: 8pt;\">n<\/span><\/em> that are totally different even for <em>n<\/em> as low as 45. See how to compute the Lyapunov exponent, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Lyapunov_exponent\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<p><strong>Fractal dimension<\/strong><\/p>\n<p>A one-dimensional curve can be defined parametrically by a system of two equations. For instance <em>x<\/em>(<em>t<\/em>) = sin(<em>t<\/em>), <em>y<\/em>(<em>t<\/em>) = cos(<em>t<\/em>) represents a circle of radius 1, centered at the origin. Typically, <em>t<\/em> is referred to as the time, and the curve itself is called an orbit. In some cases, as <em>t<\/em> increases, the orbit fills more and more space in the plane. In some cases, it will fill a dense area, to the point that it seems to be an object with a dimension strictly between 1 and 2. An example is provided in section 2 <a href=\"https:\/\/www.datasciencecentral.com\/profiles\/blogs\/spectacular-visualization-the-eye-of-the-riemann-zeta-function\" target=\"_blank\" rel=\"noopener\">in this article<\/a>, and pictured below. A formal definition of fractal dimension can be found <a href=\"https:\/\/en.wikipedia.org\/wiki\/Fractal_dimension\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<p><a href=\"https:\/\/storage.ning.com\/topology\/rest\/1.0\/file\/get\/8725489684?profile=original\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/storage.ning.com\/topology\/rest\/1.0\/file\/get\/8725489684?profile=RESIZE_710x\" width=\"500\" class=\"align-center\"><\/a><\/p>\n<p style=\"text-align: center;\"><strong>Figure 3<\/strong>: <em>Example of a curve filling a dense area (fractal dimension\u00a0 &gt;\u00a0 1)<\/em><\/p>\n<p>The picture in figure 3 is related to the Riemann hypothesis. Any meteorologist\u00a0who sees the connection to hurricanes and their eye, could bring some light about how to solve this infamous mathematical conjecture, based on the physical laws governing hurricanes. Conversely, this picture (and the underlying mathematics) could also be used as as statistical model for hurricane modeling and forecasting.\u00a0<\/p>\n<p><strong>Approximate entropy<\/strong><\/p>\n<p>In statistics, the approximate entropy is a\u00a0 metric used to quantify regularity and predictability in time series fluctuations. Applications include\u00a0medical data, finance, physiology, human factors engineering, and climate sciences. See the Wikipedia entry, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Approximate_entropy\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<p>It should not be confused with <a href=\"https:\/\/en.wikipedia.org\/wiki\/Entropy\" target=\"_blank\" rel=\"noopener\">entropy<\/a>, which measures the amount of information attached to a specific probability distribution (with the uniform distribution on [0, 1] achieving maximum entropy among all continuous distributions on [0, 1], and the normal distribution achieving maximum entropy among all continuous distributions defined on the real line, with a specific variance). Entropy is used to compare the efficiency of various encryption systems, and has been used in feature selection strategies in machine learning, see <a href=\"https:\/\/www.datasciencecentral.com\/profiles\/blogs\/feature-selection-a-simple-solution\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<p><strong>Independence metric\u00a0<\/strong><\/p>\n<p>Here I discuss some metrics that are of interest in the context of dynamical systems, offering an alternative to the Lyapunov exponent to measure chaos. While the Lyapunov exponents deals with sensitivity to initial conditions, the classic statistics mentioned here deals with measuring predictability for a single instance (observed time series) of a dynamical systems. However, they are most useful to compare the level of chaos between two different dynamical systems with similar properties. A dynamical system is a sequence <em>x<\/em><span style=\"font-size: 8pt;\"><em>n<\/em>+1<\/span> = <em>T<\/em>(<em>x<span style=\"font-size: 8pt;\">n<\/span><\/em>), with initial condition <em>x<\/em><span style=\"font-size: 8pt;\">0<\/span>. Examples are provided in my last two articles, <a href=\"https:\/\/www.datasciencecentral.com\/profiles\/blogs\/an-easy-way-to-solve-complex-optimization-problems\" target=\"_blank\" rel=\"noopener\">here<\/a> and <a href=\"https:\/\/www.datasciencecentral.com\/profiles\/blogs\/hurwitz-riemann-zeta-and-other-special-probability-distributions\" target=\"_blank\" rel=\"noopener\">here<\/a>. See also <a href=\"https:\/\/www.datasciencecentral.com\/profiles\/blogs\/beautiful-mathematical-images\" target=\"_blank\" rel=\"noopener\">here<\/a>.\u00a0<\/p>\n<p>A natural metric to measure chaos is the maximum autocorrelation in absolute value, between the sequence (<em>x<span style=\"font-size: 8pt;\">n<\/span><\/em>), and the shifted sequences (<em>x<\/em><span style=\"font-size: 8pt;\"><em>n<\/em>+<em>k<\/em><\/span>), for <em>k<\/em> = 1, 2, and so on. Its value is maximum and equal to 1 in case of periodicity, and minimum and equal to 0 for the most chaotic cases. However, some sequences attached to dynamical systems, such as the digit sequence pictured in Figure 1 in this article, do not have theoretical autocorrelations: these autocorrelations don&#8217;t exist because the underlying expectation or variance is infinite or does not exist. A possible solution with positive sequences is to compute the autocorrelations on <em>y<span style=\"font-size: 8pt;\">n<\/span><\/em> = log(<em>x<span style=\"font-size: 8pt;\">n<\/span><\/em>) rather than on the <em>x<span style=\"font-size: 8pt;\">n<\/span><\/em>&#8216;s.<\/p>\n<p>In addition, there may be strong non-linear dependencies, and thus high predictability for a sequence (<em>x<span style=\"font-size: 8pt;\">n<\/span><\/em>), even if autocorrelations are zero. Thus the desire to build a better metric. In my next article, I will introduce a metric measuring the level of independence, as a proxy to quantifying chaos. It will be similar in some ways to the Kolmogorov-Smirnov metric used to test independence and illustrated <a href=\"https:\/\/projecteuclid.org\/journals\/electronic-journal-of-statistics\/volume-8\/issue-2\/A-Kolmogorov-Smirnov-type-test-for-independence-between-marks-and\/10.1214\/14-EJS961.full\" target=\"_blank\" rel=\"noopener\">here<\/a>, however, without much theory, essentially using a machine learning approach and data-driven, model-free techniques to build confidence intervals and compare the amount of chaos in two dynamical systems: one fully chaotic versus one not fully chaotic. Some of this is discussed <a href=\"https:\/\/math.stackexchange.com\/questions\/4079669\/question-about-a-special-test-of-independence-autocorrelation\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<p>I did not include the variance as a metric to measure chaos, as the variance can always be standardized by a change of scale, unless it is infinite.<\/p>\n<\/p>\n<p><span><em>To receive a weekly digest of our new articles, subscribe to our newsletter,\u00a0<a href=\"https:\/\/www.datasciencecentral.com\/profiles\/blogs\/check-out-our-dsc-newsletter\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/em><\/span><\/p>\n<p><span><em><strong>About the author<\/strong>:\u00a0 Vincent Granville is a d<span class=\"lt-line-clamp__raw-line\">ata science pioneer, mathematician, book author (Wiley), patent owner, former post-doc at Cambridge University, former VC-funded executive, with 20+ years of corporate experience including CNET, NBC, Visa, Wells Fargo, Microsoft, eBay. Vincent is also self-publisher at\u00a0<a href=\"http:\/\/datashaping.com\/\" target=\"_blank\" rel=\"noopener\">DataShaping.com<\/a>, and founded and co-founded a few start-ups, including one with a successful exit (Data Science Central acquired by Tech Target).<\/span>\u00a0You can access Vincent&#8217;s articles and books,\u00a0<a href=\"http:\/\/datashaping.com\/\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/em><\/span><\/p>\n<\/div>\n<p><a href=\"https:\/\/www.datasciencecentral.com\/xn\/detail\/6448529:BlogPost:1045635\">Go to Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Author: Vincent Granville There are many ways chaos is defined, each scientific field and each expert having its own definitions. We share here a few [&hellip;] <span class=\"read-more-link\"><a class=\"read-more\" href=\"https:\/\/www.aiproblog.com\/index.php\/2021\/03\/29\/defining-and-measuring-chaos-in-data-sets-why-and-how-in-simple-words\/\">Read More<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":463,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[26],"tags":[],"_links":{"self":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/posts\/4518"}],"collection":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/comments?post=4518"}],"version-history":[{"count":0,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/posts\/4518\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/media\/461"}],"wp:attachment":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/media?parent=4518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/categories?post=4518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/tags?post=4518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}