<!-- % ================================================= -->
<!-- % ================ Meet \gls{cnm} ======================= -->
<!-- % ================================================= -->
## Cluster-based Network Modeling (CNM) {#sec-sec_1_1_2_CNM}
In this subsection, the workflow of \gls{cnm} [@Fernex2021] will be elaborated, as well as the previous attempt to expand the algorithm to accommodate a range of model parameter values $\vec{\beta}$.
\gls{cnm} [@Fernex2021] is the basis on which \gls{cnmc} is built or rather
\gls{cnmc} invokes \gls{cnm} multiple times for one of its preprocessing steps.
CNM can be split up into 4 main tasks, which are 
data collection, clustering, calculating 
transition properties and propagation.
The first step is to collect the data, which can be provided from any dynamic system or numerical simulations. 
In this study, only dynamical systems are investigated.
Once the data for the dynamical system is passed to \gls{cnm}, the data is clustered, e.g., with k-means++ algorithm [@Arthur2006]. 
A detailed elaboration about this step is given in section [-@sec-sec_2_3_Clustering]. \gls{cnm} exploits graph theory for approximating the trajectory as a movement on nodes. 
These nodes are equivalent to the centroids, which are acquired through clustering. 
Next, the motion, i.e., movement from one centroid to another, shall be clarified.\newline

In order to fully describe the motion on the centroids, the time at which 
one centroid is visited is exited, and also the order of movement must be known. 
Note, when saying the motion is on the centroids, that 
means the centroids or characteristic nodes do not move 
at all. The entire approximated motion of the original trajectory
on the nodes is described with the transition 
property matrices $\boldsymbol Q$ and $\boldsymbol T$.
The matrices $\boldsymbol Q$ and $\boldsymbol T$ are the transition probability and transition time matrices, respectively. 
$\boldsymbol Q$ is used to apply probability theory for predicting the next following most likely centroid. In other words, if 
the current location is at any node $c_i$, 
$\boldsymbol Q$ will provide all possible successor centroids 
with their corresponding transition probabilities.
Thus, the motion on the centroids 
through $\boldsymbol Q$ is probability-based.
In more detail, the propagation of the motion on the centroids can be described as equation @eq-eq_34 . 
The variables are denoted as the propagated $\vec{x}(t)$ trajectory, time $t$, centroid positions $\vec{c}_k,\, \vec{c}_j$, the time $t_j$ where centroid $\vec{c}_j$ is left and the transition time $T_{k,j}$ from $\vec{c}_j$ to $\vec{c}_k$  [@Fernex2021].
Furthermore, for the sake of a smooth trajectory, the motion between the centroids is interpolated through a spline interpolation.\newline
$$
\begin{equation}
    \vec{x}(t) = \alpha_{kj} (t) \, \vec{c}_k + [\, 1 - \alpha_{kj} (t)\,] \, \vec{c}_j, \quad \alpha_{kj} (t) = \frac{t-t_j}{T_{k,j}}
    \label{eq_34}
