Next Article in Journal
Characterizing User Archetypes and Discussions on Social Hypernetworks
Previous Article in Journal
Hierarchical Discourse-Semantic Modeling for Zero Pronoun Resolution in Chinese
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Application of Inverse Optimization Algorithms in Neural Network Models for Short-Term Stock Price Forecasting

Image Processing and Artificial Intelligence Laboratory, Tomsk State University of Control Systems and Radioelectronics, Lenina Str., Tomsk 634050, Russia
*
Author to whom correspondence should be addressed.
Big Data Cogn. Comput. 2025, 9(9), 235; https://doi.org/10.3390/bdcc9090235
Submission received: 7 August 2025 / Revised: 1 September 2025 / Accepted: 5 September 2025 / Published: 9 September 2025

Abstract

This paper introduces novel inverse optimization algorithms (RC and DC) for neural network training in stock price forecasting in an attempt to overcome the traditional gradient descent limitation of local minima convergence. The key novelty is a stochastic algorithm for inverse problems adapted to neural network training, where target function values decrease iteratively through selective weight modification. Experimental analysis used closing price data from 40 Russian companies, comparing traditional activation functions (linear, sigmoid, tanh) with specialized functions (sincos, cloglogm, mish) across perceptrons and single-hidden-layer networks. Key findings show the superiority of the DC method for single-layer networks, while RC proves most effective for hidden-layer networks. The linear activation function with the RC algorithm delivered optimal results in most experiments, challenging conventional nonlinear activation preferences. The optimal architecture, namely, a single hidden layer with two neurons, achieved the best prediction accuracy in 70% of cases. The research confirms that inverse optimization algorithms can provide higher training efficiency than classical gradient methods, offering practical improvements for financial forecasting.

1. Introduction

The stock market serves as an indicator of a country’s economic health and plays a crucial role in attracting and redistributing capital through the issuance of securities. In addition, it is one of the primary instruments for investment and preservation of public savings [1]. In this context, analyzing the dynamics of securities, particularly stocks, is of interest to many market participants and enables more effective managerial and investment decision making. One of the main analytical tools is technical analysis, which, unlike fundamental analysis, assumes that all relevant factors are already incorporated into historical prices. Consequently, only past data need to be analyzed [2].
The task of forecasting prices for financial instruments, as a specific case of time series analysis, is one of the key challenges in the field of analytics and applied machine learning, as it involves the study of complex dynamic systems. The data used to describe the behavior of such systems are characterized by nonlinearity, a stochastic nature, and high levels of noise. The analysis of these data must rely on identifying hidden patterns under conditions of volatility. Statistical methods, such as Autoregressive Integrated Moving Average or Generalized Autoregressive Conditional Heteroskedasticity (GARCH), demonstrate insufficient effectiveness under these conditions, especially for short-term forecasting.
Neural networks demonstrate the ability to identify nonlinear dependencies and hidden relationships. Activation functions and learning algorithms are key components of neural networks that determine training efficiency and, consequently, the accuracy of predictive values. Currently, classical learning algorithms based on gradient descent are predominantly used. However, these methods suffer from several critical weaknesses. Specifically, they tend to become trapped in local minima [3], exhibit sensitivity to initial parameter values, and show poor convergence performance when dealing with data containing periodic components—a characteristic feature of financial time series. These fundamental limitations of existing approaches motivated us to develop and investigate novel approaches to neural network training.
The aim of this research is to develop inverse optimization algorithms for neural network training and to conduct a comparative analysis of traditional and inverse training methods regarding their impact on prediction accuracy. The study addresses the efficiency of neural network models using various activation functions and training algorithms based on Russian stock market data. The research will test the following primary hypothesis: inverse optimization algorithms can provide higher neural network training efficiency compared with classical gradient-based approaches.
The significance of this research is driven by two key factors. First, there is a pressing need to develop neural network training methods that enhance forecasting accuracy in the investment domain, thereby improving the reliability of investment decision making processes. Second, inverse optimization algorithms remain insufficiently explored in the context of time series prediction tasks, creating a notable research gap. The scientific novelty of this work lies in the development of neural network training algorithms founded on an inverse approach.
This study comprises the following sections: a literature review, a description of the developed algorithm, experimental design and results analysis, and conclusions and implications.

2. Materials and Methods

2.1. Literature Review

Time series analysis occupies a prominent position among methods for forecasting financial asset dynamics. Statistical models have long served as the primary tools employed for this purpose. Among various statistical approaches, linear and nonlinear regression models, autoregressive models, and moving average models are particularly noteworthy [4]. Econometric approaches, such as the Autoregressive Conditional Heteroskedasticity (ARCH) model proposed in [5], along with its modification—the GARCH model introduced in [6]—have become fundamental frameworks for modeling temporal variability and volatility clustering in financial asset returns. Subsequently, several GARCH modifications were developed to better adapt to stock market volatility, including Integrated GARCH [7], Exponential GARCH [8], Threshold GARCH [9], and Glosten–Jagannathan–Runkle GARCH [10].
Despite the success of traditional econometric models, they face a number of challenges, including limited flexibility in modeling complex nonlinear processes and insufficient accuracy under certain market conditions. Their parametric nature and fixed functional form restrict their ability to adapt to the complex nonlinear dependencies observed in modern stock markets, particularly when dealing with high-frequency and large-scale data.
This is precisely why more advanced machine learning methods are employed for such tasks, among which neural network models are among the most popular [11,12]. In particular, deep learning models have been successfully applied to forecasting stock quotes and share prices based on fundamental and technical analysis [13,14,15].
However, improving the efficiency of neural network models remains a relevant challenge. To address this, researchers are developing new types of networks (recurrent, transformers, hybrid), optimizing network architecture (number and configuration of layers, neuron count), and designing innovative training algorithms and activation functions.
The type of activation function affects gradient stability, training efficiency, and the accuracy of output values. Traditional activation functions (linear, sigmoid, tanh) are characterized by implementation simplicity; however, they have significant limitations, including the vanishing gradient problem and insufficient effectiveness in modeling temporal dependencies [3,16,17]. Modern specialized activation functions (such as mish) have demonstrated high efficiency in specific applications across multiple studies [18,19,20] and have sparked interest among researchers and practitioners regarding their potential for advancing deep learning methodologies [21,22], including practical applications in stock market dynamics prediction [15].
One of the challenges researchers face when training neural networks is optimizing the loss function, considering its nonlinear, multi-extremal nature and the large number of parameters to be optimized [23,24,25]. Gradient descent with gradients calculated using the backpropagation algorithm is typically employed for this purpose [26]. Because standard gradient descent does not always ensure good convergence, researchers have developed and implemented adaptive optimization methods, including Adaptive Gradient Algorithm [26], Adaptive Delta [27], Root Mean Square Propagation [28], Adaptive Moment Estimation (Adam) [29], Adam with Maximum Norm [30], Nesterov-accelerated Adaptive Moment Estimation [31], and their modifications. Despite the popularity of these methods, researchers have noted several limitations: sensitivity to initial values and tendency to converge to local minima [32]. In some cases, the use of gradient methods may not lead to improvements in error function values, resulting in optimization failure. Particularly, optimization difficulties are observed when data contain periodic components [33], which may characterize processes involving various types of fluctuations in the stock market. These fundamental weaknesses of existing approaches represent barriers to achieving reliable financial forecasting accuracy and highlight the need for alternative optimization strategies that can overcome these inherent limitations.
To address the aforementioned limitations, researchers have been investigating various metaheuristic algorithms, which are classified according to the nature of the processes they simulate. The classification includes evolutionary methods [34]; swarm-based algorithms [35]; approaches derived from mathematics, chemistry, and physics [36]; as well as techniques inspired by human behavior [37]. The primary advantage of metaheuristic algorithms for neural network optimization is that the objective function does not necessarily need to be differentiable or continuous, and their gradient-free search process can effectively bypass local minima. However, the disadvantages of such methods include high computational resource requirements, time complexity, and the need to configure numerous parameters. As the number of optimized parameters in a neural network increases, the required resources, such as memory and processing time, grow significantly, potentially preventing the achievement of an acceptable accuracy level within a reasonable timeframe. One proposed solution to this problem involves training only a single layer—typically the first or last—but this approach reduces the number of adjustable parameters and does not guarantee finding the global minimum. This underscores the relevance of researching new approaches to neural network training.
The identified limitations of traditional gradient-based methods create gaps in the current state of research. Specifically, existing neural network training approaches lack robust mechanisms for avoiding local minima convergence, particularly when processing financial data with inherent periodicity and high volatility. Furthermore, current optimization methods demonstrate insufficient adaptability to the nonlinear, multi-extremal nature of financial time series, limiting their practical applicability in investment decision making contexts. These weaknesses in the existing body of research directly motivated the development of inverse optimization algorithms presented in this study.

