1 Introduction

In this article, an interval type-3 fuzzy-fractal time series prediction method and its application to COVID-19 forecasting are presented. This method combines interval type-3 fuzzy and fractal theories to obtain a prediction of COVID-19. The mathematical concept of the fractal dimension [1] is utilized to measure the complexity of the time series. In this case, the methods for dimension approximation compute a numeric value utilizing a time series. This value represents an approximation to the complexity level of a time series. Based on numerical values for the fractal dimensions of different time series, linguistic values for the dimensions can be constructed, and then, a set of fuzzy rules that can predict confirmed cases and deaths for the countries based on the complexity of a time series [2]. The fuzzy rules can be derived by applying fuzzy clustering on the data [3]. The main goal of utilizing type-3 fuzzy is because, theoretically speaking, type-3 should be able to outperform type-2 and type-1 fuzzy logic in handling uncertainty in complex decision-making problems, and the application at hand is an interesting problem to test this hypothesis. There have been previous works using type-2 and type-1 in prediction, and in this work, we can perform a comparison of results. The hybrid approach can be applied in the following fashion. First, a set of fuzzy rules should be established for the particular application considering the utilization of the fractal dimension. Second, a method for approximating the dimension should be implemented. Third, the dimensions are utilized as system inputs to perform the forecast for the problem at hand.

The fuzzy rules can be established with the Mamdani reasoning method, and the centroid as defuzzification approach [4]. However, the Sugeno fuzzy system in which the consequents are mathematical functions is also a viable alternative [5]. The Sugeno fuzzy model can be built with a neuro-fuzzy approach [6] to learn from real data the optimal parameter values for the mathematical functions and for the membership functions [7]. In this article, the interval type-3 fuzzy-fractal method for prediction utilizing the Mamdani approach was applied.

Recently, the very rapid propagation of COVID-19 has been noticed, including its several waves, and spreading to all continents in the world. In particular, in the case of Europe, several countries, like Italy, Spain, and France, have been hit very hard with the spread of the COVID-19 virus, having a significant number of confirmed cases and deaths [8,9,10,11,12,13]. In the case of the American continent, United States, Canada, and Brazil have also suffer a significant number of cases due to the rapid spread of COVID-19 [14,15,16,17]. In conclusion, it is very important that vigorous research work should be undertaken for understanding all facets of this problem [18,19,20]. There are also several recent works on predicting and modeling COVID-19 dynamics in space and time [21,22,23,24,25,26,27,28]. In addition, it is possible that future pandemics occur and the proposed method could also be used. In particular, for this article, the main focus is on the forecasting aspect of the problem, which means utilizing clusters of similar countries and fuzzy rules to enable achieving a good forecast.

In the existing literature of intelligent models for prediction we can find supervised neural networks (NNs) [6], ensemble NNs [28], adaptive neuro-fuzzy inference systems (ANFISs) [6], type-1 fuzzy systems (T1Fs) [4], type-2 fuzzy systems (T2FSs), and interval type-3 fuzzy systems (IT3FSs). In this work, we are proposing a hybrid model combining an IT3FS with a fractal dimension (FD) model that we could name IT3FS + FD that combines the advantages of type-3 fuzzy models with the capabilities of fractal theory. In Table 1, we are presenting a comparison of the existing models with respect to the proposed IT3FS + FD model, where we can appreciate why the proposal of this work has the potential to outperform the other methods in complex problems. As can be noted from Table 1, fuzzy methods do not require learning from training data (as NN models do), but require knowledge from experts. In addition, some models in the table are hybrid, like ANFIS that combines fuzzy with NNs, and in particular our proposal is also hybrid, combining IT3 FS with FD. The time to develop NN-based models is longer because they require training, which a FS model do not. An advantage of NN models is that they have pattern recognition abilities that FS models do not, but for our proposed IT3FS + FD model, the fractal dimension provides this ability without requiring training. In summary, we believe that our proposed model can be efficient (in computing time) and accurate, due to its handling of uncertainty with IT3FS and its use of FD for pattern recognition.

Table 1 Comparative of methods in the literature with respect to the proposed method in this work

The key contribution of the article is the fuzzy-fractal hybridization that prudently utilizes interval type-3 fuzzy and fractal dimension for predicting the confirmed cases and deaths. A fuzzy system is put forward as a model of the expert knowledge on predicting time series. In comparing with existing literature in this area, this paper is for the first time putting forward the utilization of interval type-3 fuzzy logic in the prediction area. Also, the combination of type-3 with fractal theory has not been previously proposed and can be viewed as another important proposal to modeling complex phenomena. In addition, due to the COVID-19 situation in the world, we believe that this work will have an important scientific impact and will, in general, benefit the society. Of course, in the future, the proposed method could be used in predicting other similar pandemics.

The other sections of the article are structured in a logical fashion: Sect. 2 offers a background of fractal concepts for the sake of readability. Section 3 puts forward the terminology of interval type-3 fuzzy theory. Section 4 offers a detailed explanation of the interval type-3 fuzzy-fractal approach for prediction. Section 5 summarizes the results and offers an analysis of the achieved results. Lastly, Sect. 6 is dedicated to the conclusions and discussing possible avenues of research.

