1 Introduction

In 2015–2018, China’s stock market fluctuated greatly, which caused many investors and investors to experience unprecedented joy or heavy losses, and the stock market was turbulent. Therefore, in this realistic context, how to extract the potential effective information in many data, and to further predict and analyze the general trend of the stock market, both the stockholders and the securities companies have important research and practical significance. In the bear market, with the continuous improvement of liquidity, the efficiency of the stock market has increased, and the market quality has improved significantly. In the bull market, the improvement of market efficiency with liquidity has shown a trend of rising first and then decreasing. On the whole, the impact of liquidity on China’s stock market efficiency is similar to that of the bull market. Before the liquidity reaches a certain level, the market efficiency gradually rises with the liquidity level, and then declines.

In view of the complexity and strategic nature of the stock market, many research teams at home and abroad have studied and analyzed their development trends, fluctuations, and data analysis. Chen [1] found that many foreign banks and their policies have certain disapproval, and they also use monetary discrimination and give some opportunities to borrow money to provide non-state-owned enterprises with some financial help. Bildirici [2] combines the Lyapunov exponent and Kolmogorov entropy to study the existence of chaotic structures in oil prices, investor expectations, and stock returns. The results show oil price volatility, nonlinear tail dependence between investor expectations and stock returns. Important evidence. Huang [3] uses forecasting methods to reveal the efficiency of the US stock market. The ARIMA model continues to outperform the random walk model, indicating that the efficiency of the US market during the sample period is not weak and that the effectiveness of the US stock market depends on how investors assess their losses. Cheng [4] estimated the conditional heteroscedasticity of the income series based on the GARCH model and for the observed fluctuation clusters and the trailing peak-tail characteristics of the financial market income series. Finally, the simulation results were tested by return, which proved its effectiveness. Zeng [5] and others have quantitatively assessed China’s oil trade risks. The model was established to calculate the abnormal return fluctuations of stock prices and, based on event research methods and nonparametric tests, to determine whether there is spillover effect in the short term. In order to accurately predict the stock price trend, Mei et al. [6] proposed an ARIMA-SVM model based on SVM model, which was optimized and improved. Through the empirical analysis of IBM stocks, the accuracy of the model reached 96.10%. Semmet [7] and others used various methods to construct various models to analyze the correlation between Chinese stock prices and exchange rate fluctuations. Through research, it is found that exchange rate fluctuations have an impact on stock price fluctuations, and stock price changes also have an impact on stock price fluctuations, thus increasing the risk of foreign exchange markets and stock markets. Jing [8] and others found that the listed insurance company’s stock price index is inversely proportional to the price level, and the price level has a negative impact on the current national economy; the external environmental indicators are the main influencing factors, and the internal operating indicators are relatively minor. The results of Hairen [9] show that the rate of return is more sensitive to emotions, book-to-market ratio, and scale factor, and its liquidity sensitivity is higher, which is more vulnerable to the flow of funds; the margin financing system has intensified the flow of trading funds to stock flows. Yanjun [10] analyzed that in the bear market, with the continuous improvement in liquidity, the efficiency of the stock market increased and the market quality improved significantly. In the bull market, the market efficiency increased with the improvement in liquidity. On the whole, the impact of liquidity on China’s stock market efficiency is similar to that of the bull market. Before the liquidity reaches a certain level, the market efficiency gradually rises with the liquidity level and then declines. Hao [11] selected the financial data of 701 stocks on the GEM in 2017 and used the turnover rate as an explanatory variable to select the market capitalization and the ratio of outstanding shares and the return on net assets as control variables to establish a linear regression model to test its impact on individual stock returns and whether there is liquidity premium and scale effect. Qing [12] and others based on deep neural network optimization technology, combined with the characteristics of LSTM recurrent neural network and the characteristics of the stock market, the data pre-interpolation, wavelet denoising, normalization and other preprocessing operations. After that, it is trained and tested in the LSTM network model of different LSTM layers and different number of hidden neurons in the same layer. Peipei [13] studied the three valuation methods of price–earnings ratio, price-to-book ratio and residual income, and fuzzy analytic hierarchy process, introduced the Duffel expert scoring method, and combined fuzzy AHP with three valuation methods. A new research method of stock investment decision-making based on fuzzy analytic hierarchy process (FAHP-PPR) was proposed. Yan [14] combined with the characteristics of the LSTM (Long Short-Term Memory) recurrent neural network and the characteristics of the stock market, after the data is interpolated, wavelet denoising, normalization and other preprocessing operations, pushed to the different LSTM layers built. Training and testing in the LSTM network model with the number of different hidden neurons in the same number of layers were carried out. Ziyu [15] proposed the use of variable step size two-way long-term memory network (BLSTM) integrated learning method to learn the law of stock price changes in historical data. The prediction of the change of stocks is a change in the mean-square error (MSE) loss function. The simulated trading profit evaluation index is used to better measure the expected performance of the forecasting model in the financial market. Yuzhi [16] and others constructed the Morlet wavelet network, optimized the nodes of the structure, and closed the stock price. The simulations and predictions show that the Morlet wavelet neural network has a good ability to express, and its generalization performance and prediction ability are superior.