2.2. Inverse Optimization Algorithms for Neural Network Training

2.2.1. Neural Network Model

In this paper, we examine a deep neural network model (Figure 1) capable of reproducing nonlinear dependencies and revealing hidden patterns. This model has gained widespread application in stock market dynamics modeling [38,39,40,41]. The selection of neural network structure and parameters, including activation functions f, training hyperparameters, and the training algorithm, significantly determines the effectiveness of this analytical tool [42].
The neural network structure is determined by the number of hidden layers and the number of neurons in each layer. This study examines both perceptron models (without hidden layers) and neural networks with a single hidden layer, with the latter being the most prevalent approach in prediction tasks [43,44,45]. Specifically, after analyzing 177 scientific publications, Xu et al. [43] established that over 60% of research studies employ neural networks with a single hidden layer. This architecture represents an optimal compromise between computational efficiency and predictive power, enabling the approximation of nonlinear dependencies in time series without significantly increasing computational costs, thus ensuring high prediction accuracy while maintaining reasonable implementation complexity. When determining the number of neurons in the hidden layer, researchers distinguish between small dimensionality (1–10 neurons) and large dimensionality (11–20 neurons) [16]. This investigation examines configurations with 2, 8, and 16 neurons in the hidden layer.
The number of hidden layers and neurons determines the total number of adjustable weight coefficients w (total_weights), which can be calculated based on the number of neurons in the input layer (input_neurons) and hidden layer (hidden_neurons):
total_weights = (input_neurons + 1) × hidden_neurons + hidden_neurons + 1
The training algorithm adjusts the values of the neural network’s weight coefficients w to improve its predictive performance. The objective of this algorithm is to ensure maximum correspondence between the neural network output and actual values. This is achieved by minimizing the error function, which represents the sum of squared differences between the actual price values and the model’s predicted values z.

2.2.2. Algorithm for Neural Network Training Using the Inverse Optimization Approach

Most optimization methods employ an iterative process in which the value of the objective function f(x) at the current point is calculated at each step, and the search direction for the next point is determined (Figure 2). An alternative approach involves formulating an inverse problem, where the arguments x that provide a specified function value are sought (Figure 2) [46,47]. In this study, a stochastic algorithm for solving the inverse problem [48] was used to implement the inverse approach, which was modified for neural network training. Thus, the resulting algorithm is metaheuristic, where the search for the optimum is guided by the following rules:
  • At each iteration, the target function value decreases with a certain step, ensuring minimization of the error function.
  • At each iteration, only one weight coefficient is selected for modification with a specified probability. Then, its new value is determined to achieve the target function value by solving an equation. If the selected weight coefficient cannot achieve the target function value (no solution to the equation exists), another weight coefficient is chosen until all arguments have been considered. For illustration, Figure 3 shows a scenario where it is impossible to reach the target value y2 from point A by changing x1. Consequently, this argument is excluded from calculations, and the solution is found by modifying argument x2. Thus, each weight coefficient has two characteristics, namely, a selection probability and a usability indicator u, which takes the value 1 if the argument can be selected for solving the problem and 0 otherwise.
  • If no weight coefficient allows the target function value to be reached, the step size for changing the target function value is reduced.
When establishing the probability β for argument selection, the following approaches were considered:
  • All probabilities are equal (random choice (RC)), and the weight coefficient is selected randomly at each iteration.
  • Probabilities are calculated based on the gradient: the higher the absolute gradient value for a specific weight coefficient is, the higher the probability that this coefficient will be selected for modification (derivative choice (DC)).
Figure 2. Classical and inverse optimization scheme. The orange color represents the variable quantities that are adjusted to find a solution, while the blue color indicates the factors or elements that drive these changes.
Figure 2. Classical and inverse optimization scheme. The orange color represents the variable quantities that are adjusted to find a solution, while the blue color indicates the factors or elements that drive these changes.
Bdcc 09 00235 g002
Figure 3. Modification of the argument to achieve a new target function value y2: absence of solution (left); solution found (right). The dashed line shows a possible search direction when changing one argument. Colors represent the function levels of f(x).
Figure 3. Modification of the argument to achieve a new target function value y2: absence of solution (left); solution found (right). The dashed line shows a possible search direction when changing one argument. Colors represent the function levels of f(x).
Bdcc 09 00235 g003
Thus, the developed RC algorithm comprises the following steps.
Step 1. Initialization:
The weights w are randomly initialized, and the error function is computed along with its minimization step:
h = f 1 P r i c e _ p r e v × w 0
z = f 2 h b i a s × w 1
J w = i = 1 n z i P r i c e i 2
J p r e v = J ( w )
Δ J = J ( w ) d
where Price_prev is the matrix of input price values (Pricet−1, Pricet−2...), including the bias; Price represents the vector of actual output values, z denotes the vector of predicted values, n is the number of observations, f1 is the activation function of the hidden layer, f2 is the activation function of the output layer, h b i a s is the output of hidden layer with the bias, and d is the divisor determining the step size Δ J .
Step 2. Reduction in the error function by a specified step size:
Apply stepwise reduction to the cost function utilizing a defined step size:
J t a r g e t = J p r e v Δ J r
Step 3. Selection of argument for modification:
For each weight with u = 1, calculate the selection probability β ( m = 1 , t o t a l _ w e i g h t s ):
l = j = 1 t o t a l _ w e i g h t s u j
β m = 1 l   i f   u m = 1 0   o t h e r w i s e
Choose the weight coefficient with index p based on the probability β. In the absence of coefficient selection, increase the step reduction factor according to r = rq (q is the step reduction coefficient). Should r exceed the maximum threshold rmax, the algorithm terminates. Otherwise, initialize the usage indicator u to unity for all weights w, recalculate the probability β, and perform random selection of the weight coefficient based on the updated selection probabilities β.
Step 4. If the selected weight coefficient pertains to the second level (p ≥ ((input_neurons + 1) hidden_neurons)) proceed to Step 5; otherwise, proceed to Step 6.
Step 5. Modification of the weight coefficient belonging to the second layer:
Compute the coefficient index v within the level as follows:
Compute the coefficient index v within the level:
v = p − (input_neurons + 1) hidden_neurons.
Update the selected weight w1v by solving the following equation:
J ( w 1 v ) = J t a r g e t
The application of Newton’s method in this process requires computing the gradient g1 as follows:
z e r r o r = z P r i c e
z d e l t a = z e r r o r f 2 z
g 1 = h b i a s T z d e l t a
where f 2 z is the derivative of the activation function, and denotes element-wise multiplication.
Formulate a new weight coefficient array to enable subsequent modification of the selected element and error function evaluation:
w 1 = w 1
The Newton-based iterative updates are implemented according to the following formula:
w 1 v = w 1 v J ( w ) J t a r g e t 2 g 1 v
The values for J(w*) and g 1 v are recalculated after each iteration using Equations (1) and (2).
Subsequently, the new value of the error function is calculated using the obtained weighting coefficient:
J n e w = J ( w )
If new < Jprev, then w1 = w1*, u = 1 for all weights, and Jprev = Jnew. Proceed to Step 2.
Otherwise, set up = 0. Proceed to Step 2.
Step 6. Modification of the weight coefficient belonging to the first layer:
Determine the row and column indices v and b for the first-layer coefficient matrix by decomposing the linear index p:
v = p mod hidden_neurons
b = ⌊p/hidden_neurons⌋
The hidden layer error and gradient are computed as follows:
h e r r o r = z d e l t a × w 1 [ : 1 ] T
h d e l t a = h e r r o r f 1 h
g 0 = w 0 T h d e l t a
where w 1 [ : 1 ] is the array of weight coefficients w1 excluding the element associated with the bias term.
The selected weight w0b,ᵥ is updated by solving the following equation:
J w 0 b , v = J t a r g e t
To solve the equation using Newton’s method, the iterative formula is employed as follows (preliminarily, array w is copied to array w*: w 0 = w 0 ):
w 0 b , v = w 0 b , v J ( w ) J t a r g e t 4 g 0 b , v
Here, J(w*) and g 0 b , v are recalculated after each iteration using Formulas (1) and (3).
Compute the new value of the error function with the updated weight coefficient:
J n e w = J ( w )
If Jnew < Jprev, then w0 = w0*, u = 1 for all weights, and Jprev = Jnew. Proceed to Step 2.
Otherwise, set up = 0. Proceed to Step 2.
The pseudocode of the RC is presented in Appendix A. Figure 4 shows the main blocks of the algorithm, including the error function minimization, weight coefficient selection, and equation solving. The absence of active (u = 1) weights leads to a reduction in the search step until the step becomes sufficiently small. For a single-layer network (perceptron), hidden_neurons is set to zero. After step 3, the algorithm proceeds directly to Step 5, where w1 denotes the weights connecting the input neurons to the output neuron.
When using the DC algorithm, probabilities β are proportional to the absolute values of the partial derivatives. To determine these probabilities, arrays c0 and c1 are initially formed from vector u, corresponding to arrays w0 and w1 and containing usage eligibility indicators for each element in calculations. Next, the absolute values of gradients are determined, taking into account the usage indicators:
c w 0 = g 0 c 0
c w 1 = g 1 c 1
Finally, the probabilities of selecting a weight coefficient are determined using the following formula:
β 0 = c w 0 c w 0 + c w 1
β 1 = c w 1 c w 0 + c w 1
where β0 is a matrix containing the probabilities of selecting first-layer weight coefficients, and β1 is a vector containing the probabilities of selecting second-layer weight coefficients. For a single-layer network, only the β0 matrix is calculated.