\end{equation}
$$ {#eq-eq_34}


The $\boldsymbol Q$ matrix only contains non-trivial transitions, i.e., 
if after a transition the centroid remains on the same centroid, the transition is not considered to be a real transition in \gls{cnm}. 
This idea 
is an advancement to the original work of Kaiser et al. [@Kaiser2014].
In Kaiser et al. [@Kaiser2014] the transition is modeled 
as a Markov model. Markov models enable non-trivial transitions. Consequently,
the diagonals of the resulting non-direct transition matrix $\boldsymbol{Q_n}$  
exhibits the highest values. The diagonal elements stand for non-trivial 
transitions which lead to idling on the same centroid 
many times. Such behavior is encountered and described by Kaiser et al. [@Kaiser2014].\newline 


There are 3 more important aspects that come along when 
adhering to Markov models. First, the propagation of motion is done 
by matrix-vector multiplication. In the case of the existence of a 
stationary state, the solution 
will converge to the stationary state, with an increasing number of iterations, where no change with time happens.
A dynamical system can only survive as long as change with time exists.
In cases where no change with respect to time is encountered, equilibrium 
or fixed points are found.
 Now, if a stationary state or fixed point 
exists in the considered dynamical system, the propagation 
will tend to converge to this fixed point. However, the nature of 
Markov models must not necessarily be valid for general dynamical systems. 
Another way to see that is by applying some linear algebra. The 
long-term behavior of the Markov transition matrix can be obtained 
with equation @eq-eq_3_Infinite . Here, $l$ is the number 
of iterations to get from one stage to another. Kaiser et al. 
[@Kaiser2014] depict in a figure, how the values of  
$\boldsymbol{Q_n}$ evolves after $1 \mathrm{e}{+3}$ steps. $\boldsymbol{Q_n}$ has 
become more uniform. 
$$
\begin{equation}
    \label{eq_3_Infinite}
    \lim\limits_{l \to \infty} \boldsymbol{Q_n}^l
\end{equation}
$$ {#eq-eq_3_Infinite}

If the number of steps is increased even further 
and all the rows would have the same probability value, 
$\boldsymbol{Q_n}$ would converge to a stationary point. What
also can be concluded from rows being equal is that it does not matter 
from where the dynamical system was started or what its 
initial conditions were. The probability 
to end at one specific state or centroid is constant as 
the number of steps approaches infinity. Following that,
it would violate the sensitive dependency on initial conditions, 
which often is considered to be mandatory for modeling chaotic systems. Moreover, chaotic
systems amplify any perturbation exponentially, whether at time 
$t = 0$ or at time $t>>0$. \newline 

Thus, a stationary transition matrix $\boldsymbol{Q_n}$ is prohibited by chaos at any time step.
This can be found to be one of the main reasons, why 
the  **C**luster **M**arkov based **M**odeling (\gls{cmm}) 
often fails to 
predict the trajectory. 
Li et al. [@Li2021] summarize this observation 
compactly as after some time the initial condition 
would be forgotten and the asymptotic distribution would be reached.
Further, they stated, that due to this fact, \gls{cmm} would 
not be suited for modeling dynamical systems. 
The second problem which is involved, when deploying 
regular Markov modeling is that the future only depends
on the current state. However, [@Fernex2021] has shown
with the latest \gls{cnm} version that incorporating also past 
centroid positions for predicting the next centroid position 
increases the prediction quality. The latter effect is especially 
true when systems are complex.\newline 


However, for multiple consecutive time steps 
the trajectories position still could be assigned to the same 
centroid position (trivial transitions).
Thus, past centroids are those centroids that are found when going 
back in time through only non-trivial transitions. The number of incorporated 
past centroids is given as equation @eq-eq_5_B_Past, where $L$ is denoted 
as the model order number. It represents the number of all 
considered centroids, where the current and all the past centroids are included, with which the prediction of the successor centroid 
is made.
$$
\begin{equation}
    B_{past} = L -1
    \label{eq_5_B_Past}
\end{equation}
$$ {#eq-eq_5_B_Past}

Furthermore, in [@Fernex2021] it is not simply believed that an 
increasing model 
order $L$ would increase the outcome quality in every case. 
Therefore, a study on the number of $L$ and the clusters $K$
was conducted. The results proved that the choice of 
$L$ and $K$ depend on the considered dynamical system.
\newline

The third problem encountered when Markov models are used is 
that the time step must be provided. This time step is used 
to define when a transition is expected. In case 
the time step is too small, some amount of iterations is 
required to transit to the next centroid. Thus, non-trivial 
transitions would occur. In case the time step is too high, 
the intermediate centroids would be missed. Such behavior
would be a coarse approximation of the real dynamics. Visually this can 
be thought of as jumping from one centroid to another while
having skipped one or multiple centroids. The reconstructed 
trajectory could lead to an entirely wrong representation of the 
state-space.
CNM generates the transition time matrix $\boldsymbol T$ from data 
and therefore no input from the user is required.\newline

A brief review of how the $\boldsymbol Q$ is built shall be provided. 
Since the concept of 
model order, $L$ has been explained, it can be clarified that
it is not always right to call $\boldsymbol Q$ and $\boldsymbol T$ matrices. 
The latter is only correct, if $L = 1$, otherwise it must be 
denoted as a tensor. $\boldsymbol Q$ and $\boldsymbol T$ can always be 
referred to as tensors since a tensor incorporates matrices, i.e., a matrix is a tensor of rank 2. 
In order to generate $\boldsymbol Q$, 
$L$ must be defined, such that the shape of $\boldsymbol Q$ is 
known. The next step is to gather all sequences of clusters 
$c_i$. To understand that, we imagine the following scenario, 
$L = 3$, which means 2 centroids from the past and the 
current one are 
incorporated to predict the next centroid.
Furthermore, imagining that two cluster sequence scenarios were found,
$c_0 \rightarrow c_1 \rightarrow c_2$ and  $c_5 \rightarrow c_1 \rightarrow c_2$. 
These cluster sequences tell us that the current centroid is $c_2$ and the remaining centroids belong to the past. 
In order to complete the sequence for $L = 3$, the successor cluster also needs 
to be added, $c_0 \rightarrow c_1 \rightarrow c_2 \rightarrow c_5$ and $c_5 \rightarrow c_1 \rightarrow c_2 \rightarrow c_4$.
The following step is to calculate the likelihood 
of a transition to a specific successor cluster. This is done with equation @eq-eq_4_Poss, where $n_{k, \boldsymbol{j}}$
is the amount of complete sequences, where also the successor
is found. The index $j$ is written as a vector in order 
to generalize the equation for $L \ge 1$. It then contains 
all incorporated centroids from the past and the current centroid.
The index $k$ represents the successor centroid ($\boldsymbol{j} \rightarrow k$).
Finally, $n_{\boldsymbol{j}}$ counts all the matching incomplete sequences.
$$
\begin{equation}
    \label{eq_4_Poss}
     P_{k, \boldsymbol j} = \frac{n_{k,\boldsymbol{j}}}{n_{\boldsymbol{j}}}
\end{equation}
$$ {#eq-eq_4_Poss}

After having collected all the possible complete cluster sequences with their corresponding probabilities $\boldsymbol Q$, the transition time tensors $\boldsymbol T$ can be inferred from the data.
With that, the residence time on each cluster is known and can be 
used for computing the transition times for every 
single transition. At this stage, it shall be highlighted again, 
CNM approximates its data fully with only two 
matrices or when $L \ge 2$ tensors, $\boldsymbol Q$ and $\boldsymbol T$. The 
final step is the prorogation following equation @eq-eq_34 . 
For smoothing the propagation between two centroids the B-spline interpolation 
is applied.

<!-- % It can be concluded that one of the major differences between \gls{cnm} and \gls{cmm} is that {cnm} dismissed Markov modeling.  -->
<!-- % Hence, only direct or non-trivial transition are possible. -->
<!-- % Fernex et al. [@Fernex2021] improved [@Li2021] by  -->
<!-- % rejecting one more property of Markov chains, namely  -->
<!-- % that the future state could be inferred exclusively from the current state.  -->
<!-- % Through the upgrade of [@Fernex2021], incorporating past states for the prediction of future states could be exploited. -->

{{< include 4_CNMc.qmd >}} 