At present, many methods have been proposed. These forecast stocks only consider the time factor and do not consider external factors for the time being, and the stock price is affected by many factors and has nonlinear characteristics, so modeling prediction is difficult to achieve good results.

The support vector machine optimization algorithm has the characteristics that other methods do not have. It is not only simple and clear, but also easy to operate, and has high accuracy and obvious linear characteristics. Many research teams began to study the support vector machine optimization algorithm. Qianfeng [17] studied a rolling mill force prediction model based on improved SVM, established a least-squares SVM, and used the algorithm to mix functions. The parameters are optimized to improve the predictive performance of the predictive model. Yiqing [18] applied the support vector machine optimization algorithm to face detection, mainly training support vector machine to make it learn to distinguish between face and non-face; support vector machine has complete mathematical derivation, algorithm logic is strict, and overall than Adaboost algorithm complex, but works well with a small sample size. Ying [19] and others used SVM to solve the characteristics of small samples and nonlinear problems and classified the stability of surrounding rock. The results show that the established GSM-SVM model is consistent with the actual results of the prediction samples, and its prediction accuracy is greatly improved compared with BP neural network. Shixiang [20] and others applied the support vector machine optimization algorithm to vehicle vector prediction and used LS-SVM to make regression predictions on vehicle sales, comprehensively analyzing automobile sales, complaint rate, off-season peak season and other influencing factors, and adopting bilinear network. The lattice search method and the genetic algorithm optimize the kernel function. Through rough selection and selection, the global optimal parameters c and g of the LS-SVM prediction model are determined, and the prediction results of the two optimization methods are established. Lei [21] applied the support vector machine optimization algorithm to the hardware Trojan detection and found that the optimized SVM method improved the detection speed and accuracy of the hardware Trojan classifier and can effectively detect the hardware Trojan with an area of 0.1%. The rate can be increased by 15.6% and the time consumption is reduced by 98.1%. Xiaojun [22] found that the accuracy of intrusion detection is greatly improved, the false alarm rate and false negative rate of intrusion detection are reduced, and the performance of intrusion detection is greatly improved. It has certain reference and application value for real-time intrusion detection environment. Zheng et al. [23]. For the SVM-based fault identification method, the parameters of the support vector machine are difficult to select, which leads to poor diagnosis results. The ABC is used to support the penalty factor of the SVM. C and kernel function parameters σ are optimized, and ABC-SVM (artificial bee colony optimization support vector machine) is constructed to diagnose turbine blade failure. Can et al. [24] for the input feature selection and parameter selection of SVM, establish the SVM input feature and parameter optimization bilevel programming model to solve. After that, the particle filter method is used to correct the results obtained by the support vector machine regression. Jin [25] found that the human motion recognition based on vector machine optimization uses the support vector machine to improve the strategy to realize motion recognition and uses the classifier to identify in the recognition process. The precision implements the perfection of the traditional strategy, and outputs a corresponding confidence level in the process of identifying the result output, and the recognition result is processed by the confidence degree.

In order to solve the problem of single method and complicated operation of stock intelligent investment strategy, this paper designs the overall idea of quantitative model based on the selection of SVM quantitative investment strategy, and then the basic target, from forecasting period, forecasting target, investment scope, and characteristics. SVM-based quantitative investment strategies are built for indicators, time of sale, and model settings. After the model is built, when you use the SVM to run the quantification strategy, you need to set the parameters of the model, such as processing the unbalanced data. An empirical analysis of the strategy model in the stock market is carried out. Select SSE 50 stock pool, and the frequency of backtesting will be measured back on a daily basis [26].

2 Method

2.1 Support vector machine optimization algorithm