3. Experimental Results and Discussion

For the experiments, daily closing price data of stocks from the Russian stock market were used. This choice is determined by the characteristics of the Russian stock market, including high volatility, whereas the concentration of trading activity in the commodity sector forms specific cross-sectoral correlation patterns. This determines the significance of technical analysis for stock analysis. The dataset was constructed using a time window concept. Specifically, a fixed set of consecutive historical stock price values was used as features for predicting the next value in the time series. Based on the research [16], the time window size was set to 30. Data preprocessing included normalization of the original values using Min–Max transformation, which improved the speed and accuracy of neural network training. Additionally, the original dataset was divided into training and test sets according to the chronological separation principle, ensuring the model’s effectiveness was verified on new data.
To compare the performance of algorithms, widely used neural network training methods, including Adam and Stochastic Gradient Descent (SGD), implemented in Python 3, were utilized. Standard metrics were employed for algorithm evaluation: mean squared error (MSE) and mean absolute error (MAE). The learning hyperparameter in Adam and SGD algorithms varied from 0.1 to 0.00001 to determine the optimal configuration, with the number of epochs set to 100. For the inverse algorithms RC and DC, the number of Newton method iterations was set to 50, with an accuracy of 0.001. The following hyperparameter values were established for the inverse algorithms. These included r = 1, q = 2, rmax = 100,000, and d = 10 for the perceptron. In addition, for the neural network with one hidden layer, two hyperparameters were changed: rmax = 1,000,000 and d = 5. A linear activation function was used for the output layer. However, for the hidden layer, a set of functions was considered, including both classical activation functions and those specifically designed for time series modeling. In particular, descriptions of the sincos, cloglogm, cloglog, logsigm, rootsig, sinc, and wave functions are provided in source [16]. In addition, the mish function is described in work [19], and the snake function is presented in study [33]. In the study, “tang” denotes the tangent activation function, whereas “arctg” refers to the arctangent function. Additionally, time constraints were imposed on the problem-solving process with inverse algorithms. A maximum of 5 min was allocated for the single-layer network, and 2 min was allocated for the neural network with one hidden layer.

3.1. Forecasting the Closing Price of Gazprom PJSC Shares

In the first part of our computational experiments, we addressed the task of forecasting the closing price of Gazprom PJSC shares. Gazprom shares were selected for analysis because they possess high liquidity. As some of the most actively traded stocks on the Moscow Exchange, they have significant market capitalization and are included in the main Moscow Exchange and Russian Trading System indices with high weighting, which makes them representative for studying the Russian stock market. For this purpose, we compiled a time series dataset of daily closing prices from trading sessions covering the period from 4 January 2023 to 15 March 2025. This interval, encompassing 562 trading days, enables the investigation into the dynamics of the company’s shares across various phases of the market cycle, ensuring a balance between data relevancy and sufficiency.
Table 1 presents the MAE and MSE values obtained on the test set using a single-layer neural network. Table 2 shows a fragment of the simulation results for the linear model. According to the obtained results, the best MSE and MAE values were achieved with the cloglog activation function and the DC learning algorithm.
Table 3, Table 4 and Table 5 present the simulation results for a neural network with one hidden layer containing 2, 8, and 16 neurons, respectively. The optimal solution was obtained using a neural network with one hidden layer containing two neurons, employing a linear activation function and the RC learning algorithm. It is worth noting that for the single-layer neural network, the DC algorithm proved to be the most effective learning algorithm for most activation functions. In contrast, for the neural network with one hidden layer, it demonstrated the poorest performance. For neural networks with one hidden layer containing two and eight neurons, the best MAE and MSE values for most activation functions were achieved using the RC algorithm. However, with 16 neurons, the Adam algorithm yielded the best MSE and MAE values for the majority of activation functions.
Figure 5 presents a box plot diagram of absolute deviations between predicted and actual values (a) and the predicted values (b) on the test set using a neural network with one hidden layer containing two neurons and a linear activation function. Analysis of the results demonstrates that the RC algorithm exhibits the smallest dispersion of absolute errors, as well as the lowest values for their mean (indicated by “+”) and median (indicated by a horizontal line within the box). These results indicate that the RC algorithm’s predicted values on the test set most accurately correspond to the actual data. DC exhibits the highest median with considerable variability. The time series visualization demonstrates that RC (violet dashed line) achieves superior tracking accuracy during volatile market periods (observations 130–140), whereas traditional methods (SGD and Adam) and DC exhibit notable lag during rapid market transitions. The convergence behavior around observation 130 highlights the adaptive capacity of the proposed approach to recalibrate following market corrections, whereas conventional optimizers struggle to recover tracking accuracy. For model comparison and to determine the significance of absolute error differences between them, we also applied statistical analysis, specifically the Wilcoxon test to perform pairwise comparisons of the models. This test revealed highly significant (p-value < 0.0001) differences between all models except for SGD and DC (p-value = 0.009).
Figure 6 illustrates the results for the mish activation function, which shows that classical training algorithms and DC failed to adjust weights properly for adequate prediction of the modeled time series values. The Wilcoxon test revealed highly significant differences between all models (p-value < 0.0001).
Figure 7 presents a heatmap summarizing the data from Table 1, Table 3, Table 4 and Table 5. It can be observed that the single-layer network exhibits the most MSE values below 0.01; however, the minimum values were obtained using a neural network with a hidden layer.
The current stage in the evolution of artificial intelligence is marked by significant progress in the field of large language models (LLMs), such as ChatGPT, Gemini, and Claude, which opens new perspectives for their application in financial forecasting and analytics. In recent years, the international literature has witnessed numerous studies demonstrating the effectiveness of LLMs in predicting market indicators [49,50]. In this paper, we examined the forecasting of Gazprom’s stock closing price using the Claude 4 Sonnet Thinking model. The choice of this model is justified by its ability not only to generate coherent text but also to consistently articulate its reasoning logic, which enhances the transparency of the methodology and increases confidence in the obtained results.
The following prompt was used to obtain forecast values: “The table in the file contains stock closing price values: price t−1 is the closing price value at time (day) t−1, price t−2 is the closing price value at time t−2. For each row, provide a forecast of the stock price for time t using your intuition.” Table 6 presents a fragment of the Excel file that was uploaded for analysis by the language model.
  • Row 2: Forecast 157.80—observing a downward trend from 158.68 to 158.01, expecting the decline to continue
  • Row 3: Forecast 155.90—significant drop from 158.01 to 156.52, downward trend is accelerating
  • Row 4: Forecast 151.50—sharp decline from 156.52 to 153.09, downward momentum persists
  • Row 5: Forecast 154.20—slight upward correction from 153.09 to 153.56, potential rebound possible
