{'fraction_non_alphanumeric': 0.036945186315655604, 'fraction_numerical': 0.008234770443850948, 'mean_word_length': 4.480571528140791, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Information-related complexity: a problem-oriented approach

A general notion of information-related complexity applicable to both natural and man-made systems is proposed. The overall approach is to explicitly consider a rational agent performing a certain task with a quantifiable degree of success. The complexity is defined as the minimum (quasi-)quantity of information that's necessary to complete the task to the given extent -- measured by the corresponding loss. The complexity so defined is shown to generalize the existing notion of statistical complexity when the system in question can be described by a discrete-time stochastic process. The proposed definition also applies, in particular, to optimization and decision making problems under uncertainty in which case it gives the agent a useful measure of the problem's"susceptibility"to additional information and allows for an estimation of the potential value of the latter.


I. INTRODUCTION
The general field of complex systems science is relatively new and has been developing rather rapidly in the last three decades. One of the central notions it revolves around is -understandably -that of complexity. The desire to define complexity before attempting to study it is indeed rather natural and logical in this context. When the field of complex system science began taking its shape several notions of complexity were already in use. The most notable of them was the Kolmogorov descriptional complexity [1,2] defined as a shortest length of a computer program needed to reproduce the given object (in the simplest case represented by a string of symbols from a given alphabet). It was quickly noted, however, that the Kolmogorov complexity is rather a measure of randomness as opposed to complexity understood as the amount of appropriately defined "internal structure" possessed by the object [3]. It was also realized that a proper measure of complexity should be probabilistic since complexity as it is encountered in natural sciences and engineering is inherently linked to some sort of uncertainty. Following these realizations, several useful measures of complexity were developed, including set complexity, true measure complexity, effective measure complexity [4], logical depth [5,6], statistical complexity [7], sophistication [8].
Among these measures, statistical complexity was the measure foundations and applications of which were later developed in most detail (see [9]). For this reason, we will use it later as a "benchmark" complexity measure for systems that can be described by discrete-time stochastic processes.
The main goal of the present work is to put the problem of complexity measures in an "engineering" problem-oriented context and, in particular, to demonstrate that a generalization of statistical complexity measure arises naturally when the proposed "engineering" complexity notion is applied to the case of a prediction task for discrete-time stochastic processes. The central figure of the proposed approach is an agent whose goal is to perform a certain task. Typical examples of tasks are control, decision making, optimization, prediction. We will also refer to the such tasks as problems. From a general practical point of view, a task can be made complex by several of its aspects. It can be, for example, computationally complex (like a large scale deterministic optimization problem). It can be operationally complex (like that of building a complicated object given full instructions). We will not deal with such complexity types. Instead, we concentrate on information-related complexity, the measure of which is an appropriately defined quantity of some relevant information needed for completing the task with a given (also appropriately measured) degree of success. This implies that the task is initially associated with some degree of uncertainty that can be fully or partially removed by acquiring the appropriate information.
The rest of the paper is organized as follows. In Section II, the general definition of task complexity is given. Section III applies considers the optimization under uncertainty (stochastic optimization) as a task and derives the quasi-information complexity for optimization. Section IV considers the task of prediction of stochastic processes output and makes a connection to statistical complexity introduced in [7] which turns out to be just the task complexity taken at zero value of the argument. Finally, Section V summarizes the contributions of the present work and presents a brief informal discussion.

II. GENERAL FORMULATION: INFORMATION-RELATED TASK COMPLEXITY
An agent is trying to accomplish a certain task and can, in principle, be helped by appropriate additional information. The quality (or degree) of the task accomplishment is assumed to be quantifiable by a real number and thus can be compared between any two instances of the task accomplishment. Respectively, a notion of real-valued loss can be defined as (the absolute value of) the difference between the degree of the task accomplishment in the given instance and the best possible one. The latter has to be defined appropriately given the specific task at hand as examples given later in the paper illustrate.
Besides loss, any information I that the agent can acquire is also assumed to possess some realvalued measure I(I) of its effective quantity which we will refer to as quasi-quantity to distinguish it from measures of "pure" quantity such as Shannon entropy. The appropriate form of quasiquantity measure I(I) has to be determined by considering the specific nature of the task in hand to appropriately reflect its essential features. In particular, the quasi-quantity measure may coincide with a traditional "pure" quantity measure for some tasks. The agent is also assumed to be capable of making optimal use of the acquired information for the purpose of minimizing the loss. Given the latter assumption, we can introduce the notion of the loss L(I) of the specific information I available to the agent.
It is natural to assume that, if the measure of information quantity adapted in the given context is adequate, then smaller loss values can in general be obtained for larger values of the information quasi-quantity. Thus, to reduce the loss more, larger quantities of information would in general be needed. On the other hand, it is clear that, in general, different "pieces" of information of equal quasi-quantity would lead to different values of loss reduction. Therefore, if loss reduction at a minimum information "cost" is the agent's goal, it makes sense to search for the specific information that would allow the agent to achieve that goal. It is also rather natural to use the initial value of the loss L 0 ≡ L(∅) that the agent can obtain in the absence of any (additional) information as a reference point for the reduced loss. Specifically, one can use the ratio γ = L(I) L 0 as a natural dimensionless measure of the achieved loss reduction. The lowest information quasi-quantity needed to achieve such a loss reduction can be associated with the proper quasi-information complexity C γ of the task in question. This leads us to the following definition.
Note that the minimization in (1) is performed over all possible "kinds", or "pieces" of information that -if used optimally by the agent -would yield the value of loss not exceeding the given fraction γ of the original value L 0 . Note also that the specific interpretations of the loss L(·) and quantity I(·) are intentionally left open by the definition (1). The understanding is that they have to be made more concrete by taking the "nature" and the details of the system in question into account.
In the next two sections, we consider two more specific examples that illustrate the use of the proposed definition.

III. OPTIMIZATION
Consider a typical "engineering" case of optimization under uncertainty, with the expected value of the objective function being the main optimization criterion (stochastic optimization formulation). The overall task can be concisely written as follows.
min x∈X where X ⊂ D is the set of all feasible solutions, i.e. the set satisfying all (deterministic) constraints that may be present in the problem formulation (with D being the space to which all solutions belong like a suitable Euclidean space); Ω is the base space of possible values of input data parameters that are not known with certainty often referred to as a parameter space; P is a probability measure on (Ω, F) (where F is a suitable sigma-algebra) that describes the initial state of information available to the agent; f : Ω × D → R is a function integrable on Ω for each x ∈ X describing the specific optimization objective.
The value of the initial loss L 0 then becomes simply here x * P is a solution of (2) and x * ω is a solution of min x∈X f (ω, x) for the given ω of the parameter space Ω.
As it has been argued in [10] and [11], in the general context of problem (2), additional information can be obtained by the agent by means of querying information sources. This can be accomplished by the agent via formulating and asking questions and receiving corresponding answers from the source(s). It has been further argued that the appropriate meaning of information quasi-quantity is supplied by pseudoenergy that provides real-valued measure for both question difficulty and answer depth functionals. The reason pseudoenergy is appropriate in the given context is that it takes into account the source's knowledge structure and therefore allows the agent to correctly select optimal "pieces" of information to maximize their effect on the given problem.
The role of "pieces" of information themselves is played by questions which can be associated, following the earlier developments of [12][13][14] and [15,16], with partitions of the problem parameter space Ω. The corresponding quasi-quantity is then given by the question difficulty functional G(Ω, C, P ) where the partition C = {C 1 , . . . , C r } is a collection of subsets of Ω such that C i ∩C j = ∅ for i = j and ∪ r i=1 C i = Ω. The loss L(C) corresponding to question C can be interpreted as the minimum loss that an optimizing agent can obtain upon reception of a perfectly accurate answer to question C can be easily seen to take the form where P C j is the conditional measure corresponding to the subset C j ∈ C. It is straightforward to show that L(C) ≤ L 0 . Correspondingly, the informational complexity C γ of the optimization task (2) takes the form where minimization in (5) is over all possible partitions of Ω. The form of informational complexity (5) assumes a specific source knowledge structure which is encoded in the form of question difficulty functional G(·). In particular, as was shown in [10], in an isotropic (but in general non-uniform) case, the functional G(·) depends besides the "initial" probability measure P , on an integrable function u: Ω → R + on the parameter space Ω: . If the knowledge structure is unknown, it appears reasonable to assume the most symmetric case (uniform and isotropic) in order to obtain a "benchmark" (or "universal") task complexity. In this case, the question difficulty reduces to Shannon entropy H(P (C)) ≡ H(P (C 1 ), . . . , P (C r )) of the discrete probability distribution induced by the partition C, and the informational task complexity C γ becomes simply A. Example Consider the stochastic optimization problem of the form where the only uncertain parameter is ω which has a uniform distribution on the interval Ω = [0, 1]. The situation is depicted in Fig. 1 and is referred to as Example 1 in what follows. It is straightforward to show that for a partition C of Ω into r subsets of equal measure, the loss (4) takes the form On the other hand, if one uses (in the absence of information about possible information sources and their knowledge structure) the uniform isotropic model, the difficulty functional reduces to Shannon entropy and G(Ω, C, P ) = H(P (C)) = log r. The relationship between the information quasi-quantity H(P (C) and the corresponding loss (rescaled so that L 0 = 0) is shown in Fig. 2.
The task complexity C γ for some values of the parameter γ are shown in Table I. In particular, the "full" task complexity C 0 for this example is infinite.
Suppose now that the parameter space Ω and the initial measure P are the same but the task is somewhat different. Specifically, the stochastic optimization problem has the linear form (see   3 for an illustration). We refer to this example as Example 2.
In this case, as it is easy to see, it is sufficient to consider questions corresponding to partitions of Ω into two subsets only, in order to fully get rid of the agent uncertainty with respect to the optimal solution -assuming that perfectly accurate answers to such questions are available. Specifically, Then the loss (4) takes the form and the information quasi-quantity becomes The relationship between them is shown in Fig. 4. The task complexities for some values of γ are shown in Table II. One can see that the "full" complexity C 0 for this example is finite.
Let us now make some observations (and careful generalizations).
• Even if the "uncertainty structure" (the parameter space Ω and the measure P ) is precisely the same, the task complexities may be different (and even very different) if the agent is solving different problems. In the two examples just discussed, for instance, the complexity C 0 is infinite for Example 1 while it is and finite (and rather small) for Example 2.
• The "full" complexity C 0 typically does not tell the whole story about the "information content" of a problem.
• The whole curve C γ is in principle needed to obtain a picture of the problem's "information susceptibility", or, equivalently, the ability of additional information to improve the solution quality.  • The knowledge of the curve C γ , coupled with that of available additional information sources and their knowledge structure (see [10,11] for a discussion of the latter), allows the agent to evaluate the effectiveness of additional information for the particular problem and its corresponding value.

IV. STOCHASTIC PROCESSES AND STATISTICAL COMPLEXITY
Consider now an application from a different domain: the case of discrete-time stochastic processes. To make the discussion more concrete, let us consider a specific simple example (referred to as Example A in what follows) which is borrowed from [17]. Suppose the unobserved symbols A and B are generated randomly with equal probability. Symbols 0 and 1 -that are observed -correspond to pairs of A and B as follows: {AA, AB, BB} → 1, {BA} → 0 (see Fig. 5 for an illustration). For example, if AABAB was generated, the observer will see 1101.
The concept of ǫ-machines was introduced in [ intuitive (and practical) notion of complexity as the amount of underlying "structure" in the system. ǫ-machines consist of casual states and transitions between them (see [9] for a detailed exposition). Each time a transition happens, an observed symbols is output. They can be thought of as functions on Markov chains. Causal states are equivalence classes of previous histories: given two histories belonging to the same causal state S the conditional distribution of future string of bits is the same. Thus ǫ-machines are deterministic meaning that given a causal state and an output symbol, the next causal state is uniquely determined. ǫ-machines can in principle be reconstructed from binary tree representation of the system output. Considering longer symbol sequences (words) allows for distinguishing more distinct causal states (which in turn requires longer output sample sizes). It can be shown that, for our example, the full ǫ-machine has the form shown in Fig. 6.
Given an ǫ-machine M for the system, the statistical complexity C µ is defined as the minimum expected amount of information that needs to be kept track of for optimal prediction of the next bit (which in general is imperfect): where P (S) is the (steady state) probability of the causal state S. The topological complexity is a related quantity that reflects just the number of causal states in the ǫ-machine: For our example, it is easy to see that P (1AiB) = i+1 2 i+2 , i = 1, 2 . . . and P (1A) = 1/4. Thus C µ (M) = 2.71. Note that the topological complexity C τ = log |M| of this system is infinite.
The entropy rate for an ǫ-machine (and the corresponding dynamic system) can be found as where A is the alphabet of output symbols (A = {0, 1} in this example). The entropy rate can be thought of as the measure of uncertainty per symbol that cannot be removed by finding the inherent structure of the system. For our example, the entropy rate is found to be equal to 0.678.
We will also need the notion of relative entropy rate h µ (M|M ′ ) of ǫ-machine M with respect to another ǫ-machine [18] M ′ . Let g: M ′ → M be a map between states of these two ǫ-machines.
Then the relative entropy rate h µ (M|M ′ ) is defined as It is straightforward to show that where is the corresponding Kullback-Liebler distance.
To make a link between task complexity and statistical complexity, we need to decide on the suitable task. It appears reasonable, since in this case we want to study the complexity of our system "in its own right", the logical choice for the task is that of suitably defined prediction. We also need to define the corresponding loss in a logical way. Several choices are in principle possible here, with quadratic and logarithmic loss being the two popular ones in prediction algorithms literature. We will use the latter of the two. Specifically, we will use the following single bit loss with the minimum being achieved for σ = p. Furthermore, one can show that where KL(p||σ) = p log p σ + (1 − p) log 1−p 1−σ is the Kullback-Liebler distance between distributions (p, 1 − p) and (σ, 1 − σ).
Comparing (10) and (8) we can see that the entropy rate for the given ǫ-machine represents the minimum possible long-term (i.e. expected) logarithmic prediction loss. In other words, this is the minimum prediction loss that can be obtained by an optimally acting agent in possession of the complete information about the system. It is reasonable to identify the information I from the general definition (1) with some ǫ-machine [19] describing the system's output. Depending on the particular ǫ-machine available to him, the agent may possess complete or partial information. Let us denote the "full" ǫ-machine corresponding to complete information by M * . Since the logarithmic loss cannot be reduced below that obtained from M * , it makes sense to set L(M * ) = 0 (12) and interpret L(M) for any other ǫ-machine as the expected logarithmic loss in excess of h µ (M * ).
One can easily show that the expected logarithmic prediction loss for a system functioning according to the "full" ǫ-machine M * but predicted optimally with the help of another ǫ-machine M is equal to the relative entropy rate h µ (M|M * ). Using the adapted loss definition (12) The information quasi-quantity corresponding to the ǫ-machine M can be defined, in the absence of any information about possible sources and their knowledge structure, with the help of the most symmetric model for the latter -uniform and isotropic. This leads, as was mentioned earlier, to the Shannon entropy for the steady state distribution of the corresponding ǫ-machine which is nothing else but the statistical complexity of M: In particular, if the information available to the agent is complete, i.e. M = M * , then the information quasi-quantity (14) coincides with the system statistical complexity (7) (and the loss the agent can achieve vanishes).
Let us now find (or estimate) the quasi-information complexity for the prediction task for the original example. The general definition (1) applied for this case reads since the role of information I is played by various ǫ-machines M. The original loss L 0 here should be identified with the expected logarithmic prediction loss that can be obtained without any knowledge of the underlying statistical mechanism, i.e. using a partial ǫ-machine with a single state. The minimum in (15) [20] in subset S k with a nonzero transition probability from S ′ . We denote the resulting ǫ-machine by M(κ). Given this construction, the relation (15) can be rewritten as where minimization is over all transition-consistent partitions of the state set of the full ǫ-machine Finding the exact minimum in (16) appears to be a rather difficult problem since the number of transition-consistent partitions of the state set of M * is in general exponential in the number of casual states in M * . Therefore here we settle for some reasonable choices of "partial" information M instead. This way, clearly, we will generally obtain upper bounds on the exact values of C γ . Fig. 7 shows several such "partial" ǫ-machines that obtain naturally in the process of ǫ-machine reconstruction from sample outputs of the system. Let us denote the "partial" ǫ-machines with k + 1 nodes by M k . The map g: M * → M k for this case has the form g(1AjB) = 1AjB for j < k and g(1AjB) = 1AkB for j ≥ k. The values of relative entropy and statistical complexity of these ǫ-machines are shown in Table III. The dependence of the loss on the information quasi-quantity can be found from the data of Table III by a simple rescaling (so that L(M 1 ) = 1). The results are shown in Fig. 8. The quasi-information complexity C γ for different values of the parameter γ can be read directly from the plot. Some of the resulting values are shown in Table IV.
To consider a different example (called Example B in what follows), let us keep the topology of the exact ǫ-machine for the example just discussed but change the transition probabilities so that the steady state probabilities do not decay as fast "down the line" (see Fig. 9). Specifically,   let the transition probabilities be Pr N +2 and Pr(0 → 1) = 1. Just like in Example A, a transition from a state to another state with a numerically higher label or to itself is accompanied by an output of 1, and a transition from any state to state 0 outputs 0. Note that the number of states for this ǫ-machine has to be finite (but can be made arbitrarily large) in order for steady state probabilities to be positive.
The probabilities shown in Fig. 10 have the following values: and for k = 1, 2, . . . , N . The steady state probabilities for the "partial" ǫ-machines can be computed in the same way as those for the exact one, and thus the information quasi-quantities equal to the corresponding Shannon entropies. On the other hand, the value of loss is found in a straightforward fashion using the general expression (13) and taking into account that the map g: M * → M k in this case has the form g(j) = j if j < k and g(j) = k if j ≥ k, for the "partial" ǫ-machine M k with k + 1 nodes. The resulting dependence of loss (in the convention L 0 = L(M 0 ) = 1 and setting N = 1000) on the information quasi-quantity is shown in Fig. 11. The values of the quasiinformation complexity C γ for different values of γ can be found directly for this dependence. Some of these values are shown in Table V.
Now, consider an ǫ-machine shown in Fig. 12. We will refer to this example as Example C. As can be seen from the figure, this ǫ-machine has N states where N is a (large) even number, and the Any transition to an even numbered state (either from an odd numbered state or from itself) outputs 1, and any transition to an odd numbered state outputs 0. It is easy to see that the steady state probabilities for this system have the form P (i) = 1−ǫ 1 1−ǫ i P (1) for i = 2, . . . , N . If one sets ǫ i = 1 bi where b > 1 is a real number, then a simple computation shows that Let the incomplete information about the system be represented by the ǫ-machines shown in Fig. 13. The first of these is obtained, just like in the original example, by simply estimating the overall probabilities of 1 and 0 in the output assuming independence of output symbols (thus an absence of any "information processing" by the system). A simple calculation gives the following values for the probability p 1 : , and p 0 = 1 − p 1 . The second ǫ-machine in Fig. 13 is obtained by mapping all odd numbered states of the exact ǫ-machine into the state O and all even numbered states -into the state E. The transition probabilities between states O and E are as shown in Fig. 13 where , respectively. Any transition into state O is accompanied by an output of 0, and any transition into state E -by an output of 1.
If one sets the parameter b equal to 3 and N = 1000, the statistical complexity of the system calculates to be equal to 9.97. On the other hand, for the same values of parameters b and N , the loss corresponding to the two "partial" ǫ-machines shown in Fig. 13 is L(M 0 ) = 0.98 and L(M 1 ) = 0.008, with their information quasi-quantities (Shannon entropies) being equal to 0 and 1.0, respectively. It follows that, C 0.008 = 1.0 for this system (or, rather, that 1.0 is a upper bound on C 0.008 as explained earlier).
We can now make some interesting observations. • Comparing Examples A and B, we notice that the "full" quasi-information complexity C 0 (which is equal to statistical complexity) in Example B is significantly higher (7.8 vs 2.7) reflecting higher steady state probabilities of higher numbered states for Example B.
• The quasi-information complexity values for γ > 0 are also higher in the absolute sense but are about the same in the relative (measured as fractions of C 0 ) sense for Example B, compared to Example A. The latter observation can likely be explained by the two ǫ-machines sharing the same topology.
• If we now compare Examples A and C, we can see that the statistical complexity of the system in Example C is significantly higher than that in Example A (10.0 vs 2.7), again reflecting higher steady state probabilities of larger number of states in Example C.
• On the other hand, the quantity C 0.01 is actually lower for the "circular" system in Example C (1.0 vs. 1.6). Informally speaking, this means that if a relative 1% difference in prediction quality is immaterial to the agent, the system in Example C would appear less complex than that in Example A.
• In this particular case, the latter phenomenon has a simple explanation. Indeed, if the agent predicts the next bit based on the hypothesis of i.i.d. distribution (which corresponds to the agent using the simplest ǫ-machine M 0 possessing no "structure") the resulting error is a lot larger than that afforded by the knowledge of the 'full" ǫ-machine (complete information).
In fact, the bits appear to be almost "unpredictable" (as the estimated probability of 1 is close to 0.5). The situation changes drastically if the agent is able to get access to M 1 with two causal states, i.e. able to realize that in this system 0 is followed by 1 and vice versa with high probability. The knowledge of M 1 allows the agent to predict nearly as well as if he had access to the full ǫ-machine M * with 1000 causal states. Put slightly differently, once the realization is made that 0 and 1 symbols "mostly" alternate in this system, the rest of information just introduces small corrections to this dominant behavior.
• Summarizing, one can say that to an agent not concerned (for whatever reason) with small (1% or less) "residual" losses, the system from Example C would appear as genuinely less complex than that in Example A, in spite of a much larger statistical complexity in Example C.
Informally speaking, an agent observing the system output in Example C would quickly observe that 0's and 1's mostly alternate but sometimes shorts strings of the same symbol are observed. This observation would let the agent conclude that the system can be reasonably accurately described by an ǫ-machine of the form M 1 presented earlier. It would take the agent, generally speaking, a lot more effort to discern finer details: namely that length of these short string of the same symbol tend to change just a little as time passes. The discovery of these fine details though would improve the agent's predictive ability only very slightly. One could say that, for this particular system, it is relatively easy to understand its behavior "almost fully" but a lot more difficult to fill in the remaining small details. The initially very steep C γ curve that flattens out drastically reflects that.

V. CONCLUSION
The main contributions of this article can be briefly summarized as follows.
• The notion of information-related complexity was extended from systems described by stochastic processes to more general tasks (performed by a rational agent), including optimization and decision making problems with uncertainty about input data.
• A general problem oriented definition of complexity was proposed and it was shown that it reduces to a generalization of statistical complexity in the case the system output is described by a discrete-time stochastic process and the agent's task is that of prediction .
• The degree of task completion was explicitly considered and it was argued that the information-related complexity should be properly understood relative to the extent of task completion, or, equivalently, properly defined loss. In other words, the informationrelated complexity for the given task is inherently a real-valued function, and not just a real number.
• It was argued, based on results of [10,11], that the minimum information quantity necessary to complete the task to the given degree should be really interpreted as appropriate quasi-quantity that takes into account the degree of difficulty of obtaining the corresponding information in the given environment. The traditional information quantity measures (such as Shannon entropy) obtain from the appropriate quasi-quantity in the particular case of maximum symmetry, when either all different "pieces" of information are identical (with respect to the degree of difficulty of their acquisition by the agent) or their differences are unknown.
Let's discuss some of these points in an informal way. A more complex system is the one that "takes a lot of work" to fully understand for a rational agent, and, moreover, a complex system still takes a lot of work to understand "almost fully". On the contrary, a system that is "easy" to understand to a large degree but very hard to "get the rest" (a system with for which the C γ curve is initially very steep but flattens out at close to zero loss) would appear to be of low complexity to all but "very discerning" agents. One might ask: what about the true "objective" complexity of a system that's independent (being objective) on all and any agents. We believe that this question might be more difficult and deeper than it appears. One possible answer is that it depends on the point of view and the level of inquiry. The same system can be complex from one point of view and much less so from another. Additionally, it can be complex at high level of detail but much less complex at "lower resolution". For instance, in natural sciences, a system's ability to "innovate", or spontaneously create new quality could be due to various levels of its structure detail. Hence, its appropriate complexity would also depend on that. Generally speaking, it is our opinion that