The idea of SVM is to be able to correctly divide the hyperplane through the training data set. The hyperplane can classify the known data sets. The criterion of classification is to model the 0/1 classification learned from feature learning in logistic regression. The model, logistic expression is as follows:

$$f(x) = \sigma (wx + b) = \frac{1}{{1 + e^{ - (wx + b)} }}.$$
(1)

Since the independent variable is from negative infinity to positive infinity, the argument of the sigmoid function can be mapped to (0,1), and the corresponding category can be represented by y. The output value is − 1 or + .1.

2.1.1 Linear separable SVM

The model of the perceptron is very similar to the principle of the second-class classification. It is to find a line, separate the binary data sets, and then separate them into two-dimensional space or three-dimensional space. For this separate hyperplane \(\omega^{\text{T}} x + b = 0\), we define that the categorical hyperplane image is drawn using Python, as shown in the following figure, defined above the hyperplane \(\omega^{\text{T}} x + b = 0\) as y = 1 and below the hyperplane \(\omega^{\text{T}} x + b = 0\) as y = − 1, and it can be seen that there is more than one hyperplane that satisfies the condition (Fig. 1).

Fig. 1
figure 1

Classification hyperplane image

The following formula is optimized, and its purpose is to make the statistics of the sum of the points of each error analysis to the maximum distance of the straight line:

$$\sum\limits_{{x_{i} \in M}} {\frac{{ - y_{i} \left( {\omega^{\text{T}} x_{i} + b} \right)}}{{\left\| \omega \right\|_{2} }}} .$$
(2)

When the specific gravity of ω and b increases in proportion, for example, when the ω and b of the molecule increase by many times, the L 2 of the denominator also increases by the same multiple, that is, the numerator and the denominator have a fixed multiple relationship.

2.1.2 Parameter optimization of nonlinear support vector machine

For the optimization of nonlinear support vector machine parameters with radial basis kernel function, this paper uses the grid search method. At this time, there are three parameters that need to be optimized, namely ε, penalty parameter C and the parameter G of the function. If you use a three-dimensional lattice (ε, C, G) for optimization, the amount of calculation will be relatively large. As ε selects different values, the change trend of the parameter pair (C, G) and the trend of the prediction error have similarities, and for the ideal (C, G) combination, the obtained ε is almost the same. Therefore, you can first determine an ε value, optimize (C, G) first, get the optimized (C, G), and then find the optimal ε. In this way, the three-dimensional parameter optimization problem is transformed into a two-dimensional parameter optimization problem, which greatly reduces the calculation amount and improves the efficiency of optimization.

For the parameter data of optimization, first, determine the change interval of (C, G), and the range of values of C and G are set in the large range of \(\left[ {2^{( - 8)} ,2^{8} } \right]\), search step size and both are set to 1. In order to obtain higher-precision model parameters, a 50-fold cross-validation is also used for the optimization of (C, G). The value range for ε is set to [0.000001, 0.2].

2.1.3 SVM model objective function and optimization

The support vector machine model finds that the distance from all points to the hyperplane is maximized, that is, all points are correctly classified on both sides of the hyperplane. It is expressed in mathematical terms as:

$$\hbox{max}\,\gamma = \frac{{y\left( {\omega^{\text{T}} x + b} \right)}}{{\left\| \omega \right\|_{2} }}\quad {\text{s}} . {\text{t}} .\;y_{i} \left( {\omega^{\text{T}} x_{i} + b} \right) \ge 1\;(i = 1,2, \ldots ,m)$$
(3)

That is to say, we must maximize under the constraint condition \(y_{i} \left( {\omega^{\text{T}} x_{i} + b} \right)(i = 1,2 \ldots m)\). It can be seen \(\frac{1}{{\left\| \omega \right\|_{2} }}\) that the optimization method of this perceptron is different. The perceptron is a fixed denominator optimization molecule, and SVM is a fixed molecular optimization denominator, and the support vector is added. Since the maximization \(\frac{1}{{\left\| \omega \right\|_{2} }}\) is equivalent to the minimization \(\frac{1}{2}\left\| \omega \right\|_{2}^{2}\), the optimization function of the SVM is almost the same as the result of the following formula:

$$\hbox{min} \frac{1}{2}\left\| \omega \right\|_{2}^{2} \quad {\text{s}} . {\text{t}} .\;y_{i} \left( {\omega^{\text{T}} x_{i} + b} \right) \ge 1\;(i = 1,2, \ldots ,m).$$
(4)