Figure 8 presents the actual and predicted stock prices obtained using the language model. The minimal divergence between predicted and actual values during periods of high volatility indicates stable performance under changing market conditions, with the model successfully adapting to both correction phases (95–100) and periods of rapid price appreciation (130–140). The MSE value for the test sample was 0.0027, whereas the MAE was 0.0389. Thus, it should be noted that the obtained results surpass those achieved using a single-layer neural network. Furthermore, for the network with one hidden layer, the MSE and MAE metrics were lower than those obtained when using Adam, SGD, and DC optimizers.

3.2. Experiments Using Data from 40 Russian Companies

In the second part of the experimental study, 40 stocks of Russian companies were selected for analysis. The input data consisted of the 1000 most recent closing price values (with the last value dated 1 July 2025). Figure 9 illustrates the dynamics of the normalized stock closing prices.
Table 7 presents the results of a comparative analysis of single-layer neural network training methods across various activation functions using two time windows (5 and 30 periods). Each value indicates the number of stocks for which the corresponding training method demonstrated the best mean squared error performance on the test dataset when using a specific activation function.
For the five-period time window, the following most effective combinations were identified: Adam optimizer with arctg function (18 cases), cloglogm (19 cases), invers (21 cases), mish (21 cases), and snake (21 cases); SGD with softplus (21 cases) and softs functions (18 cases); DC method with sincos function (25 cases); and RC method with logsig function (15 cases).
For the 30-period time window, there was a shift in method effectiveness: the DC method demonstrated superiority with arctg function (19 cases), cloglogm (21 cases), invers (20 cases), linear (33 cases), mish (21 cases), and snake (25 cases); the RC method showed the best results with cloglogm (17 cases), logsig (16 cases), mish (12 cases), and sincos functions (17 cases); and the Adam optimizer maintained effectiveness with the softs function (26 cases).
Analysis of the aggregate indicators revealed a significant influence of the time window size on the effectiveness of the investigated methods: the Adam algorithm achieved minimum MSE values in 185 cases with a 5-period window, whereas the DC algorithm demonstrated superior accuracy in 222 cases with a 30-period window.
Figure 10 presents the results of a comparative analysis of activation functions and training methods for time series forecasting with window sizes of 5 and 30 periods. Performance evaluation was conducted using the MSE criterion on the test dataset. Specifically, the comparative analysis results show the distribution of activation functions by frequency of achieving minimum MSE values across the studied stocks (left) and the distribution of training algorithms by frequency of achieving minimum MSE values across the studied stocks (right).
The results demonstrate a consistent advantage of the linear activation function regardless of the time window size, with the most pronounced effect observed with the 30-period window. The DC optimization algorithm exhibits minimum MSE values in the maximum number of cases under investigation, with its proportion of superior performance being substantially higher for the 30-period time window compared with the 5-period window.
Table 8 presents the modeling results for a neural network with one hidden layer. The table indicates the number of stocks for which each investigated training method with the corresponding activation function demonstrated the minimum MSE value on the test dataset. The RC algorithm with 50 and 80 Newton method iterations was used as the inverse training method. The research results show that for the neural network architecture with two neurons in the hidden layer, the RC method demonstrates superior performance for most activation functions. As the number of neurons in the hidden layer increases, the advantage shifts to classical training methods. Furthermore, increasing the number of Newton method iterations from 50 to 80 led to higher computational costs. This prevented algorithm convergence within the limited time interval, consequently resulting in higher MSE values in some cases.
Figure 11 illustrates a histogram showing the distribution of activation functions based on the number of stocks for which each function provided the lowest MSE value on the test dataset. The analysis demonstrates that when varying the number of neurons in the hidden layers of the network, minimum error values were predominantly achieved using the linear activation function. Regardless of the neural network architecture, the RC method with 50 iterations of the Newton algorithm consistently produced solutions with the lowest MSE values.
Figure 12 illustrates the minimum MSE values obtained on the test dataset for various stocks and neural network architectures. Research findings indicate that a neural network architecture with a single hidden layer containing two neurons provides optimal prediction accuracy in 70% of the examined cases. The empirical analysis of neural network architectures revealed that a single-layer configuration fails to adequately approximate complex nonlinear relationships in the data, whereas increasing the number of hidden neurons to sixteen leads to overfitting, excessive adaptation to noise in the training dataset, and significant deterioration of the generalization capability on test data.
Figure 13 presents heatmaps for the mean MSE (a) and MAE (b) values for a neural network with two neurons in the hidden layer. For each stock, modeling was performed with each activation function, and the algorithm providing the lowest MSE and MAE values for the specific function was identified. Subsequently, we calculated the mean values across all activation functions and identified learning algorithms. The results demonstrate that for the linear activation function only, the RC algorithm achieved the best performance. For the softs activation function, all algorithms yielded comparably high values, indicating that this function is unsuitable for time series modeling within this architecture.

4. Conclusions and Suggestions for Future Work

The research focuses on improving the accuracy of short-term stock price forecasting based on inverse optimization algorithms and neural network modeling. Modified neural network training algorithms are proposed, and their effectiveness for financial forecasting tasks is evaluated. The study included analysis of classical (linear, sigmoid) and modern (mish, cloglog) activation functions to assess algorithm stability and identify the most effective activation functions for the forecasting problem. Experimental data confirm the validity of the proposed hypothesis and demonstrate the applicability of the suggested algorithms, which in several test cases provided improved neural network training quality compared with traditional approaches. Analysis of the results showed that for a single-layer neural network, optimal performance indicators were achieved using the DC method. However, for a neural network with one hidden layer, the RC method produced the best results.
The optimal architecture identified in our study, namely, a neural network with one hidden layer containing just two neurons, challenges the notion that deeper and more complex networks necessarily yield better forecasting results. This finding supports the principle of parsimony in model selection and aligns with Xu et al.’s [43] observation that single hidden layer architectures represent an optimal compromise between computational efficiency and predictive power for many applications. It should be noted that linear activation functions are rarely employed in hidden layers of neural networks due to gradient propagation issues. Specifically, when using the Adam optimization algorithm, superior results were achieved with other activation functions (snake, sigmoid, and logsig). However, when implementing inverse optimization algorithms, the linear activation function demonstrates optimal efficiency in the majority of our experiments.
The implications of findings extend beyond the specific domain of stock price forecasting. Results suggest that the methodology for selecting training algorithms should be reconsidered in the context of financial time series analysis. The prevalent preference for gradient-based methods may be suboptimal for tasks involving data with periodic components and high volatility, which characterize stock market dynamics.
The comparative analysis with LLMs, such as Claude 4 Sonnet Thinking, reveals another interesting dimension. Although LLMs demonstrated impressive forecasting capabilities that surpassed single-layer neural networks, they still did not consistently outperform optimized neural networks with one hidden layer trained using the inverse algorithm. This suggests that specialized, efficiently trained neural networks remain competitive tools for financial forecasting, even in the era of large foundation models.
Future research directions should include the following:
  • Integration of inverse optimization algorithms with other neural network architectures, particularly recurrent networks and transformers, which have shown promise in capturing temporal dependencies in financial data;
  • Exploration of hybrid approaches that combine the strengths of inverse optimization with traditional algorithms or metaheuristics;
  • Investigation of feature selection techniques to complement the proposed training algorithms and further enhance forecasting accuracy.
