## 1 Introduction  
Time series forecasting is a field of interest in many research and society fields such as energy [1; 2; 3], economics [4; 5], health [6; 7], agriculture [8; 9], education [10; 11], infrastructure [12; 13], defense [14], technology [15], hydrology [16; 17], and many others. Time series are generally addressed in terms of stochastic processes in which values are placed at consecutive points in time [18]. Time series forecasting is the process of predicting values of a historical data sequence [19]. In the digitized development, with the increase in extensive historical data, more powerful and cross-platform-compatible forecasting methods are highly desirable [20; 21]. Pattern-sequence-based forecasting (PSF) is a univariate time series forecasting method which was proposed in 2011 [22]. It was developed to predict a discrete time series and proposed to use clustering methods to transform a time series into a sequence of labels. To date, several researchers have proposed modifications for its improvement [23; 24; 25; 26] and recently, its implementation in the form of an R package was also proposed [27; 28]. PSF has been successfully used in various domains including wind speed [29], solar power [26], water demand [13], electricity prices [30], CO\({}_{2}\) emissions [31], and cognitive radio [32]. The PSF algorithm consists of various processes. These processes are broadly categorized into two steps, clustering of data and, based on this clustered data, performing forecasting. The predicted values are appended at the end of the original data and these new data are used to forecast future values. This makes PSF a closed-loop algorithm, which allows PSF to predict values for a longer duration. PSF has the ability to forecast more than one values at the same time, i.e., it deals with arbitrary lengths for the prediction horizon. It must be noted that this algorithm was particularly developed to forecast data which contain some patterns. Figure 1 shows the steps involved in the PSF method. The goal of the clustering step is to discover clusters and label them accordingly in the data. It consists of the normalization of the data, the selection of the optimal number of clusters, and applying k-means clustering using the optimum number of clusters. Normalization is an important part of any data processing technique. The formula used to normalize the data is:  
\[X_{j}^{\prime}=\frac{X_{j}}{\frac{1}{N}\sum_{i=1}^{N}X_{i}} \tag{1}\]  
where \(X_{j}\) is an input time series and \(X_{j}^{\prime}\) denotes the normalized value for \(X_{j}\) and \(i=1,\ldots,N\). The k-means clustering technique is used to cluster and label the data. However, k-means requires the number of clusters (\(k\)) to be provided as an input. To calculate the optimum value of \(k\), the silhouette index was used. The clustering step outputs the time series as a series of labels which are used for forecasting. Then, the last \"\(w\)\" labels are selected from the series of labels outputted by the clustering step. This sequence of \(w\) labels is searched for in the series of labels. If the sequence is not found, then the search is repeated with the last (\(w-1\)) labels. The selection of the optimum value of \(w\) is crucial in order to get accurate prediction results. Formally, the size of the window for which the error in forecasting is minimum during the training process is called the optimum window size. The error function used is shown in (2). Figure 1: Block diagram of the PSF method (Source: [33]). \[\sum_{t\in TS}\left\|\hat{X}(t)-X(t)\right\| \tag{2}\]  
where \(\hat{X}(t)\) is a predicted value at time \(t\), \(X(t)\) is the measured data at same time instance, and \(TS\) represents the time series under study. After the selection of the optimum window size (\(w\)), the last \(w\) values are searched for in a series of labels and labels next to the discovered sequence are stored in a new vector called \(ES\). The data corresponding to these labels from the original time series are retrieved.