Since the objective function \(\frac{1}{2}\left\| \omega \right\|_{2}^{2}\) is a convex function and the constraint inequality is one-to-one mapping, which is the principle of the maximum entropy model, the optimization method of the objective function is the same. Specifically, the optimization function is converted to:

$$L(\omega ,b,\alpha ) = \frac{1}{2}\left\| \omega \right\|_{2}^{2} - \sum\limits_{i = 1}^{m} {\alpha_{i} } \left[ {y_{i} \left( {\omega^{\text{T}} x_{i} + b} \right) - 1} \right]$$
(5)

2.2 Multiple classification problems

The multi-category problem tells that there are N categories \(C_{1} ,C_{2} \ldots C_{n}\), and the N categories are disassembled, that is, the multi-category task is solved by disassembling into several classification tasks. The most common strategy in multi-classification tasks is one-to-one disassembly. Solution is one-to-many disassembly or many-to-many disassembly.

2.2.1 One-on-one problem

For a given data set \(D = \left\{ {\left( {x_{1} ,y_{1} } \right),\left( {x_{2} ,y_{2} } \right), \ldots ,\left( {x_{n} ,y_{n} } \right)} \right\},y_{i} \in \left\{ {c_{1} ,c_{2} , \ldots ,c_{N} } \right\}\), the one-to-one problem is to pair the N categories pairwise, so that N(N − 1)/2 two-class tasks can be calculated, and new samples are submitted to all classifiers during the test phase. In the calculation, N(n − 1)/2 classification results are finally obtained, and finally the most predicted result is used as the final classification result.

Algorithm:

$$\begin{array}{*{20}l} {{\text{For}}\;(k,l) \in \gamma \times \gamma } \hfill \\ {D_{[k,l]} = \left\{ {\left( {x_{n} ,y_{n}^{\prime } = 2\left[ {y_{n} = k} \right] - 1} \right):y_{n} = k,y_{n} = l} \right\}} \hfill \\ {{\text{Return}}\;g(x) = \left\{ {w_{[kJ]}^{\text{T}} x} \right\}} \hfill \\ \end{array}$$
(6)

2.2.2 One-to-many problem

The one-to-many problem is to look at each instance of the sample as a positive instance, while the other remaining instance samples serve as a counter classifier. If only one classifier produces a positive instance during the test, the final result is the classifier, and if multiple positive instances are generated during the training process, then the confidence of the classifier needs to be determined, whether the training result the final confidence level is the largest, which is the final classification result.

Algorithm:

$$\begin{array}{*{20}l} {{\text{For}}\;k \in \gamma } \hfill \\ {D_{[k]} = \left\{ {\left( {x_{n} ,y_{n}^{\prime } = 2\left[ {y_{n} = k} \right] - 1} \right)} \right\}_{n = 1}^{N} } \hfill \\ {{\text{Return}}\;g(x) = \arg \max_{\text{key}} \left( {w_{[k]}^{\text{T}} x} \right)} \hfill \\ \end{array}$$
(7)

2.2.3 Many-to-many problems

The most common technique for solving many-to-many problems is error-correcting error-to-error codes. The most common technique for solving many-to-many problems is error correction error code. This technique can be divided into two parts: the coding part and the decoding part. In the coding phase, it can be understood as follows: M divisions are performed for each of the N categories, and each part is divided into positive classes and the other is divided into anti-classes. In the coding phase, the encoded matrix has two forms, respectively. It is a binary code and a ternary code. For a binary code, it has only a positive class and an inverse class, but for a ternary code, in addition to a positive class and an inverse class, there is a deactivated class. In the decoding stage of the partition, each classifier can combine the prediction results to form the code for the test example. Compared with other coding techniques, the maximum difference is that the corresponding category of the coding is the final prediction (Table 1).

Table 1 Coding distance table

2.3 Particle swarm optimization

Particle swarm optimization is also a biological evolutionary algorithm that simulates the behavior of finding food in biological populations. It is a kind of intelligent algorithm similar to the group. Similar algorithms also have genetic algorithms and simulated annealing algorithms. Particle swarm optimization is the determination of the direction of an unknown solution by the solution found by the currently known population.