In addition, further research directions involve adapting and applying the developed algorithms to other machine learning tasks, particularly data clustering problems.
In conclusion, this study demonstrates that inverse optimization algorithms represent a valuable addition to the toolkit of methods for training neural networks in financial forecasting applications. By circumventing the limitations of gradient-based approaches, these algorithms enable more effective exploitation of the capabilities of neural networks, ultimately leading to improved forecasting accuracy and more reliable investment decision making.

Author Contributions

Conceptualization, E.G.; methodology, E.G.; software, E.G. and R.G.; validation, E.G., R.G. and E.V.; formal analysis, E.V.; investigation, E.G., R.G. and E.V.; resources, E.G. and R.G.; data curation, R.G.; writing—original draft preparation, E.G.; writing—review and editing, R.G. and E.V.; visualization, E.G. and R.G.; supervision, E.G.; project administration, E.G.; funding acquisition, E.G. All authors have read and agreed to the published version of the manuscript.

Funding

This work was carried out within the framework of the TUSUR Development Program for 2025–2036 of the Strategic Academic Leadership Program “Priority 2030”.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The datasets generated during and/or analysed during the current study are available from the corresponding author on reasonable request.

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A

INPUT:
- Training data (Price_prev, Price)
- Network architecture (input_neurons, hidden_neurons)
- Parameters: d (step divisor), q (step reduction coefficient), rmax (maximum threshold)
OUTPUT: Optimized weights w0, w1
BEGIN
1. INITIALIZATION
  Initialize weights w0, w1 randomly
  Set r = 1, u = 1 for all weights
  // Compute initial error function using Equation (1)
  z = f2(w1 × f1(w0 × Price_prev))
  Jprev = Σ(Pricez)2
  // Set initial step size
  step = Jprev/d
2. MAIN LOOP
  WHILE rrmax DO
  2.1. TARGET REDUCTION
    // Apply stepwise reduction using Equation (2)
    Jtarget = Jprev − step/r
  2.2. WEIGHT SELECTION
    // Calculate selection probabilities for RC method
    total_usable = Σ ui for all weights
    IF total_usable = 0 THEN
          r = r × q
     Set u = 1 for all weights
     total_usable = total number of weights
    END IF
    FOR each weight i with ui = 1 DO
      // Equal probabilities
      βi = 1/total_usable
    END FOR
    // Select weight index p based on probability β
    p = RandomSelection(β)
  2.3. LAYER DETERMINATION
    IF p ≥ (input_neurons + 1) × hidden_neurons THEN
      GO TO STEP 3 (Second Layer Modification)
    ELSE
      GO TO STEP 4 (First Layer Modification)
    END IF
3. SECOND LAYER MODIFICATION
  3.1. COEFFICIENT INDEX CALCULATION
    v = p − (input_neurons + 1) × hidden_neurons
  3.2. NEWTON’S METHOD ITERATION
    Copy w1 to w1*
    REPEAT
      // Compute hidden layer output with bias
      // Append bias
      hbias = [f1(w0 × Price_prev); 1]
      // Compute gradient g1 using Equation (2)
      δ2 = (zPrice) ⊙ f2’(w1 × hbias)
      g1 = hbiasT × δ2
      // Newton update
      w1*v = w1*v − (J(w*) − Jtarget)/ 2g1v
      // Recalculate J(w*) and gradient using Equations (1) and (2)
      znew = f2(w1hbias)
      Jnew = Σ(Priceznew)2
      UNTIL convergence or max_iterations
  3.3. ACCEPTANCE CHECK
    IF Jnew < Jprev THEN
      w1 = w1*
      u = 1 for all weights
      Jprev = Jnew
      GO TO STEP 2
    ELSE
      up = 0
      GO TO STEP 2
    END IF
4. FIRST LAYER MODIFICATION
  4.1. MATRIX INDICES CALCULATION
    v = p mod hidden_neurons
    b = ⌊p/hidden_neurons⌋
  4.2. NEWTON’S METHOD ITERATION
    Copy w0 to w0*
    REPEAT
      // Compute hidden layer error using Equation (3)
      h = f1(w0 × Price_prev)
      δ2 = (zPrice) ⊙ f2’(w1 × [h; 1])
      // Exclude bias weights
      w1_no_bias = w1[1:hidden_neurons, :]
      δ1 = (w1_no_biasT × δ2) ⊙ f1’(w0 × Price_prev)
      // Compute gradient g0 using Equation (3)
      g0 = Price_prevT × δ1
      // Newton update
      w0*b,v = w0*b,v − (J(w*) − Jtarget)/4g0b,v
      // Recalculate J(w*) and gradient using Equations (1) and (3)
      hnew = f1(w0* ×Price_prev)
      znew = f2(w1 × [hnew; 1])
      Jnew = Σ(Priceznew)2
      UNTIL convergence or max_iterations
  4.3. ACCEPTANCE CHECK
    IF Jnew < Jprev THEN
      w0 = w0*
      u = 1 for all weights
      Jprev = Jnew
      GO TO STEP 2
    ELSE
      up = 0
      GO TO STEP 2
    END IF
  END WHILE
5. RETURN optimized weights w0, w1
END