2 Basic Concepts of the Fractal Dimension

Recently, significant progress has been made in comprehending the complexity of an object through the utilization of fractal constructs [1]. For example, time series in finance and economics exhibit properties suggesting a fractal structure [29, 30]. In addition, applications in medicine, robotics, control, and others can be found in the recent literature. The fractal dimension is defined in the following fashion:

$$ \begin{aligned} d & = \lim \, \left[ {\ln N\left( r \right)} \right]{ / }\left[ {\ln \left( {1/r} \right)} \right] \\ & r \to 0, \\ \end{aligned} $$
(1)

where N(r) stands for number of boxes needed for object coverage and r is related to box size. d defined in (1) is approximated with box covering for r sizes and then utilizing logarithmic regression for computing an estimate of the d value (box counting algorithm). The estimation of this dimension for an object can be done with the mathematical expression:

$$ \ln N\left( r \right) = \ln \beta - d\;{\text{In}}r, $$
(2)

where d stands for the dimension.

Based on the previous explanation, it is straightforward to say that the fractal dimension provides a methodology for object classification. The main reason is due to the fact that the fractal dimension is related to the level of object complexity. In particular, for a time series, which is the subject of this paper, a classification scheme based on the fractal dimension can be established. The explanation of this scheme is that smoothness on the object means that the dimension is close to one, otherwise, it is closer to two (assuming that we are on the plane).

3 Terminology of Interval Type-3 Fuzzy Theory

A fuzzy system is utilized as a forecasting tool by building an adequate input space partition, in such a way that objects are discriminated by their features. In this situation, we can begin by utilizing fuzzy clustering [3, 31, 32] to group the data, and then after that build a fuzzy system that will constitute a forecasting scheme for an application. Originally fuzzy sets and logic were put forward by Lotfi Zadeh in 1965 [33], which are now called type-1 fuzzy sets and logic, later himself proposed the type-2 fuzzy term in 1975 to better represent the uncertainty in the real world [4], and correspondingly has had recently many successful applications. More recently, interval type-3 has been proposed as an even better way to manage uncertainty and has been applied in the control area outperforming type-1, and type-2, and now we are proposing its use for the first time in forecasting. Below some fundamental definitions of type-3 fuzzy sets are put forward to give an idea of the difference of this concept when compared to other types of fuzzy sets. Basically, the most important difference is that in interval type-3 case, the secondary function is of interval type-2 form instead of being type-1, which is the one used for general type-2 fuzzy sets.

Definition 1

A type-3 fuzzy set (T3 FS) [34,35,36], denoted by \({A}^{(3)}\), is represented by the plot of a trivariate function, called membership function (MF) of \({A}^{(3)}\), in the Cartesian product \(X\times \left[\mathrm{0,1}\right]\times [\mathrm{0,1}]\) in \([\mathrm{0,1}]\) where \(X\) is the universe of the primary variable of \({A}^{(3)}\), x. The MF of \({\mu }_{{A}^{(3)}}\) is denoted by \({\mu }_{{A}^{(3)}}(x,u,v)\) (or \({\mu }_{{A}^{(3)}}\) to abbreviate) and it is called a type-3 membership function (T3 MF) of the T3 FS. In other words, more formally,

$${\mu }_{{A}^{(3)}}:X\times \left[\mathrm{0,1}\right]\times [\mathrm{0,1}]\to [\mathrm{0,1}]$$
$${A}^{(3)}=\left\{\left(x,u\left(x\right),v\left(x,u\right),{\mu }_{{A}^{(3)}}(x,u,v)\right) | x\in X, u\in U\subseteq [\mathrm{0,1}],v\in V\subseteq [\mathrm{0,1}]\right\},$$
(3)

where \(U\) stands for the universe of the secondary variable, \(u\) and \(V\) is the universe for tertiary variable \(v\). The 3-D plot of the IT3MF is an isosurface with volume in between the layers of the Surface formed by all the secondary IT2MFs \({\mu }_{{\mathbb{A}}(x) }(u)\) in green color in Fig. 1, which forms the domain of uncertainty (DOU) of IT3 FS.

Fig. 1
figure 1

Representation of the functions of the IT3 FS

3.1 Interval Type-3 Gaussian Functions

In this case, we consider interval type-3 MFs that are scaled Gaussian in the primary and secondary. This function can be represented as, \({\widetilde{\mu }}_{\mathbb{A}}\left(x,u\right)\) = ScaleGaussScaleGauss IT3MF, with Gaussian footprint of uncertainty \(FOU({\mathbb{A}})\), characterized with parameters \([\sigma ,m]\) (UpperParameters) for the upper membership function UMF and for the lower membership function LMF, the parameters \(\lambda \) (LowerScale), \(\mathcal{l}\) (LowerLag) to form the \(DOU=[\underset{\_}{\mu }\left(x\right),\overline{\mu }(x)\)]. The vertical cuts \({\mathbb{A}}_{\left(x\right)}(u)\) characterize the \(FOU\left({\mathbb{A}}\right)\), and are IT2 FSs with Gaussian IT2 MFs, \({\mu }_{{\mathbb{A}}\left(x\right)}\left(u\right)\) with parameters \([{\sigma }_{u},\mathcal{m}(x)]\) for the UMF and LMF \(\lambda \) (LowerScale), \(\mathcal{l}\) (LowerLag). The IT3 MF, \({\widetilde{\mu }}_{\mathbb{A}}\left(x,u\right)=\) ScaleGaussScaleGaussIT3MF(x,{{\([\sigma ,m]\)},\(\lambda \), \(\mathcal{l}\)}) is described with the following equations:

$$\overline{u}\left(x\right)=exp\left[-\frac{1}{2}{\left(\frac{x-m}{\sigma }\right)}^{2}\right]$$
(4)
$$\underline{u}\left(x\right)=\lambda \cdot {\rm{exp}} \left[-\frac{1}{2}{\left(\frac{x-m}{{\sigma }^{*}}\right)}^{2}\right]$$
(5)

where \({\sigma }^{*}=\sigma \sqrt{\frac{\mathrm{ln}\left(\mathcal{l}\right)}{\mathrm{ln}\left(\varepsilon \right)}}\), \(\varepsilon \) is the machine epsilon. If\(\mathcal{l}=0\), then\({\sigma }^{*}=\sigma \). Then, \(\overline{u}\left(x\right)\) and \(\underline{u}\left(x\right)\) are the upper and lower limits of the DOU. The range,\(\delta \left(u\right)\), and radius, \({\sigma }_{u}\) of the FOU are as follows:

$$\delta \left(u\right)=\overline{u}\left(x\right)-\underline{u}\left(x\right)$$
(6)
$${\sigma }_{u}=\frac{\delta \left(u\right)}{2\sqrt{3}}+\varepsilon $$
(7)

The apex or core, \(\mathcal{m}(x)\), of the IT3 MF \(\widetilde{\mu }\left(x,u\right)\), is defined by the expression:

$$\mathcal{m}(x)=exp\left[-\frac{1}{2}{\left(\frac{x-m}{\rho }\right)}^{2}\right]$$
(8)

where \(\rho =(\sigma +{\sigma }^{*})/2\). Then, the vertical cuts with IT2 MF, \({\mu }_{{\mathbb{A}}\left(x\right)}\left(u\right)=[ {\underset{\_}{\mu }}_{{\mathbb{A}}\left(x\right)}\left(u\right),{\overline{\mu }}_{{\mathbb{A}}\left(x\right)}\left(u\right)]\), are described by the following equations:

$${\overline{\mu }}_{{\mathbb{A}}\left(x\right)}\left(u\right)=exp\left[-\frac{1}{2}{\left(\frac{u-u\left(x\right)}{{\sigma }_{u}}\right)}^{2}\right]$$
(9)
$${\underset{\_}{\mu }}_{{\mathbb{A}}\left(x\right)}\left(u\right)=\lambda \cdot{\rm{exp}}\left[-\frac{1}{2}{\left(\frac{u-u\left(x\right)}{{\sigma }_{u}^{*}}\right)}^{2}\right]$$
(10)

where \({\sigma }_{u}^{*}={\sigma }_{u} \sqrt{\frac{\mathrm{ln}\left(\mathcal{l}\right)}{\mathrm{ln}\left(\varepsilon \right)}}\). If \(\mathcal{l}=0\), then \({\sigma }_{u}^{*}={\sigma }_{u}\). Then, \({\overline{\mu }}_{{\mathbb{A}}\left(x\right)}\left(u\right)\) and \({\underset{\_}{\mu }}_{{\mathbb{A}}\left(x\right)}\left(u\right)\) are the UMF and LMF of the IT2 FSs of the vertical cuts of the secondary IT2MF of the IT3 FS.

3.2 Interval Type-3 Triangular Membership Functions

In this case, we consider an interval type-3 triangular membership function, \({\widetilde{\mu }}_{\mathbb{A}}\left(x,u\right)\) = ScaleTriScaleGaussIT3MF, with triangular \(FOU({\mathbb{A}})\), characterized with parameters \([{a}_{1},{b}_{1},{c}_{1}]\) (UpperParameters) for the UMF, and for the LMF, the parameters \(\lambda \) (LowerScale), \(\mathcal{l}\) (LowerLag) to form the\(DOU=[\underset{\_}{\mu }\left(x\right),\overline{\mu }(x)\)]. The vertical cuts \({\mathbb{A}}_{\left(x\right)}(u)\) characterize the\(FOU\left({\mathbb{A}}\right)\), these are IT2 FSs with Gaussian IT2 MFs, \({\mu }_{{\mathbb{A}}\left(x\right)}\left(u\right)\) with parameters \([{\sigma }_{u},\mathcal{m}(x)]\) for the UMF and LMF \(\lambda \) (LowerScale), \(\mathcal{l}\) (LowerLag). The IT3 MF \({\widetilde{\mu }}_{\mathbb{A}}\left(x,u\right)=\) ScaleTriScaleGaussIT3MF(x,{{[a1, b1, c1]},\(\lambda \), \([{\mathcal{l}}_{1},{\mathcal{l}}_{2}]\)}) is described with the following equations:

$$\overline{\mu }(x)=\left\{\begin{array}{ll}0& x<{a}_{1}\\ \frac{x-{a}_{1}}{{b}_{1}-{a}_{1}}& {a}_{1}\le x\le {b}_{1}\\ \frac{{c}_{1}-x}{{c}_{1}-{b}_{1}}& {b}_{1}<x\le {c}_{1}\\ 0& x>{c}_{1}\end{array}\right.$$
(11)

The LMF of the DOU, \(\underset{\_}{\mu }(x)\), is defined for the values a2 and c2 where these are function of the parameters (a1, b1, c1) of the UMF of the DOU, \(\overline{\mu }(x)\), and the elements of the lowerLag (\(\mathcal{l}\)) vector. In other words,

$${a}_{2}={b}_{1}-({b}_{1}-{a}_{1})(1-{\mathcal{l}}_{1})$$
$${c}_{2}={b}_{1}+({c}_{1}-{b}_{1})(1-{\mathcal{l}}_{2})$$
$$\mu \left(x\right)=\left\{\begin{array}{ll}0& x<{a}_{2}\\ \frac{x-{a}_{2}}{{b}_{1}-{a}_{2}}& {a}_{2}\le x\le {b}_{1}\\ \frac{{c}_{2}-x}{{c}_{2}-{b}_{1}}& {b}_{1}<x\le {c}_{2}\\ 0& x>{c}_{2}\end{array}\right.$$
(12)

The function \(\mu (x)\) is multiplied by the \(\lambda \) parameter to form the LMF of the DOU, \(\underset{\_}{\mu }(x)\), described as \(\underset{\_}{\mu }\left(x\right)=\lambda \mu (x)\). Then, \(\overline{u}\left(x\right)\) and \(\underline{u}\left(x\right)\) are the upper and lower limits of the DOU. The range, \(\delta \left(u\right),\) and radius, \({\sigma }_{u}\) of the FOU are as follows:

$$\delta \left(u\right)=\overline{u}\left(x\right)-\underline{u}\left(x\right)$$
$${\sigma }_{u}=\frac{\delta \left(u\right)}{2\sqrt{3}}+\varepsilon $$

where \(\varepsilon \) is a machine epsilon number.

The core, \(\mathcal{m}(x)\), of the IT3 MF \(\widetilde{\mu }\left(x,u\right)\), is defined by the equations:

$$\mathcal{m}\left(x\right)=\left\{\begin{array}{ll}0& x<a\\ \frac{x-a}{{b}_{1}-a}& a\le x\le {b}_{1}\\ \frac{c-x}{c-{b}_{1}}& {b}_{1}<x\le c\\ 0& x>c\end{array}\right.$$
(13)

where \(a=({a}_{1}+{a}_{2})/2\) and \(c=({c}_{1}+{c}_{2})/2\). Then, the vertical cuts with IT2 MFs, \({\mu }_{{\mathbb{A}}\left(x\right)}\left(u\right)=[ {\underset{\_}{\mu }}_{{\mathbb{A}}\left(x\right)}\left(u\right),{\overline{\mu }}_{{\mathbb{A}}\left(x\right)}\left(u\right)]\), are described with the following equations:

$${\overline{\mu }}_{{\mathbb{A}}\left(x\right)}\left(u\right)={\rm{exp}}\left[-\frac{1}{2}{\left(\frac{u-\mathcal{m}(x)}{{\sigma }_{u}}\right)}^{2}\right]$$
(14)
$${\underset{\_}{\mu }}_{{\mathbb{A}}\left(x\right)}\left(u\right)=\lambda \cdot {\rm{exp}}\left[-\frac{1}{2}{\left(\frac{x-\mathcal{m}(x)}{{\sigma }_{u}^{*}}\right)}^{2}\right]$$
(15)

where \({\sigma }_{u}^{*}={\sigma }_{u} \sqrt{\frac{\mathrm{ln}\left(\mathcal{l}\right)}{\mathrm{ln}\left(\varepsilon \right)}}\),\(\mathcal{l}=({\mathcal{l}}_{1}+{\mathcal{l}}_{2})/2\). If \(\mathcal{l}=0\), then\({\sigma }_{u}^{*}={\sigma }_{u}\). Then, \({\overline{\mu }}_{{\mathbb{A}}\left(x\right)}\left(u\right)\) and \({\underset{\_}{\mu }}_{{\mathbb{A}}\left(x\right)}\left(u\right)\) are the UMF and LMF of the IT2 FSs of the vertical cuts of the secondary IT2MF of the IT3 FS.

3.3 Inference and Type-Reduction

In this Work, we consider Mamdani interval type-3 fuzzy systems. The structure of the k-th generic IF–THEN Zadeh fuzzy rule for a Mamdani fuzzy system is the following format:

$${R}_{Z}^{k}:\,IF {x}_{1} is {\mathbb{F}}_{1}^{k} \,and\,\dots\, and\, {x}_{i}\, is {\mathbb{F}}_{i}^{k} and\,\dots\, and\, {x}_{n}\, is \,{\mathbb{F}}_{n}^{k}\, THEN\, {y}_{1} is {\mathbb{G}}_{1}^{k}, \dots, {y}_{j}\, is\, {\mathbb{G}}_{j}^{k}, \dots , {y}_{m}\, is\, {\mathbb{G}}_{m}^{k}$$

where i = 1,…,n (number of inputs), j = 1,…,m number of outputs), and k = 1,…, r number of rules). To begin the approach based on Zadeh rules and Mamdani reasoning, we should represent the antecedents of the rules as a fuzzy relation \({\mathbb{A}}^{k}\), using the Cartesian product with Interval type-3 fuzzy sets (IT3 FS), \({\mathbb{F}}_{i}^{k}\), and the implication with the consequent of the j-the output, \({\mathbb{G}}_{j}^{k}\); then, the fuzzy relation of the rule \({\mathbb{R}}_{j}^{k}\) can be expressed as

$${\mathbb{A}}^{k}={\mathbb{F}}_{1}^{k}\times \dots \times {\mathbb{F}}_{n}^{k}$$
(16)
$${\mathbb{R}}_{j}^{k}={\mathbb{A}}^{k}\to {\mathbb{G}}_{j}^{k}$$
(17)

If \({\mathbb{R}}_{j}^{k}\) is described as a membership function of the rules, \({\mu }_{{\mathbb{R}}_{j}^{k}}\left({\varvec{x}},{y}_{j}\right)\), then is expressed as

$${\mu }_{{\mathbb{R}}_{j}^{k}}\left({\varvec{x}},{y}_{j}\right)={\mu }_{{\mathbb{A}}^{k}\to {\mathbb{G}}_{j}^{k}}({\varvec{x}},{y}_{j})$$
(18)

As a consequence, when Mamdani implication is used, \({\mathbb{A}}^{k}\to {\mathbb{G}}_{j}^{k}\), with multiple antecedents \({\mathbb{A}}^{k}\), and consequents \({\mathbb{G}}_{j}^{k}\), these are connected by the meet (\({\sqcap}\)) operator, then

$${\mu }_{{\mathbb{A}}^{k}\to {\mathbb{G}}_{j}^{k}}\left({\varvec{x}},{y}_{j}\right)={\mu }_{{\mathbb{F}}_{1}^{k}\times \dots \times {\mathbb{F}}_{n}^{k}\to {\mathbb{G}}_{j}^{k}}\left({\varvec{x}},{y}_{j}\right)={\mu }_{{\mathbb{F}}_{1}^{k}\times \dots \times {\mathbb{F}}_{n}^{k}}\left({\varvec{x}}\right){\sqcap}{\mu }_{{\mathbb{G}}_{j}^{k}}({y}_{j})$$
$${\mu }_{{\mathbb{A}}^{k}\to {\mathbb{G}}_{j}^{k}}\left({\varvec{x}},{y}_{j}\right)={\mu }_{{\mathbb{F}}_{1}^{k}}\left({x}_{1}\right){\sqcap}\dots {\sqcap}{\mu }_{{\mathbb{F}}_{n}^{k}}\left({x}_{n}\right){\sqcap}{\mu }_{{\mathbb{G}}_{j}^{k}}\left({y}_{j}\right)= \left[{{\sqcap}}_{i=1}^{n} {\mu }_{{\mathbb{F}}_{i}^{k}}\left({x}_{i}\right)\right]{\sqcap}{ \mu }_{{\mathbb{G}}_{j}^{k}}\left({y}_{j}\right)$$

The n-dimensional input is given by the fuzzy relation \({\mathbb{A}}_{{X}^{^{\prime}}}\), with MF expressed as

$${\mathbb{A}}_{{X}^{^{\prime}}}\left({\varvec{x}}\right)={\mu }_{{\mathbb{X}}_{1}}\left({x}_{1}|{x}_{1}^{^{\prime}}\right){\sqcap}\dots {\sqcap}{\mu }_{{\mathbb{X}}_{n}}\left({x}_{n}|{x}_{n}^{^{\prime}}\right)={{\sqcap}}_{i=1}^{n} {\mu }_{{\mathbb{X}}_{i}}\left({x}_{i}|{x}_{i}^{^{\prime}}\right)$$

Each fuzzy relation of \({\mathbb{R}}_{j}^{k}\) determines a fuzzy set of the consequent of the rule \({\mathbb{B}}_{j}^{k}={\mathbb{A}}_{{X}^{^{\prime}}}\circ {\mathbb{R}}_{j}^{k}\) in Y such that

$${\mu }_{{\mathbb{B}}_{j}^{k}}\left({y}_{j}|{{\varvec{x}}}^{^{\prime}}\right)={\mu }_{{\mathbb{A}}_{{X}^{^{\prime}}}\circ {\mathbb{R}}_{Z}^{k}}\left({y}_{j}|{{\varvec{x}}}^{^{\prime}}\right)=\underset{{\varvec{x}}\in {\varvec{X}}}{\underset{\varepsilon}{sup}}\left[{\mathbb{A}}_{{X}^{^{\prime}}}\left({\varvec{x}}\right){\sqcap} {\mu }_{{\mathbb{A}}^{k}\to {\mathbb{G}}_{j}^{k}}({\varvec{x}},{y}_{j})\right], {\varvec{y}}\in {\varvec{Y}}$$
(19)

This equation is an input–output relation between the IT3 FS that activates the inference of one rule and the IT3 FS of the output. The composition (\(\circ \)) is a highly non-linear mapping from the input vector \({{\varvec{x}}}^{^{\prime}}\) to an IT3 FS \({\mu }_{{\mathbb{B}}_{j}^{k}}\left({y}_{j}|{{\varvec{x}}}^{^{\prime}}\right)\) (\({\varvec{y}}\in {\varvec{Y}})\) as output vector. The reasoning is a fuzzy inference mechanism that can be interpreted as a system that maps an IT3 FS into an IT3 FS by using the composition.

The results of the rules are combined by using fuzzy union (as an aggregation operation), in other words, we use the join (\({\sqcup}\)) operator to calculate the aggregation of the values \({\mu }_{{\mathbb{B}}_{j}^{k}}\left({y}_{j}|{{\varvec{x}}}^{^{\prime}}\right)\).

$${\mathbb{B}}_{j}={\mathbb{B}}_{j}^{1}\cup \dots \cup {\mathbb{B}}_{j}^{k}\cup \dots \cup {\mathbb{B}}_{j}^{r}={\bigcup }_{k=1}^{r}{\mathbb{B}}_{j}^{k}$$
$${\mu }_{{\mathbb{B}}_{j}}\left({y}_{j}|{{\varvec{x}}}^{^{\prime}}\right)={\mu }_{{\mathbb{B}}_{j}^{1}}\left({y}_{j}|{{\varvec{x}}}^{^{\prime}}\right){\sqcup}\dots {\sqcup}{\mu }_{{\mathbb{B}}_{j}^{k}}\left({y}_{j}|{{\varvec{x}}}^{^{\prime}}\right){\sqcup}\dots {\sqcup}{\mu }_{{\mathbb{B}}_{j}^{r}}\left({y}_{j}|{{\varvec{x}}}^{^{\prime}}\right)$$
$${\mu }_{{\mathbb{B}}_{j}}\left({y}_{j}|{{\varvec{x}}}^{^{\prime}}\right)={{\sqcup}}_{k=1}^{r} {\mu }_{{\mathbb{B}}_{j}^{k}}\left({y}_{j}|{{\varvec{x}}}^{^{\prime}}\right)$$
$${\mu }_{{\mathbb{B}}_{j}}\left({y}_{j}|{{\varvec{x}}}^{^{\prime}}\right)={{\sqcup}}_{k=1}^{r}\left[{\widetilde{\Phi }}^{k}\left({{\varvec{x}}}^{^{\prime}}\right){\sqcup}{\mu }_{{\mathbb{G}}_{j}^{k}}\left({y}_{j}\right)\right]$$

Finally, the type-reduction is expressed as follows:

$${\widehat{y}}_{j}=typeReduction\left({y}_{j},{\mu }_{{\mathbb{B}}_{j}}\left({y}_{j}|{{\varvec{x}}}^{^{\prime}}\right)\right)$$
(20)

and this provides the final result.

3.4 Time Complexity of Computing an Interval Type-3 Fuzzy System

Type-reduction algorithms for Mamdani T2 FLSs and IT3FLSs, based on the α-planes theory, are very efficient for centroid type-reduction. Assume that the primary variable x is sampled into N points and the secondary variable u(x) into M points. Then, there are MN IT2FSs included in an IT3 FS. For each embedded IT2FS, 2N multiplications are needed, 4(N-1) additions, 2 divisions to calculate the centroid, and 2(N-1) comparisons are needed for the t norm operation. As a consequence, the complexity of the method with exhaustive calculation is approximately O(8MNxN). However, for the proposed strategy (with α planes), we need N samples for x and L samples for an α plane. Then, for each α plane, O(4 × 4NK) calculations are needed, where K (number of iterations to approximate a switch point) usually is less than 10. As a consequence, the proposed strategy requires O(16NKL) calculations to determine the centroid (reduced fuzzy set) of an IT3FLS, which significantly reduces the complexity from exponential to linear. Table 2 shows a comparison of the computational complexity of the fuzzy models.

Table 2 Comparison of Computational Complexity

In summary, the general computational complexity based on the α-planes theory for centroid type-reduction in Mamdani IT3FLSs is approximately of O(NKL).

4 Interval Type-3 Fuzzy-Fractal Approach

In this section, the interval type-3 fuzzy-fractal approach is presented. Let z1, z2, …, zn be any time series. Assuming the time series clustering process provides n clusters C1, C2, …, Cn, then a fuzzy system is expressed as indicated below. The complexity of the clusters can be approximated by their corresponding dimensions, linear is dim1 and non-linear dim2, with values x1, x2, …, xn, and y1, y2,…, yn, respectively. The dimensions provide us with different approximations and we opted to make the forecast with both for improving accuracy. Then, the fuzzy system for forecasting is expressed as follows.

If dim1 is x1 and dim2 is y1 then prediction is C1.

If dim1 is x2 and dim2 is y2 then prediction is C2

$$ \cdots \; \cdots \; \cdots $$
(21)

If dim1 is xn and dim2 is yn then prediction is Cn.

For applying this scheme, the MFs for the fractal dimensions (FDs) should be defined. The fuzzy rules of Eq. (4) are expressed in Mamdani form, and we can use the centroid as defuzzification method. For this reason, we developed a system with an architecture of four inputs and one output. The four linguistic input variables of the fuzzy system are as follows: the linear FD of confirmed (LFDC), non-linear FD of confirmed (NLFDC), linear FD of death (LFDD), and non-linear FD of death (NLFDD) cases, respectively. Low and high are considered for representing the meaning of low and high values of the dimensions. The output linguistic variable is representing the Forecast Increment (ΔP) with three values representing the knowledge that countries have a forecast increment with three levels: High, Medium and Low. The process is summarized in complete form in Fig. 2, where it is observed that two time series are going into the fractal module, which estimates the values of the dimensions. Now the dimensions are the inputs to the prediction model and ΔP is the output, which is calculated with Eq. 20 as the type-reduction of the system output. Finally, ΔP is aggregated to the previous value, which takes place in the Adder Module, to calculate the next predicted value, which is represented as Pn+1. The method shown in Fig. 2 can also be used with type-2 or type-1 fuzzy logic in the same way, just changing the type-3 fuzzy block in this figure for a block with type-2 or type-1. The interval type-3 fuzzy-fractal method is depicted in Fig. 3.

Fig. 2
figure 2

Interval type-3 fuzzy-fractal forecasting method

Fig. 3
figure 3

Architecture of the type-3 fuzzy-fractal model for COVID-19 prediction

We have to say that although the method has been devised and applied for COVID-19 prediction, it could also be applied to the prediction of other complex time series prediction in the following way: if the problem is of multiple time series, then we will need several modules similar to the one represented in Fig. 3 and then calculate increments of P for each time series.

The architecture of the fuzzy system in Fig. 3 could be changed to type-2 or type-1 and the same inputs and output can be used. In addition, the same fuzzy rules can be used, as the knowledge of experts is the same. So, in general, the fuzzy system has the same form, independently of the type of fuzzy logic being used, the difference resides in the complexity of the MFs. Delta P is the output of the fuzzy system, so the calculation of the value is done by performing the fuzzy inference process with the rules based on the input values, and finally, performing type-reduction with Eq. 20. The algorithm of the complete method is presented in Fig. 4.

Fig. 4
figure 4

Algorithm for the proposed method

The rules were constructed with expert knowledge and previous data of the problem. The classification rules are depicted in Fig. 5. The output MFs are shown in Fig. 6, which are triangular and trapezoidal MFs. In Fig. 7, the input MFs are presented. In this part, two Gaussian MFs are utilized for the low and high linguistic terms, respectively.

Fig. 5
figure 5

Fuzzy rules encapsulating the knowledge of forecasting in the interval type-3 fuzzy model

Fig. 6
figure 6

Output MFs of the type-3 fuzzy forecasting

Fig. 7
figure 7

Input MFs for the LFDD input variable

In Table 3, we show the specific parameters of the MFs, which were found by trial and error, and could be optimized with metaheuristics for achieving even better results. Basically, Table 3 shows the centers and standard deviations of the Gaussian MFs.

Table 3 Parameter values for the Gaussian MFs used in the input linguistic values (center and standard deviation)

In Table 4, we show the specific parameters of the output MFs, which were found by trial and error, for the triangular MFs.

Table 4 Parameter values for the triangular MFs used in the output linguistic values

In Fig. 8, we illustrate a 3-D representation of the interval type-3 membership function in which we can clearly distinguish the upper and lower MFs, and also the footprint of uncertainty (FOU).

Fig. 8
figure 8

IT3 FS with IT3MF \(\widetilde{\mu }\left(x,u\right),\) where \(\underset{\_}{\mu }(x,u)\) is the lower membership function (LMF) and \(\overline{\mu }(x,u)\) is the upper membership function (UMF)

In Fig. 9, we show a different illustration of the interval type-3 membership function.

Fig. 9
figure 9

Membership function of the IT3FS illustrating the volume that is formed in space

In Fig. 10, the surface representing the model, showing the relation from the inputs to the output of the model, can be found.

Fig. 10
figure 10

Surface representing the non-linear interval type-3 fuzzy model

5 Simulation Results

The method utilizing the interval type-3 fuzzy-fractal approach was applied to encapsulate the knowledge required for times series forecasting. This was also mixed with the fractal models that estimate the complexity level, in accordance to the COVID-19 cases.

The experiments were performed with a dataset used from the Humanitarian Data Exchange (HDX) [8], which includes COVID-19 data from countries, where cases have occurred from January 22, 2020 to April 15, 2020. The reason for using this time interval is to compare results with previous works using type-1 fuzzy logic [40]. The datasets that were consulted are as follows: time_series_covid19_confirmed_global, time_series_covid19_recovered_global, and time_series_covid19_deaths_global. Selected data consist of COVID-19 confirmed, recovered, and deaths cases, respectively. In Fig. 11, we can find a plot for Belgium, illustrating the cases for the 22-01-2020 to 15-04-2020 period. In Fig. 12, an analogous plot for Italy is presented.

Fig. 11
figure 11

Graph of confirmed cases for Belgium

Fig. 12
figure 12

Graph of Italy confirmed cases

In Fig. 13, we can find a plot of Belgium COVID-19 deaths, illustrating the data for 22-01-2020 to 15-04-2020 period. In Fig. 14, we illustrate in an analogous way the trend for Italy.

Fig. 13
figure 13

Graph of death cases for Belgium

Fig. 14
figure 14

Graph of Italy death cases

Based on the series, we can estimate the fractal values and these are reported in a systematic fashion in Table 5. The increments (ΔP) produced by the fuzzy system are highlighted in bold in the table.

Table 5 Fractal dimensions and increments provided by the interval type-3 fuzzy system

In the next Figures, we illustrate forecasts with the interval type-3 fuzzy-fractal approach for some countries in the study. The forecasts are made for 10 days ahead based on the data utilized for building the model. Figure 15 shows the prediction for Belgium, where it is noted that predicted values are quite close to the real ones. Figure 16 reports in an analogous fashion the prediction of Germany confirmed cases. Figure 17 reports the confirmed cases prediction for the USA. Finally, in Figs. 18 and 19, we show the prediction for Spain and Italy, respectively. In almost all cases, the forecasts are near to real values and this validates that the interval type-3 fuzzy-fractal method performs satisfactorily in forecasting.

Fig. 15
figure 15

Prediction of Belgium COVID-19 confirmed cases

Fig. 16
figure 16

Prediction of COVID-19 for Germany

Fig. 17
figure 17

Prediction of United States COVID-19 confirmed cases

Fig. 18
figure 18

Prediction of COVID-19 for Spain

Fig. 19
figure 19

Forecast of Italy COVID-19 cases

In Table 6, we report the forecasts for the 9 countries utilizing the interval type-3 fuzzy-fractal model and are illustrated in Fig. 19. The data utilized to build the model are the COVID-19 cases from January 22 to April 15 of 2020. The forecasted values utilizing the method are for 10 days from April 16 to 25 of 2020.

Table 6 Prediction of confirmed cases for 10 days utilizing the interval type-3 proposed approach (April 16 to 25 of 2020)

In Table 7, a comparison of prediction errors for the 9 countries is presented, where it can be noticed that the errors are low and average accuracy is of 99%, as almost all errors are lower than 1% (with relative errors). Analyzing the table, it can be highlighted that type-3 fuzzy achieves better errors in 5 countries (Belgium, Germany, Iran, Spain, and UK), however has type-1 fuzzy logic is better in 3 countries (France, Italy, and Turkey). For the case of USA, the forecasting errors are practically the same. We have to say that these results were obtained with a manual design of the FOU, which means that by trial and error, the λ and ℓ parameter values of the type-3 MFs were obtained (shown in Tables 3 and 4). For this reason, there is not a favorable result for the type-3 approach in all the countries.

Table 7 Summary of the comparison of forecasting errors for the 9 countries between the proposed approach with interval type-3 fuzzy logic and type-1 fuzzy of previous work [40]

We decided to optimize the λ and ℓ parameters of the type-3 MFs to verify if better results could be obtained. If the λ and ℓ parameters are changed, then we can find the optimal FOU for the uncertainty in a particular problem. As an initial test, we decided to use the Firefly Algorithm, as in [41], because it is relatively easy to use.

We have made a comparison with the prediction of type-3 with respect to type-2 fuzzy logic, using the same fuzzy rules, to show the advantage of the proposal. Now we considered in this experiment 12 countries to be able to compare with the work in [41]. In Table 8, we summarize a comparison for the prediction errors of COVID-19 for the same mentioned period of time for 12 countries in which type-3 is better than type-2 in 11 of the 12 countries, which shows that optimization helped to improve the results.

Table 8 Comparison of predictions for type-3 versus type-2 in 12 countries based on Absolute Errors

We have also previously compared the same approach using type-2 with respect to type-1 fuzzy logic in a previous paper, showing that type-2 was better [41], so in this way, we can conclude that type-3 fuzzy outperforms both type-2 and type-1 in COVID-19 prediction.

Based on these results, we can say that the interval type-3 fuzzy-fractal approach has potential in producing better forecasts in complex time series prediction.

6 Conclusions

In this article, an interval type-3 fuzzy-fractal forecasting approach based on measuring the complexity level of time series was outlined. The approach amalgamates the strong points of fractal theory and interval type-3 fuzzy logic. The fractal dimension is utilized to estimate the complexity level in the existing data. Interval type-3 MFs were utilized to model the levels of uncertainty existing in forecasting, which can be considered as a decision-making process under uncertainty. The hybrid approach consists of an interval type-3 model, that utilizes as inputs the dimensions and the output is the COVID-19 forecast. The most relevant contribution is the approach consisting of an appropriate combination of the dimension and interval type-3 fuzzy to enable a good prediction of COVID-19 cases. Publicly available data sets of 9 countries were utilized to construct the interval type-3 fuzzy model with time series data. The interval type-3 fuzzy-fractal model was validated by predicting the data in 10-day window. In addition, the approach was also compared with the previous work [40] for the same period of time showing that forecasting errors are lower with the utilization of interval type-3 fuzzy logic. Future work may consist on applying the proposed approach on similar problems [42,43,44], as well as generalizing the use of fuzzy logic to general type-3 and consider granularity concepts [45,46,47,48,49], which we envision will enable a better representation of the uncertainty in the prediction process.