If the selection of C and g is not appropriate, then over-learning will occur. Want to find the most suitable C and g, based on the existing algorithms, the genetic algorithm is mainly used, and the particle swarm optimization algorithm rarely to find the most suitable parameters. And train the model based on the parameters obtained. Particle swarm optimization is an optimization algorithm. It is based on the enumeration method to add a certain optimization mechanism to achieve the search for the optimal solution. The image shown below is drawn using MATLAB (Fig. 2).

Fig. 2
figure 2

Particle swarm optimization map

3 Experiment

3.1 Data source

The data in this paper comes from the Southwest Securities Golden Point client, and all the data of the SSE A shares are selected. The initial data is 932. The financial indicators of each company have been selected for 4 years. The financial indicators are listed in the form below (Table 2).

Table 2 Financial indicators

Based on these indicators, the raw data is obtained from the Golden Point client, and then the combined significance of the data is used for comprehensive analysis, and then the data is divided into three groups for testing. The first set of data uses the 2017 data as a control group and 2018 data as an experimental group. Using the support vector machine and the decision function, the training set is grouped, and some support vector machines are combined to obtain good results or the results are not. Good data constructs the stock portfolio. Since this time period is already the past time period, we compare the conclusions we get with the market conditions of the year and analyze whether the predicted results are correct. The second set of data uses the 2015 data as the control group, and the 2016 data as the experimental group. The steps are the same as above. The third group of data uses the 2013 data as the control group, and the 2014 data as the experimental group. The steps are the same as above (Table 3).

Table 3 Data year table

3.2 Experimental platform

For the unification of the experimental environment, the now popular language python is used, and Python is very convenient to use in natural language processing tasks. The environment of the whole experimental process is shown in Table 4.

Table 4 Data preprocessing and extraction features experimental environment

3.3 Evaluation criteria

3.3.1 Sample accuracy evaluation criteria

The above gives a variety of different classification methods, but in the end which method is chosen, this involves the evaluation criteria of SVM, usually the best classification evaluation criteria is to test the accuracy of training samples, if the accuracy of the trained samples. If it reaches 100%, then we can think that the classification standard is the best at this time, but under normal circumstances, this evaluation standard is not suitable for the classification problem.

The combined false positive rate is based on the above ideas. This paper constructs a new evaluation standard. We call this the combined false positive rate, which is defined as:

$${\text{CM}} = p_{1}^{2} \int_{{R_{1} }} {f_{1} } (x) + p_{2}^{2} \int_{{R_{2} }} {f_{2} } (x)$$
(8)

where p1 and p2 represent the prior probabilities of the corresponding functions, and R1 and R2 represent the decision regions of the corresponding functions.

3.3.2 Model evaluation indicators

The statistically common classification evaluation indicators are F-measure, recall (Recall), precision (Precision), and accuracy (Accuracy). Table 5 explains these classification indicators.

Table 5 Classification indicators

The accuracy rate refers to the number of samples whose real situation is also rising in the sample predicted to be rising. The recall rate refers to the number of correctly predicted samples in the rising samples in all real cases.

$${\text{Accuracy}} = \frac{{{\text{TP}} + {\text{TN}}}}{{{\text{TP}} + {\text{FP}} + {\text{FN}} + {\text{TN}}}}$$
(9)
$${\text{Precision}} = \frac{\text{TP}}{{{\text{TP}} + {\text{FP}}}}$$
(10)
$${\text{Recall}} = \frac{\text{TP}}{{{\text{TP}} + {\text{FN}}}}$$
(11)

Considering the relationship between the accuracy rate and the recall rate, the two indicators are integrated to obtain a new indicator F-measure:

$${\text{F-measure }} = \frac{{2 \times {\text{Precision}}\;{\text{Re}}\;{\text{call}}}}{{{\text{Precison}} + {\text{Re}}\;{\text{call}}}}$$
(12)

Therefore, for the classification prediction model, the larger the value of F-measure, the better the effect of the classification model.

4 Results

4.1 Grid-based parameter optimization

In the model construction using the algorithm of this paper, k is assumed to be 5, which means that the model will be verified by 50%, and the mode is cross-validation. A grid search algorithm is used for the SVM prediction model to optimize the selection of parameters. At this time, the parameter C range is set to: cmin = − 8, cmax = 8, that is, the range of the value C is set to \(\left[ {2^{( - 8)} ,2^{8} } \right]\). gmin = − 8, gmax = 8, that is, the default parameter g has a variation range of \(\left[ {2^{( - 8)} ,2^{8} } \right]\).