References

  1. Chang, P.C.; Liu, C.H.; Lin, J.L.; Fan, C.Y.; Ng, C.S.P. A neural network with a case based dynamic window for stock trading prediction. Expert Syst. Appl. 2009, 36, 6889–6898. [Google Scholar] [CrossRef]
  2. Rouf, N.; Malik, M.B.; Arif, T.; Sharma, S.; Singh, S.; Aich, S.; Kim, H.-C. Stock Market Prediction Using Machine Learning Techniques: A Decade Survey on Methodologies, Recent Developments, and Future Directions. Electronics 2021, 10, 2717. [Google Scholar] [CrossRef]
  3. Bishop, C.M. Pattern Recognition and Machine Learning; Springer: Berlin/Heidelberg, Germany, 2006. [Google Scholar]
  4. Box, G.E.P.; Jenkins, G.M. Time Series Analysis, Forecasting and Control; Holden Day: San Francisco, CA, USA, 1976. [Google Scholar]
  5. Engle, R.F. Autoregressive conditional heteroscedasticity with estimates of the variance of united kingdom inflation. Econom. J. Econom. Soc. 1982, 50, 987–1007. [Google Scholar] [CrossRef]
  6. Bollerslev, T. Generalized autoregressive conditional heteroskedasticity. J. Econom. 1986, 31, 307–327. [Google Scholar] [CrossRef]
  7. Engle, R.F.; Bollerslev, T. Modelling the persistence of conditional variances. Econom. Rev. 1986, 5, 1–50. [Google Scholar] [CrossRef]
  8. Nelson, D.B. Conditional heteroskedasticity in asset returns: A new approach. Econometrica 1991, 59, 347–370. [Google Scholar] [CrossRef]
  9. Glosten, L.R.; Jagannathan, R.; Runkle, D.E. On the relation between the expected value and the volatility of the nominal excess return on stocks. J. Financ. 1993, 48, 1779–1801. [Google Scholar] [CrossRef]
  10. Zakoian, J.-M. Threshold heteroskedastic models. J. Econ. Dyn. Control 1994, 18, 931–955. [Google Scholar] [CrossRef]
  11. Vukovic, D.; Spitsyna, L.Y.; Gribanova, E.; Spitsin, V.; Lyzin, I. Predicting the Performance of Retail Market Firms: Regression and Machine Learning Methods. Mathematics 2023, 11, 1916. [Google Scholar] [CrossRef]
  12. Sarve, Y.A.; Phadke, A.C. A Survey on Data-Driven Techniques of Remaining Useful Life Assessment for Predictive Maintenance of the System. J. Sustain. Innov. 2025, 2, 58–71. [Google Scholar] [CrossRef]
  13. Lv, P.; Wu, Q.; Xu, J.; Shu, Y. Stock Index Prediction Based on Time Series Decomposition and Hybrid Model. Entropy 2022, 24, 146. [Google Scholar] [CrossRef]
  14. Zhao, C.; Hu, P.; Liu, X.; Lan, X.; Zhang, H. Stock Market Analysis Using Time Series Relational Models for Stock Price Prediction. Mathematics 2023, 11, 1130. [Google Scholar] [CrossRef]
  15. Liu, Q.; Tao, Z.; Tse, Y.; Wang, C. Stock market prediction with deep learning: The case of China. Financ. Res. Lett. 2021, 46, 102209. [Google Scholar] [CrossRef]
  16. Gomes, G.S.-D.-S.; Ludermir, T.B.; Leyla, M.M.; Lima, R. Comparison of new activation functions in neural network for forecasting financial time series. Neural Comput. Appl. 2011, 20, 417–439. [Google Scholar] [CrossRef]
  17. Akter, S.; Haider, M.R. mTanh: A Low-Cost Inkjet-Printed Vanishing Gradient Tolerant Activation Function. J. Low Power Electron. Appl. 2025, 15, 27. [Google Scholar] [CrossRef]
  18. Dubey, S.R.; Singh, S.K.; Chaudhuri, B.B. Activation functions in deep learning: A comprehensive survey and benchmark. Neurocomputing 2022, 503, 92–108. [Google Scholar] [CrossRef]
  19. Misra, D. Mish: A Self Regularized Non-Monotonic Activation Function. In Proceedings of the 31th British Machine Vision Conference, Manchester, UK, 7–11 September 2020; Volume 1. [Google Scholar]
  20. Khang, W.G.; Sugiyarto, S.; Firza Afiatin, M.Y.; Robiatul Mahmudah, K.; Nursyiva, I.; Mesith, C.; Choo, W.O. Comparison of Activation Functions in Convolutional Neural Network for Poisson Noisy Image Classification. Emerg. Sci. J. 2024, 8, 592–602. [Google Scholar] [CrossRef]
  21. Zhang, S.; Lu, J.; Zhao, H. Deep Network Approximation: Beyond ReLU to Diverse Activation Functions. J. Mach. Learn. Res. 2023, 25, 1687–1725. [Google Scholar]
  22. Bouraya, S.; Belangour, A. A comparative analysis of activation functions in neural networks: Unveiling categories. Bull. Electr. Eng. Inform. 2024, 13, 3301–3308. [Google Scholar] [CrossRef]
  23. Han, F.; Jiang, J.; Ling, Q.H.; Su, B.Y. A survey on metaheuristic optimization for random single-hidden layer feedforward neural network. Neurocomputing 2019, 335, 261–273. [Google Scholar] [CrossRef]
  24. Ojha, V.K.; Abraham, A.; Snášel, V. Metaheuristic design of feedforward neural networks: A review of two decades of research. Eng. Appl. Artif. Intell. 2017, 60, 97–116. [Google Scholar] [CrossRef]
  25. Darwish, A.; Hassanien, A.E.; Das, S. A survey of swarm and evolutionary computing approaches for deep learning. Artif. Intell. Rev. 2020, 53, 1767–1812. [Google Scholar] [CrossRef]
  26. Shen, L.; Chen, C.; Zou, F.; Jie, Z.; Sun, J.; Liu, W. A Unified Analysis of AdaGrad With Weighted Aggregation and Momentum Acceleration. IEEE Trans. Neural Netw. Learn. Syst. 2023, 35, 14482–14490. [Google Scholar] [CrossRef] [PubMed]
  27. Mandasari, S.; Irfan, D.; Wanayumini; Rosnelly, R. Comparison of sgd, adadelta, adam optimization in gender classification using cnn. JURTEKSI (J. Teknol. Dan Sist. Inf.) 2023, 9, 345–354. [Google Scholar] [CrossRef]
  28. Elshamy, R.; Abu-Elnasr, O.; Elhoseny, M.; Elmougy, S. Improving the efficiency of RMSProp optimizer by utilizing Nestrove in deep learning. Dent. Sci. Rep. 2023, 13, 8814. [Google Scholar] [CrossRef]
  29. Reyad, M.; Sarhan, A.M.; Arafa, M. A modified Adam algorithm for deep neural network optimization. Neural Comput. Appl. 2023, 35, 17095–17112. [Google Scholar] [CrossRef]
  30. Nutakki, M.; Mandava, S. Optimizing home energy management: Robust and efficient solutions powered by attention networks. Heliyon 2024, 10, E26397. [Google Scholar] [CrossRef]
  31. Lantian, L.; Weizhi, X.; Hui, Y. Character-level neural network model based on Nadam optimization and its application in clinical concept extraction. Neurocomputing 2020, 414, 182–190. [Google Scholar] [CrossRef]
  32. Bai, L.; Liming, N. Gradient based invasive weed optimization algorithm for the training of deep neural network. Multimed. Tools Appl. 2021, 80, 22795–22819. [Google Scholar] [CrossRef]
  33. Liu, Z.; Tilman, H.; Masahito, U. Neural Networks Fail to Learn Periodic Functions and How to Fix It. In Proceedings of the 34th Conference on Neural Information Processing Systems, Vancouver, BC, Canada, 1–12 December 2020. [Google Scholar]
  34. Sohail, A. Genetic Algorithms in the Fields of Artificial Intelligence and Data Sciences. Ann. Data. Sci. 2023, 10, 1007–1018. [Google Scholar] [CrossRef]
  35. Ozsoydan, F.B.; Gölcük, I. A hyper-heuristic based reinforcement-learning algorithm to train feedforward neural networks. Eng. Sci. Technol. Int. J. 2022, 35, 101261. [Google Scholar] [CrossRef]
  36. Kirkpatrick, S.; Gelatt, C.D.J.; Vecchi, M.P. Optimization by simulated annealing. Science 1983, 220, 671–680. [Google Scholar] [CrossRef]
  37. Biswas, S.; Singh, G.; Maiti, B.; Ezugwu, A.E.-S.; Saleem, K.; Smerat, A.; Abualigah, L.; Bera, U.K. Integrating Differential Evolution into Gazelle Optimization for advanced global optimization and engineering applications. Comput. Methods Appl. Mech. Eng. 2025, 434, 117588. [Google Scholar] [CrossRef]
  38. Huang, Y.; Capretz, L.F.; Ho, D. Machine Learning for Stock Prediction Based on Fundamental Analysis. In Proceedings of the IEEE Symposium Series on Computational Intelligence (SSCI), Orlando, FL, USA, 5–7 December 2021; pp. 1–10. [Google Scholar] [CrossRef]
  39. Oyewole, A.T.; Adeoye, O.B.; Addy, W.A.; Okoye, C.C.; Ofodile, O.C.; Ugochukwu, C.E. Predicting stock market movements using neural networks: A review and application study. Comput. Sci. IT Res. J. 2024, 5, 651–670. [Google Scholar] [CrossRef]
  40. Zaheer, S.; Anjum, N.; Hussain, S.; Algarni, A.D.; Iqbal, J.; Bourouis, S. A Multi Parameter Forecasting for Stock Time Series Data Using LSTM and Deep Learning Model. Mathematics 2023, 11, 590. [Google Scholar] [CrossRef]
  41. Wolff, D.; Echterling, F. Stock picking with machine learning. J. Forecast. 2023, 43, 81–102. [Google Scholar] [CrossRef]
  42. Kaveh, M.; Mesgari, M.S. Application of Meta-Heuristic Algorithms for Training Neural Networks and Deep Learning Architectures: A Comprehensive Review. Neural Process. Lett. 2023, 55, 4519–4622. [Google Scholar] [CrossRef] [PubMed]
  43. Xu, A.; Chang, H.; Xu, Y.; Li, R.; Li, X.; Zhao, Y. Applying artificial neural networks (ANNs) to solve solid waste-related issues: A critical review. Waste Manag. 2021, 124, 385–402. [Google Scholar] [CrossRef]
  44. Lollia, F.; Gamberini, R.; Regattieri, A.; Balugani, E.; Gatos, T.; Gucci, S. Single-hidden layer neural networks for forecasting intermittent demand. Int. J. Prod. Econ. 2017, 183, 116–128. [Google Scholar] [CrossRef]
  45. Luo, Y.; Hu, J.; Zhang, G.; Zhang, P.; Xie, Y.; Kuang, Z.; Zeng, X.; Li, S. A dissolved oxygen levels prediction method based on single-hidden layer feedforward neural network using neighborhood information metric. Appl. Soft Comput. 2024, 167, 112328. [Google Scholar] [CrossRef]
  46. Gribanova, E. Development of iterative algorithms for solving the inverse problem using inverse calculations. East.-Eur. J. Enterp. Technol. 2020, 4, 27–34. [Google Scholar] [CrossRef]
  47. Gribanova, E.; Savitsky, A. Algorithm for Estimating the Time of Posting Messages on Vkontakte Online Social Network. Int. J. Inf. Technol. Secur. 2020, 12, 3–14. [Google Scholar]
  48. Gribanova, E. Elaboration of an Algorithm for Solving Hierarchical Inverse Problems in Applied Economics. Mathematics 2022, 10, 2779. [Google Scholar] [CrossRef]
  49. Pelster, M.; Val, J. Can ChatGPT assist in picking stocks? Financ. Res. Lett. 2023, 59, 104786. [Google Scholar] [CrossRef]
  50. Ko, H.; Lee, J. Can ChatGPT improve investment decisions? From a portfolio management perspective. Financ. Res. Lett. 2024, 64, 105433. [Google Scholar] [CrossRef]