The x-axis in the figure means the value corresponding to the logarithm of C after taking the base 2, and correspondingly, the y-axis means the value corresponding to the logarithm of the base 2 after g is taken, the contour line is the accuracy of the corresponding K-fold cross-validation method after obtaining the corresponding C and g. It can be seen from Fig. 3 that the parameter C of the radial basis kernel function is 0.125, the parameter g has a value of 0.5, and the corresponding MSE is 0.0041.

Fig. 3
figure 3

RBF-GS parameter optimization results

Then use the method of setting the grid to find the best value under the other three kernel functions. Finally, summarize the parameters of various kernel functions under the grid algorithm. The results are summarized in Table 6.

Table 6 Grid method parameters optimization under different kernel functions SVM prediction correlation coefficient and mean-square error comparison table

It can be seen from the table that the correlation coefficient R of RBF-GS is the highest, the correlation coefficient of Linear-GS is the smallest, and the mean-square error is also the corresponding result; the highest parameter C is Sigmoid-GS, the lowest is RBF-GS; the highest G parameter is RBF -GS, the lowest is Poly-GS and Sigmoid-GS.

4.2 Parameter tuning based on particle swarm optimization

In this paper, we also make a reasonable value for each parameter that needs to be set under the particle swarm parameter tuning algorithm. The maximum number of sizepops affects the efficiency of the initial search. The search speed will be particularly slow when the value is too large. On the contrary, if the selected number is small, the model will be prone to local values. The effect of the optimal result, so in the comprehensive consideration, this paper sets it to 20. The following discusses another aspect. In this paper, c1 and c2 are important influence factors of the model. This is an important factor in the operation of the model. The value range is usually set to [1.2–2]. In this paper, c1 is set to 1.5. C1 is the advantage of the particle swarm to find the optimal parameters, that is, the ability to perform local search, and c2 is set to 1.7, c2 is the search ability of the parameters in the global. The number of iterations in this paper is maxgen = 200.

Taking the radial basis kernel function as an example, the figure below shows the result of parameter optimization (Fig. 4).

Fig. 4
figure 4

RBF-PSO parameter optimization results

In order to find the best value for the radial kernel parameters, the algorithm of particle swarm is used. The value of C is 15.73. C is the best training parameter in SVM, and the value g is 0.01, g is radial, a value under the base kernel function. The MSE is 0.004. The results of this article looking for the best values are organized as shown in Table 7.

Table 7 Different kernel functions under particle swarm optimization. SVM prediction correlation coefficient and mean-square error comparison table

4.3 Parameter tuning based on genetic algorithm

In this paper, the genetic algorithm is used to tune the values in the experiment. In practice, the experimenter usually sets the range size to [20, 200], and the maximum number of the digital set is set to 20 in this paper. The maximum value of the evolution algebra maxgen is generally set at [100, 500], where the value is set to 200. This value is usually in the range of [0.4, 0.9], which is set to 0.7. Taking the radial basis kernel function as an example, the following figure is the result graph of the optimization of genetic algorithm parameters (Fig. 5).

Fig. 5
figure 5

RBF-GA parameter optimization results

When the population size is set to 20, the best training parameter C in the SVM model has a value of 8.149, while the parameter g has a value of 0.069 and the MSE is 0.0011. We use the genetic method to optimize the parameters of the other three nuclear functions and sort out all the results, you can get the following Table 8.

Table 8 Comparison of different kernel functions under the optimization of genetic parameters SVM prediction correlation coefficient and mean-square error comparison table

4.4 Comparison of prediction results using different parameter tuning models

Through the analysis of the previous chapter, the results of the four parameter tuning algorithms under the three-parameter tuning algorithms are used to analyze the mean-square error of the parameter optimization effect. The summary is summarized in Table 9.

Table 9 SVM prediction model for different kernel functions Mean variance comparison table for three-parameter tuning algorithms

After comparing the horizontal and vertical directions of Table 9, it can be found that for the parameter optimization algorithm, the advantage of the genetic algorithm is quickly highlighted. In the parameter selection and optimization of the SVM, the correct rate of the model is improved. It may be because the model has relatively stable prediction performance in terms of data classification ability and learning speed. The structure is simple and the learning convergence speed is fast. At the same time, any nonlinear function can be approximated, and the local minimum value can be avoided as much as possible. The genetic algorithm matching the radial basis kernel function has strong robustness to find the optimal parameters by selecting, crossing, and mutating the optimal parameter method (Fig. 6).