Figure 1. Neural network model (h represents the output of the hidden layer of the neural network and z is the final neuron output).
Figure 1. Neural network model (h represents the output of the hidden layer of the neural network and z is the final neuron output).
Bdcc 09 00235 g001
Figure 4. Main blocks of the algorithm, including the error function reduction, weight coefficient selection, and equation solving. The cycle repeats until no active weight coefficients remain.
Figure 4. Main blocks of the algorithm, including the error function reduction, weight coefficient selection, and equation solving. The cycle repeats until no active weight coefficients remain.
Bdcc 09 00235 g004
Figure 5. Comparative performance analysis of optimization algorithms for neural networks with linear activation function and single hidden layer architecture (two neurons): (a) Box plot distribution of absolute deviations between predicted and actual values across four optimization methods: SGD, Adam, RC, and DC. Hereinafter, plus indicates mean value, line indicates median, rectangle indicates the 25–75% quartile range, and whiskers indicate minimum and maximum values or 1.5 interquartile range and outlier distributions. (b) Time series comparison of actual market values (solid black line) versus predicted trajectories from all four optimization algorithms over 160 observation periods.
Figure 5. Comparative performance analysis of optimization algorithms for neural networks with linear activation function and single hidden layer architecture (two neurons): (a) Box plot distribution of absolute deviations between predicted and actual values across four optimization methods: SGD, Adam, RC, and DC. Hereinafter, plus indicates mean value, line indicates median, rectangle indicates the 25–75% quartile range, and whiskers indicate minimum and maximum values or 1.5 interquartile range and outlier distributions. (b) Time series comparison of actual market values (solid black line) versus predicted trajectories from all four optimization algorithms over 160 observation periods.
Bdcc 09 00235 g005
Figure 6. Comparative performance analysis of optimization algorithms for neural networks with mish activation function and single hidden layer architecture (two neurons): (a) Box plot distribution of absolute deviations between predicted and actual values across four optimization methods. (b) Time series comparison of actual market values (solid black line) versus predicted trajectories from all four optimization algorithms over 160 observation periods.
Figure 6. Comparative performance analysis of optimization algorithms for neural networks with mish activation function and single hidden layer architecture (two neurons): (a) Box plot distribution of absolute deviations between predicted and actual values across four optimization methods. (b) Time series comparison of actual market values (solid black line) versus predicted trajectories from all four optimization algorithms over 160 observation periods.
Bdcc 09 00235 g006
Figure 7. Heatmap of MSE values for different neural network architectures and training methods (activation function and training algorithm).
Figure 7. Heatmap of MSE values for different neural network architectures and training methods (activation function and training algorithm).
Bdcc 09 00235 g007
Figure 8. Actual and predicted stock prices obtained using the Claude 4 Sonnet Thinking language model over 160 observation periods.
Figure 8. Actual and predicted stock prices obtained using the Claude 4 Sonnet Thinking language model over 160 observation periods.
Bdcc 09 00235 g008
Figure 9. Dynamics of normalized closing prices for the stocks of 40 Russian companies.
Figure 9. Dynamics of normalized closing prices for the stocks of 40 Russian companies.
Bdcc 09 00235 g009aBdcc 09 00235 g009b
Figure 10. Frequency distribution of optimal activation functions and training algorithms achieving lowest MSE values across 40 stocks. A window size of 30 (a) demonstrates strong preference for linear activation (33 stocks) and DC training method, whereas a window size of 5 (b) shows similar activation preference but more balanced training method distribution, suggesting shorter temporal windows benefit from diverse optimization approaches.
Figure 10. Frequency distribution of optimal activation functions and training algorithms achieving lowest MSE values across 40 stocks. A window size of 30 (a) demonstrates strong preference for linear activation (33 stocks) and DC training method, whereas a window size of 5 (b) shows similar activation preference but more balanced training method distribution, suggesting shorter temporal windows benefit from diverse optimization approaches.
Bdcc 09 00235 g010
Figure 11. Frequency distribution of optimal activation functions achieving lowest MSE across 40 stocks for different hidden layer sizes: (a) 2 neurons, (b) 8 neurons, and (c) 16 neurons. Linear activation consistently outperforms all alternatives, delivering optimal results for 36–38 stocks regardless of network architecture complexity.
Figure 11. Frequency distribution of optimal activation functions achieving lowest MSE across 40 stocks for different hidden layer sizes: (a) 2 neurons, (b) 8 neurons, and (c) 16 neurons. Linear activation consistently outperforms all alternatives, delivering optimal results for 36–38 stocks regardless of network architecture complexity.
Bdcc 09 00235 g011
Figure 12. MSE performance comparison across neural network architectures for 40 individual stocks. The two-neuron hidden layer configuration consistently achieves the lowest prediction errors for majority of stocks, demonstrating superior forecasting accuracy compared with single.
Figure 12. MSE performance comparison across neural network architectures for 40 individual stocks. The two-neuron hidden layer configuration consistently achieves the lowest prediction errors for majority of stocks, demonstrating superior forecasting accuracy compared with single.
Bdcc 09 00235 g012
Figure 13. Heatmaps showing mean MSE (a) and MAE (b) values for neural networks with two hidden neurons across different activation functions and learning algorithms.
Figure 13. Heatmaps showing mean MSE (a) and MAE (b) values for neural networks with two hidden neurons across different activation functions and learning algorithms.
Bdcc 09 00235 g013
Table 1. Experimental results with a single-layer neural network for Gazprom PJSC stock (the best results are highlighted in green).
Table 1. Experimental results with a single-layer neural network for Gazprom PJSC stock (the best results are highlighted in green).
Activation FunctionMSEMAE
AdamSGDRCDCAdamSGDRCDC
linear0.00740.01060.0050.00340.06710.08140.05520.0452
snake (0.5)0.00750.00950.00740.00650.06670.07630.06870.0656
arctg0.00870.01580.00460.0050.07490.10490.05320.0543
sincos0.050.050.12780.26320.16220.16220.33040.4737
invers0.0080.01430.00470.00420.07120.09840.05330.0508
softs0.02570.03230.03360.03310.11710.11920.13510.1355
tanh0.00880.01040.00560.00570.07430.11060.05960.0597
softplus0.06460.03470.00840.00890.24160.17000.07780.0769
mish0.00660.00980.00790.00570.06950.07340.07260.0586
cloglogm0.00670.0080.00350.00290.0640.0640.04620.041
cloglog0.01380.0110.00750.00540.09760.08040.07280.0587
logsigm0.00470.06030.00370.00330.05190.2250.04880.0444
rootsig0.01330.01380.01170.00710.09330.09650.08620.0649
Table 2. Modeling results with different values of the learning hyperparameter (the best results are highlighted in green).
Table 2. Modeling results with different values of the learning hyperparameter (the best results are highlighted in green).
αTest Set
MSEMAE
AdamSGDRCDCAdamSGDRCDC
10.01011.19 × 10120.00500.00340.08411,016,3800.05520.0452
0.10.00745.21 × 10100.0671213,836.4
0.010.00999.1 × 10110.0782889,434.8
0.0010.01212.68 × 10100.0869151,634.9
0.00010.20200.01060.39110.0814
0.000010.29400.01260.47980.0888
Table 3. Experimental results with a single hidden layer neural network with two neurons for Gazprom PJSC stock (the best results are highlighted in green).
Table 3. Experimental results with a single hidden layer neural network with two neurons for Gazprom PJSC stock (the best results are highlighted in green).
Activation FunctionMSEMAE
AdamSGDRCDCAdamSGDRCDC
linear0.00990.02740.00200.04190.08620.14250.03230.1684
snake (0.5)0.00780.08140.04740.0370.06680.26390.18610.156
arctg0.04310.01610.00790.05540.17880.10460.05580.2052
sincos0.02730.01650.00230.10820.13250.09470.03510.3127
sigmoid0.09020.16270.16990.1370.21910.37690.16360.3503
invers0.04310.01520.00340.05320.17920.10030.03950.1975
softs0.04070.04860.00510.0390.15690.19650.05190.1624
tanh0.04770.01670.00600.05820.18970.10820.04630.2117
mish0.05820.13080.00260.10960.10950.33730.03900.3042
cloglogm0.03690.02450.01460.0370.15440.13260.05740.1451
logsigm0.09020.16270.16990.13690.21910.37690.16360.3503
sinc0.10260.17080.00330.08710.24060.38620.04390.2777
wave0.11050.07540.03630.10140.26680.23520.15290.3022
Table 4. Experimental results with a single hidden layer neural network with eight neurons for Gazprom PJSC stock (the best results are highlighted in green).
Table 4. Experimental results with a single hidden layer neural network with eight neurons for Gazprom PJSC stock (the best results are highlighted in green).
Activation FunctionMSEMAE
AdamSGDRCDCAdamSGDRCDC
linear0.00820.01020.00220.03560.07740.07550.03430.1502
snake (0.5)0.00770.02740.00280.02160.07070.13220.04090.115
arctg0.00920.00990.00220.03640.07500.07490.03530.1562
sincos0.04970.04300.00350.02670.17580.18000.04670.1273
sigmoid0.04900.05350.03830.1570.15570.20940.08260.3706
invers0.01240.00990.01040.03850.09100.07430.06190.1544
softs0.03170.01400.00440.10670.12900.09950.05190.301
tanh0.01480.00980.00900.03850.09360.07450.07470.1593
mish0.01130.01390.01990.07510.07940.08850.09320.2486
cloglogm0.01440.01250.00310.06750.09640.08570.04300.2329
logsigm0.04900.05350.04200.1570.15570.20940.08480.3706
sinc0.01680.03430.00360.16890.09590.13810.04170.3839`
wave0.01110.01080.00460.18820.07700.07520.04830.408
Table 5. Experimental results with a single hidden layer neural network with sixteen neurons for Gazprom PJSC stock (the best results are highlighted in green).
Table 5. Experimental results with a single hidden layer neural network with sixteen neurons for Gazprom PJSC stock (the best results are highlighted in green).
Activation FunctionMSEMAE
AdamSGDRCDCAdamSGDRCDC
linear0.01180.01000.00250.07390.07890.08190.03610.2301
snake (0.5)0.00700.01320.00830.02960.06140.09410.06700.1447
arctg0.01120.01250.01970.02380.08890.08790.10150.1124
sincos0.02630.06250.03840.23860.12920.22670.16020.4606
sigmoid0.01490.03730.05520.14850.10410.16690.13600.3612
invers0.01060.01170.00810.18180.08460.08440.05630.3895
softs0.01550.01110.00710.0120.10720.08200.06690.09
tanh0.00830.01380.01400.02650.07760.08830.09760.1349
mish0.01070.01280.01640.01950.07340.08310.10800.1063
cloglogm0.01090.01150.01610.01880.08660.07890.10150.1021
logsigm0.01490.03730.04140.14850.10410.16690.12300.3612
sinc0.02220.16740.00560.1840.12730.38300.05520.4
wave0.01770.019523343240.45220.09930.1002202.13220.6271
Table 6. Fragment of the table with source data for forecasting.
Table 6. Fragment of the table with source data for forecasting.
Pricet−1Pricet−2Pricet−3Pricet−4Pricet−5Pricet−6Pricet−7Pricet−8Pricet−30
158.01158.68159.19158.18159.87160.14160.87158.1163.52
156.52158.01158.68159.19158.18159.87160.14160.87162.51
Table 7. Modeling results for a single-layer neural network.
Table 7. Modeling results for a single-layer neural network.
Activation FunctionPeriod Window = 5Period Window = 30
AdamSGDAdamSGDAdamSGDAdamSGD
arctg181021084919
cloglog711139716710
cloglogm19399111721
invers21748621220
linear160101420533
logsigm98158361615
mish21667341221
rootsig1315841061311
sincos011425171715
snake21451072625
softplus11213581769
softs12186426356
tang171094105817
Total1851141041179273133222
Table 8. Modeling results for a neural network with one hidden layer.
Table 8. Modeling results for a neural network with one hidden layer.
Activation Function2 Neurons in the Hidden Layer8 Neurons in the Hidden Layer16 Neurons in the Hidden Layer
AdamSGDRC50RC80AdamSGDRC50RC80AdamSGDRC50RC80
arctg21352104251142024
cloglogm323236527272526
invers143413333182147
linear004000040010390
logsigm18510759242252130
mish5033233340263110
sigmoid17510857253232150
sinc4630090310160240
sincos243403921792830
snake503238527022981
softs115159303701531111
tang36247101217192704
wave817150182191175162
Total795534442113593301819214514835
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Gribanova, E.; Gerasimov, R.; Viktorenko, E. Application of Inverse Optimization Algorithms in Neural Network Models for Short-Term Stock Price Forecasting. Big Data Cogn. Comput. 2025, 9, 235. https://doi.org/10.3390/bdcc9090235

AMA Style

Gribanova E, Gerasimov R, Viktorenko E. Application of Inverse Optimization Algorithms in Neural Network Models for Short-Term Stock Price Forecasting. Big Data and Cognitive Computing. 2025; 9(9):235. https://doi.org/10.3390/bdcc9090235

Chicago/Turabian Style

Gribanova, Ekaterina, Roman Gerasimov, and Elena Viktorenko. 2025. "Application of Inverse Optimization Algorithms in Neural Network Models for Short-Term Stock Price Forecasting" Big Data and Cognitive Computing 9, no. 9: 235. https://doi.org/10.3390/bdcc9090235

APA Style

Gribanova, E., Gerasimov, R., & Viktorenko, E. (2025). Application of Inverse Optimization Algorithms in Neural Network Models for Short-Term Stock Price Forecasting. Big Data and Cognitive Computing, 9(9), 235. https://doi.org/10.3390/bdcc9090235

Article Metrics

Back to TopTop