Fig. 6
figure 6

Pre-tuning prediction and tuning prediction

It can be seen from the figure that the predicted results after tuning are better than the prediction results before tuning, and the prediction accuracy has been increased to different degrees. The forecasting error of stock data before tuning based on SVM model is large at multiple points, and the volatility is also large. The generalization performance of the model is poor, while the model predicts the error of stock data at the same time, more stable and less volatile.

5 Discussions

It can be clearly seen from Tables 6, 7, and 8 that under the same parameter tuning algorithm, there is a gap between the MSEs obtained by the SVM regression prediction models of different kernel functions, and the prediction results obtained by the radial basis kernel function regression prediction model will be more precise. The R under the genetic algorithm reached 98.59% and the MSE was 0.001. Secondly, the parameters are tuned under the polynomial kernel function, and the worst effect is the linear kernel function. However, the stock market has nonlinear characteristics, so the linear kernel function can not be used to construct the prediction model. The result of this poor prediction reflects the characteristics of the stock market. The insufficiency of the polynomial kernel function is that it has more parameters. The higher polynomial order can make the kernel matrix element close to infinity or infinity, which leads to the difficulty of calculation.

The stock price prediction graph adjusted by the genetic algorithm parameters under the radial basis kernel function can be intuitively obtained. The parameter-tuned SVM model predicts the matching effect between the stock trend and the actual stock trend, and the fitting result is better. The parameter tuning algorithm corresponding to other kernel functions achieves the desired parameter tuning effect. Therefore, in the SVM prediction, the genetic algorithm parameter tuning under the radial basis kernel function can be used to better predict the stock, so as to develop a trading plan and achieve better investment returns.

In general, the grid search method searches for all the parameters of the model by traversing all the parameter points in the divided grid; the genetic algorithm selects the optimal parameters through the selection, intersection, and mutation of the data gene. The group algorithm is a search process by finding the optimal particles in space, and the prediction effect is closest to the real value. In contrast, the linear kernel function particle swarm optimization algorithm does not perform well.

Support vector machines work when using the sigmoid kernel function, just like many layers of neural mesh work. The radial basis kernel function can reflect a digital specimen into the higher-dimensional digital space, and there are not many constraints on the size of the sample. In reality, the most applicable field is applicable.

6 Conclusion

Investment has gradually entered the stage of people’s property planning, in which stock investment has a huge market. In order to effectively avoid the hidden risks of stock market investment and maximize the completion of investor income, stock price forecasting has become an important concern for investors. In order to reduce the investment risk, it is of great practical significance to design a stock price forecasting scheme with higher accuracy. After raising the question, through the above theoretical research and empirical analysis, the following conclusions are obtained:

  1. 1.

    Under the same parameter tuning algorithm, there is a gap between the MSEs obtained by the SVM regression prediction model of different kernel functions, and the prediction results obtained by the radial basis kernel function regression prediction model are more accurate. The R under the genetic algorithm reached 98.59% and the MSE was 0.001. Secondly, the parameters are tuned under the polynomial kernel function, and the worst effect is the linear kernel function. However, the stock market has nonlinear characteristics, so the linear kernel function cannot be used to construct the prediction model. The result of this poor prediction reflects the characteristics of the stock market.

  2. 2.

    The stock price prediction graph adjusted by the genetic algorithm parameters under the radial basis kernel function can be intuitively obtained. The parameter-tuned SVM model predicts the matching effect between the stock trend and the actual stock trend. The result is better than the parameter tuning algorithm corresponding to other kernel functions, and the desired parameter tuning effect is achieved.

  3. 3.

    In general, the grid search method searches for all the parameters of the model by traversing all the parameter points in the divided grid; the genetic algorithm performs the optimal parameters through the selection, crossover, and mutation of the data gene. The particle swarm optimization algorithm is a search process in which particles are searched for optimal particles in space, and the prediction effect is closest to the real value. In contrast, the linear kernel function particle swarm optimization algorithm does not perform well.

  4. 4.

    The support vector machine works like the neural grid of many layers when working with the sigmoid kernel function. The radial basis kernel function can reflect a digital specimen into the higher-dimensional digital space, and there are not many constraints on the size of the sample. In reality, the most applicable field is applicable. Therefore, in the SVM prediction, the genetic algorithm parameter tuning under the radial basis kernel function can be used to better predict the stock, so as to develop a trading plan and achieve better investment returns.