TWI399699B - Forecasting taifex based on particle swarm optimization - Google Patents
Forecasting taifex based on particle swarm optimization Download PDFInfo
- Publication number
- TWI399699B TWI399699B TW98113806A TW98113806A TWI399699B TW I399699 B TWI399699 B TW I399699B TW 98113806 A TW98113806 A TW 98113806A TW 98113806 A TW98113806 A TW 98113806A TW I399699 B TWI399699 B TW I399699B
- Authority
- TW
- Taiwan
- Prior art keywords
- fuzzy
- particle
- equation
- prediction
- data
- Prior art date
Links
Landscapes
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Description
本發明關於一種用以預測臺股指數期貨之方法,特別是一種基於粒子群最佳化演算法及模糊時間序列的臺股指數期貨預測方法。The invention relates to a method for predicting Taiwan stock index futures, in particular to a Taiwan stock index futures forecasting method based on particle swarm optimization algorithm and fuzzy time series.
為了解決人類對於各種特定問題及經濟活動預測之需求,近年來研究學者試圖提出了各式預測方法及模型。早期對於證券期貨指數之預測多採取傳統迴歸分析法,然而,迴歸分析主要適用於變因較少、線性且複雜度低之現象預測,對於充滿不確定性之證券期貨市場而言,回歸分析則有其相當的侷限性,其主要原因在於證券期貨交易活動係屬隨機現象,其總體時間序列資料普遍為非定態(nostationary),若直接進行迴歸分析會產生虛假迴歸(spurious regression)的問題,造成嚴重錯誤的估計。傳統時間序列分析模式屬定量預測法,其預測模式,普遍存在下列缺點:1.以歷史資料的變動情況決定預測模式準確性程度;2.若資料不足或收集的資料有所誤差時,傳統預測模式會有高誤差;3.若有突發狀況發生,足以影響下一期真實值時,傳統時間序列之預測。為克服傳統統計預測方式預測效果不甚理想,準確率過低等缺陷,近年來許多新興的預測方法及模型陸續被發展建立;隨著預測方法的不斷改進變革,學者更發現,針對特定問題建構之特定目的活動預測方法,較一般性目的的預測方法更具準確性。In order to solve the human needs for various specific problems and economic activity predictions, researchers have tried to propose various prediction methods and models in recent years. In the early stage, the traditional regression analysis method was adopted for the forecast of the securities and futures index. However, the regression analysis is mainly applicable to the prediction of phenomena with less variation, linearity and low complexity. For the securities futures market full of uncertainty, the regression analysis is There are quite some limitations. The main reason is that the securities and futures trading activities are random phenomena, and the overall time series data is generally nonstationary. If the direct regression analysis will produce spurious regression, An estimate that caused a serious error. The traditional time series analysis mode is a quantitative forecasting method. Its prediction mode generally has the following shortcomings: 1. Determine the accuracy of the prediction mode based on the change of historical data; 2. If the data is insufficient or the collected data has errors, the traditional prediction The mode will have a high error; 3. If there is an unexpected situation that is sufficient to affect the next real value, the prediction of the traditional time series. In order to overcome the shortcomings of traditional statistical prediction methods, such as poor prediction results and low accuracy, many new prediction methods and models have been developed in recent years. With the continuous improvement and improvement of prediction methods, scholars have found that to construct specific problems. The specific purpose activity prediction method is more accurate than the general purpose prediction method.
時間模糊序列的預測概念係時間序列模式中加入模糊理論(Fuzzy Theory)的理論應用,其在各研究領域上扮演著重要的角色,例如交通載運量預估、股票市場股價預測、醫學上的血壓預測等。1993年,學者Song等人首先將模糊邏輯觀念合併時間序列預測,並提出了模糊時間序列預測架構,其運用模糊邏輯推理有效地處理模糊及不確定環境下的語意資料;透過模糊時間序列理論,Song等人提出兩種預測模型(即,時變預測模型及非時變預測模型),並針對阿拉巴馬大學學生人數進行預測。1996年,學者Chen改良先前的預測方法,建立一個較為簡便的預測模型,其優點在於減少運算的次數及簡化計算方式,為後來預測研究領域中常用之預測方法。嗣後,Chen更提出利用高階模糊時間序列(High-Order Fuzzy Time Series)的預測方法。學者Yu等人則針對模糊時間序列之時間間隔予以調整,以取得更加之預測準確率;學者Liu則以梯形模糊數(trapezoidal fuzzy numbers)為基礎,建立新的預測模型。而在臺股指數預測研究方面,學者Yu與Huarng等人建立雙變量模糊時間序列預測模型進行臺股指數預測;其後,王麗惠、陳錫明教授等人更利用模糊時間序列理論、遺傳學演算法(Genetic Algorithm),及模擬退火演算法(Simulated Annealing algorithm),建立不同模糊預測模型,用以預測溫度及臺股指數。透過模糊時間序列理論應用的演進,我們可以得知「區間的數目(lengths of intervals)」以及「建立的模糊規則(content of forecast rules)」是影響預測準確率的兩大因素,前述幾種習知之預測模型均係利用經驗法則或演化法則來調整此二因素,但是它們的效果仍未令人滿意。The predictive concept of time-fuzzy sequence is the theoretical application of fuzzy theory added to the time series model, which plays an important role in various research fields, such as traffic load estimation, stock market stock price forecast, medical blood pressure. Forecast and so on. In 1993, scholar Song et al first merged fuzzy logic concepts into time series prediction, and proposed a fuzzy time series prediction architecture, which uses fuzzy logic reasoning to effectively deal with semantic data in fuzzy and uncertain environments; through fuzzy time series theory, Song et al. proposed two predictive models (ie, time-varying predictive models and non-time-varying predictive models) and predicted the number of students at the University of Alabama. In 1996, scholar Chen improved the previous prediction method and established a relatively simple prediction model, which has the advantages of reducing the number of calculations and simplifying the calculation method, which is a prediction method commonly used in the field of later prediction research. Later, Chen proposed a prediction method using High-Order Fuzzy Time Series. The scholar Yu et al. adjusted the time interval of the fuzzy time series to obtain a more accurate prediction rate. The scholar Liu built a new prediction model based on the trapezoidal fuzzy numbers. In the research of Taiwan stock index forecasting, scholars Yu and Huarng et al. established a bivariate fuzzy time series forecasting model for Taiwan stock index forecasting. Later, Professor Wang Lihui and Professor Chen Ximing used fuzzy time series theory and genetic algorithm ( Genetic Algorithm), and Simulated Annealing algorithm, establish different fuzzy prediction models to predict temperature and Taiwan stock index. Through the evolution of the application of fuzzy time series theory, we can know that "lengths of intervals" and "content of forecast rules" are the two major factors affecting the accuracy of prediction. The predictive models are known to use empirical rules or evolutionary rules to adjust these two factors, but their effects are still unsatisfactory.
有鑑於此,一種具有高度準確率之臺股指數期貨預測方法是有其必要。In view of this, a high-accuracy Taiwan stock index futures forecasting method is necessary.
鑒於上述先前技術之缺失,本發明提出一種基於粒子群最佳化演算法(Particle Swarm Optimization)及模糊時間序列的臺股指數期貨預測方法,其結合粒子群最佳化演算法與模糊時間序列理論,提出一高準確率之臺股指數期貨預測模型。粒子群最佳化演算法(Particle Swarm Optimization)的理論最早在1995年由Kennedy和Eberhart兩位學者所提出來的,這個靈感主要來自於鳥和魚的群聚行為所得到的。因此這個演算法的精神主要是利用群聚移動的概念在我們的搜尋空間中找尋最佳解。在每次最佳化的運算中,每一個粒子(particle,意指鳥或魚)都各自負責一部分的區域最佳化的參數搜尋,在這搜尋過程中每個粒子都會紀錄目前自己找到的最好的解(Local best),讓在搜尋過程中有個移動的目標。每個粒子除了會往自己目前所找到的最好解之外,也會往目前所有粒子中的最好的解(Global best)作移動,這樣可以使我們找出的解達到全域最佳化的效果。In view of the above-mentioned lack of prior art, the present invention proposes a method based on Particle Swarm Optimization and fuzzy time series for predicting futures index of Taiwan stock index, which combines particle swarm optimization algorithm with fuzzy time series theory. A high-precision Taiwan stock index futures forecasting model is proposed. The theory of Particle Swarm Optimization was first proposed by Kennedy and Eberhart in 1995. The inspiration was mainly derived from the clustering behavior of birds and fish. Therefore, the spirit of this algorithm is mainly to use the concept of clustering and moving to find the best solution in our search space. In each optimization operation, each particle (particle, meaning bird or fish) is responsible for a part of the region-optimized parameter search. During this search, each particle records the most current one. Local best, so that there is a moving target in the search process. In addition to the best solution that we have found so far, each particle will move to the best solution of all current particles (Global best), which will enable us to find solutions that are globally optimized. effect.
本發明一目的係利用粒子群最佳化演算法將「區間的數目(lengths of intervals)」以及「建立的模糊規則(content of forecast rules)」調整到最佳值,有效提升臺股指數期貨預測之準確率。本發明利用粒子群最佳化演算法,基於全部之訓練資料以建立模糊規則;當所有模糊預測規則均訓練建立時,則得以該模糊規則預測新的測試資料,亦即運算出台灣證券市場臺股指數期貨之預測值。One object of the present invention is to use the particle swarm optimization algorithm to adjust the "lengths of intervals" and the "content of forecast rules" to the optimal value, thereby effectively improving the forecast of the Taiwan stock index futures. The accuracy rate. The invention utilizes a particle swarm optimization algorithm to establish fuzzy rules based on all training data; when all fuzzy prediction rules are trained to be established, the fuzzy rules can be used to predict new test data, that is, the Taiwan stock market is calculated. The forecast value of the stock index futures.
本發明的另一目的係提供一種基於臺股指數期貨市場中判斷趨勢以評估市場交易的方法。Another object of the present invention is to provide a method for judging trends in a Taiwan stock index futures market to evaluate market transactions.
本發明的再一目的係提供一種在臺股指數期貨市場中,以預測未來市場趨勢以評估市場交易的方法,來提高獲利能力並降低投資風險。A further object of the present invention is to provide a method for predicting future market trends in the Taiwan stock index futures market to evaluate market transactions to increase profitability and reduce investment risk.
上述目標、特徵及優點將從以下較佳實施例之詳細敘述及所附圖式變得易於明瞭。The above-described objects, features and advantages will be apparent from the following detailed description of the preferred embodiments.
本發明之較佳實施例將參照所附之圖式加以詳細敘述。於圖式中,相同或類似之元件即使描繪於不同之圖式中係仍以相同之參照數字代表。以下敘述中,此處所併入之已知功能及結構之詳細敘述當可能會模糊本發明之標的時係予以省略。The preferred embodiments of the present invention will be described in detail with reference to the appended drawings. In the drawings, the same or similar elements are represented by the same reference numerals even if they are drawn in different drawings. In the following description, the detailed description of the known functions and structures incorporated herein is omitted when it may obscure the subject matter of the present invention.
如第一圖所示,為習知模糊時間序列預測方法流程圖,其步驟如下:As shown in the first figure, it is a flow chart of a conventional fuzzy time series prediction method, and the steps are as follows:
1.於步驟11將歷史資料10予以區間分割及模糊化,定義區間長度,論域的上界及下界,及區間個數:設Dmin 與Dmax 分別為歷史資料中最小與最大值,將該二數值分別減去與加上一適當調整值使論域為[Dmin -U min ,Dmax +U max ],設定區間數目為n,以一常數為組距將論域進行分組分為I 1 ,I 2 ,I 3 ,I 4 ,…,I n 。1. In step 11, segment and blur the historical data 10, define the length of the interval, the upper and lower bounds of the domain, and the number of intervals: Let D min and D max be the minimum and maximum values in the historical data, respectively. The two values are respectively subtracted and added with an appropriate adjustment value so that the domain is [D min - U min , D max + U max ], the number of set intervals is n, and the domain is divided into groups by a constant group. I 1 , I 2 , I 3 , I 4 ,..., I n .
2.於步驟12定義模糊集合(fuzzy set)及模糊關係(fuzzy relationships),建立模糊關係群組:將歷史資料落入的區間資料改寫成以文字表示值的資料,並以模糊集關係求得模糊關係,所推論出的模糊邏輯關係歸為同一群組;其中所有群組可區分為已訓練資料群組及未訓練資料群組。2. In step 12, define a fuzzy set and a fuzzy relationship, and establish a fuzzy relationship group: rewrite the interval data in which the historical data falls into the data represented by the text, and obtain the fuzzy set relationship. Fuzzy relationships, the inferred fuzzy logical relationships are grouped into the same group; all groups can be divided into trained data groups and untrained data groups.
3.於步驟13依模糊關係,建立模糊預測規則:透過前述推論出的模糊邏輯關係群組,建立模糊預測規則;其中包括一符合部分(matching part)及一相應預測值(corresponding forecasted value);該符合部分包括群組之目前狀態(current state),該相應預測值則分別透過估計方案(estimating based on next state scheme,EBN)及母投票(mater voting,MV)方案計算之。3. In step 13, according to the fuzzy relationship, establish a fuzzy prediction rule: establish a fuzzy prediction rule by using the above-mentioned fuzzy logical relationship group; including a matching part and a corresponding forecasted value; The conforming portion includes a current state of the group, and the corresponding predicted values are calculated by an estimating based on next state scheme (EBN) and a mater voting (MV) scheme, respectively.
4.於步驟14依據前述模糊預測規則,預測該訓練、測試資料。4. In step 14, predict the training and test data according to the aforementioned fuzzy prediction rule.
如第二圖所示,其顯示本發明用於預測臺股期貨指數方法之流程圖;本發明係以模糊時間序列預測方法為基礎,結合粒子群最佳化演算法調整「區間的數目(lengths of intervals)」以及「建立的模糊規則(content of forecast rules)」,以提升臺股期貨指數之準確率。於本發明之實施例中,首先於步驟201中,就歷史資料10定義為Y(t),並定義區間個數為n,其論域上界及下界分別為d 0 及d n ,t為歷史資料之時間序列;以具有n -1個元素(element)之一向量(即d 1 ,d 2 ,...,d i ,...,d n -2 及d n -1 ,其中且d i -1 <d i )作為粒子群最佳化演算法之一粒子(particle);於步驟202中,依據該n -1個元素,定義n區間為I 1 =(d 0 ,d 1 ],I 2 =(d 1 ,d 2 ],...,Ii =(d i -1 ,d i ],...,I n -1 =(d n -2 ,d n -1 ]且I n =(d n -1 ,d n ],即依據模糊時間序列理論予以模糊化;於步驟203中,進一步定義每一粒子之模糊集合及模糊關係,建立模糊關係群組;於步驟204中,針對已訓練之模糊預測規則,以次狀態基礎之估計方案(EBN)計算之;於步驟205中,針對未訓練模糊預測規則,以母投票(MV)方案計算。依據步驟204及205之結果,建立每一粒子之模糊預測規則,如步驟206所示。As shown in the second figure, it shows a flow chart of the method for predicting the Taiwan stock futures index according to the present invention; the present invention is based on the fuzzy time series prediction method, and combines the particle swarm optimization algorithm to adjust the number of intervals (lengths Of intervals) and "content of forecast rules" to improve the accuracy of the Taiwan stock futures index. In the embodiment of the present invention, first, in step 201, the historical data 10 is defined as Y(t), and the number of intervals is defined as n, and the upper and lower bounds of the domain are d 0 and d n , respectively. a time series of historical data; with a vector having n - 1 elements (ie, d 1 , d 2 , ..., d i , ..., d n -2 and d n -1 , where And d i -1 < d i ) as one of the particle group optimization algorithms; in step 202, according to the n -1 elements, the n interval is defined as I 1 =( d 0 , d 1 ], I 2 =( d 1 , d 2 ],..., Ii =( d i -1 ,d i ],..., I n -1 =( d n -2 , d n -1 ] and I n = ( d n -1 , d n ], that is, fuzzy according to the fuzzy time series theory; in step 203, further define a fuzzy set and a fuzzy relationship of each particle to establish a fuzzy relationship group; in step 204 For the trained fuzzy prediction rule, calculated by the secondary state based estimation scheme (EBN); in step 205, for the untrained fuzzy prediction rule, calculated by the mother voting (MV) scheme. According to the results of steps 204 and 205 , establish a fuzzy prediction rule for each particle, as shown in step 206.
本發明之一具體實施例於訓練階段中,如步驟207所示,係利用均方差(mean square error,MSE)值代表一粒子之預測準確性,均方差值愈低表示準確率愈高。In a training phase, as shown in step 207, the mean square error (MSE) value is used to represent the prediction accuracy of a particle. The lower the mean squared difference, the higher the accuracy.
於一具體實施例中,該均方差之表示如下:In a specific embodiment, the mean square error is expressed as follows:
其中,N forecasted 表示預測資料數量,FD i 表示i th預測資料,TD i 表示關於FD i 之相對應歷史訓練資料。Where, N forecasted represents the predicted data quantity, FD i represents the i th prediction data, and TD i represents the corresponding historical training data about FD i .
視步驟207之結果,於其結果滿足預先定義之停止條件時,諸如:取得最佳解或達到最大移動步驟,如步驟208所示,則完成預測規則之訓練,選擇所有粒子之最佳解之最佳一者所訓練建構之模糊預測規則作為最終結果,即如步驟211所示。Depending on the result of step 207, when the result satisfies a predefined stop condition, such as: obtaining the best solution or reaching the maximum moving step, as shown in step 208, the training of the prediction rule is completed, and the optimal solution of all particles is selected. The fuzzy prediction rule constructed by the best one is the final result, as shown in step 211.
如步驟209所示,倘步驟207之結果未能滿足停止條件者,則於步驟210中,使每一粒子移動至一新位置,其所相應產生之一新向量之元素應先予調整,以確保每一元素d i ()係於一升冪順序(ascending order)。As shown in step 209, if the result of step 207 fails to satisfy the stop condition, then in step 210, each particle is moved to a new position, and the element corresponding to the new vector is first adjusted to Make sure each element d i ( ) is tied to an ascending order.
本發明之一具體實施例於訓練階段中,將所有粒子移動至其他位置。一粒子之運動方式係表示如下:One embodiment of the present invention moves all particles to other locations during the training phase. The movement of a particle is expressed as follows:
V id =ω×V id +C 1 ×Rand ()×(P id -X id )+C 2 ×Rand ()×(P gbest -X id ) (2) V id = ω × V id + C 1 × Rand () × ( P id - X id ) + C 2 × Rand () × ( P gbest - X id ) (2)
X id =X id +V id (3) X id = X id + V id (3)
其中V id 係表示一粒子id之速率,其速率限於[-V MAX ,V MAX ]之預先自定義範圍中;ω係表示慣性權重值係數(inertial weight coefficient);C 1 與C 2 分別表示自信程度係數(self confidence coefficient)及社會信心程度係數(social confidence coefficient)。Where V id is the rate of a particle id, the rate is limited to the pre-custom range of [- V MAX , V MAX ]; ω is the inertial weight coefficient; C 1 and C 2 respectively represent self-confidence Self confidence coefficient and social confidence coefficient.
於粒子群最佳化演算法中,於整個運作程序裡,ω值係為線性遞減,C 1 與C 2 為常數,Rand ()係一亂數產生器(Random Number Generator),其於正常分布之下,得於0到1間產生一隨機實數。X id 與P id 係分別表示一粒子id 之現在位置與資料範圍內之最佳解;P gebst 係表示全部粒子在全部資料範圍內之最佳解。In the particle swarm optimization algorithm, in the whole operation program, the ω value is linearly decreasing, C 1 and C 2 are constant, and Rand () is a Random Number Generator, which is normally distributed. Below, a random real number is generated between 0 and 1. P and X-id id id lines represent the optimal solution of the present position data range of a particle; P gebst line represents the optimal solution in all of the particles within the full range of information.
本發明之一具體實施例於訓練階段中,係利用每一粒子表示之區間,以模糊時間序列理論建構模糊預測規則之獨立群組,並用來預測每一粒子之所有歷史訓練資料。In a training phase, an embodiment of the present invention constructs an independent group of fuzzy prediction rules by using fuzzy time series theory in the training stage, and uses it to predict all historical training data of each particle.
本發明之一具體實施例於訓練階段中,係使所有粒子移動至一新位置,其運動方式之依據係以方程式(2)、(3)表示,並依方程式(1)進行上述評估所有粒子預測準確性,且循環步驟203到207直至滿足預先定義之停止條件,諸如:取得最佳解或達到最大移動步驟。倘若該停止條件滿足,如步驟208所示,即選擇所有粒子之最佳解之最佳一者所訓練建構之模糊預測規則作為最終結果。若該停止條件未滿足者,則循環步驟203到207,直至滿足預先定義之停止條件,並選擇所有粒子之最佳解之最佳一者所訓練建構之模糊預測規則作為最終結果。In an embodiment of the present invention, all particles are moved to a new position in the training phase, and the basis of the motion is expressed by equations (2) and (3), and all the particles are evaluated according to equation (1). The accuracy is predicted, and steps 203 through 207 are cycled until a predefined stop condition is met, such as: obtaining an optimal solution or reaching a maximum moving step. If the stop condition is satisfied, as shown in step 208, the fuzzy prediction rule constructed by the best one of the best solutions of all particles is selected as the final result. If the stop condition is not satisfied, then steps 203 through 207 are cycled until the predefined stop condition is met, and the fuzzy prediction rule trained by the best one of the best solutions of all particles is selected as the final result.
本發明之一具體實施例於測試階段中,如步驟212所示,係使用所有粒子之最佳解之最佳一者所訓練建構之模糊預測規則以預測新測試資料。首先,若該新測試資料之相應符合之部分如果符合一已經訓練之模糊預測規則,則依模糊預測規則計算其預測值。One embodiment of the present invention, in the test phase, as shown in step 212, uses the fuzzy prediction rules constructed by the best of the best solutions for all particles to predict new test data. First, if the corresponding part of the new test data conforms to an already trained fuzzy prediction rule, the predicted value is calculated according to the fuzzy prediction rule.
若該新測試資料之相應符合之部分如果符合一未經訓練之模糊預測規則,則以母投票(MV)方案對該新測試資料進行預測;如非前述情況者,該新測試資料之預測係以符合之模糊預測規則進行之。其中母投票(MV)方案依下述方程式計算其預測值:If the corresponding part of the new test data meets an untrained fuzzy prediction rule, the new test data is predicted by the mother voting (MV) scheme; if not, the prediction system of the new test data is It is carried out in accordance with the fuzzy prediction rules. The mother voting (MV) scheme calculates its predicted value according to the following equation:
其中,W h 表示用戶預設最高票數,λ 指模糊關係級數,m t1 與m tk ()表示於目前狀態(current state)下最新過去文字表示值及其他過去文字表示值對應區間之中點。Where W h represents the user's preset maximum number of votes, λ refers to the fuzzy relationship series, m t1 and m tk ( ) indicates the current past text representation value in the current state and the point in the corresponding interval of other past text representation values.
為便於闡釋本發明,本發明之一具體實施例,係以1998年8月3日到8月31日之臺股指數期貨市場情形為例示。首先,為了便於說明,爰就1998年8月3日到8月31日臺股指數期貨市場交易歷史資料中例假設粒子個數為5,每一粒子分別定義為具7個區間之一獨立群組,亦即I 1 =(b 0 ,b 1 ]、I 2 =(b 1 ,b 2 ]、I 3 =(b 2 ,b 3 ]、I 4 =(b 3 ,b 4 ]、I 5 =(b 4 ,b 5 ]、I 6 =(b 5 ,b 6 ]、I 7 =(b 6 ,b 7 ];其所示數據僅為簡單說明本發明之例示,非為列舉;該歷史資料Y (t )如下所示:In order to facilitate the explanation of the present invention, a specific embodiment of the present invention is exemplified by the situation of the Taiwan stock index futures market from August 3 to August 31, 1998. First of all, for the convenience of explanation, the case of the transaction history data of the Taiwan stock index futures market from August 3 to August 31, 1998 assumes that the number of particles is 5, and each particle is defined as an independent group with 7 intervals. Group, ie I 1 =( b 0 , b 1 ], I 2 =( b 1 , b 2 ], I 3 =( b 2 , b 3 ], I 4 =( b 3 , b 4 ], I 5 =( b 4 , b 5 ], I 6 =( b 5 , b 6 ], I 7 =( b 6 , b 7 ]; the data shown is merely illustrative of the invention, not enumerated; The data Y ( t ) is as follows:
其中該資料最大值與最小值分別為D m in =6566及D max =7560,經調整後Y (t )之論域以Y (t )=(6500,7600]表示。The maximum and minimum values of the data are D m in =6566 and D max =7560, respectively. The adjusted Y ( t ) domain is represented by Y ( t )=(6500,7600].
又為便於闡述本發明,爰以建構粒子1之模糊規則為例示,關於其他粒子之模糊規則建立於一般熟知該項技術領域人士均得藉由本發明揭露之具體實施例予以具體實施之。於本實施例中,假設5個粒子中之粒子1之7個區間,分別為I 1 =(6500,6657]、I 2 =(6657,6814]、I 3 =(6814,6971]、I 4 =(6971,7128]、I 5 =(7128,7285]、I 6 =(7285,7442]以及I 7 =(7442,7600],惟應予說明,本實施例所示數據僅為簡單說明本發明之例示,非為列舉,自不以之為限。In order to facilitate the description of the present invention, the fuzzy rules for constructing the particles 1 are exemplified, and the fuzzy rules for the other particles are established by those skilled in the art and are specifically embodied by the specific embodiments disclosed herein. In this embodiment, it is assumed that seven intervals of the particles 1 of the five particles are I 1 = (6500, 6657], I 2 = (6657, 6814), I 3 = (6814, 6971), I 4 = (6971, 7128), I 5 = (7128, 7285), I 6 = (7285, 7442), and I 7 = (7442, 7600), but it should be noted that the data shown in this embodiment is only a brief description. The examples of the invention are not listed, but are not limited thereto.
又,將粒子中Y (t )之論域區分為7個區間,分別以A 1 =”worst”、A 2 =”bad”、A 3 =”a little bad”、A 4 =”average”,A 5 =”good”、A 6 =”very good”,以及A 7 =”excellent”之文字表示值,並以下述方程式(5)分別表示為一模糊集合。Also, the domain of Y ( t ) in the particle is divided into seven intervals, respectively, A 1 = "worst", A 2 = "bad", A 3 = "a little bad", A 4 = "average", A 5 = "good", A 6 = "very good", and A 7 = "excellent" text representation values, and are represented as a fuzzy set by equation (5) below, respectively.
A i =I 1 /u 1 +I 2 /u 2 +I 3 /u 3 +I 4 /u 4 +I 5 /u 5 +I 6 /u 6 +I 7 /u 7 (5) A i = I 1 / u 1 + I 2 / u 2 + I 3 / u 3 + I 4 / u 4 + I 5 / u 5 + I 6 / u 6 + I 7 / u 7 (5)
其中u j ()係為介於1到0之間的實數。Where u j ( ) is a real number between 1 and 0.
其模糊集合與區間對照表示如下:The fuzzy set and the interval comparison are expressed as follows:
據此,歷史資料經模糊化之結果如下表所示:Accordingly, the results of the obscuring of historical data are shown in the following table:
其次,本實施例建立一λ 級模糊關係,以(F (t -λ ),F (t -λ +1),…,F (t -2),F (t -1))表示「目前狀態(current state)」,F (t )表示「次狀態(next state)」,其模糊關係以(F (t -λ ),F (t -λ +1),…,F (t -2),F (t -1))→F (t )為表示;便於闡述本發明,本實施例設定該λ 級模糊關係中λ =3,惟其所示數據僅為簡單說明本發明之例示,非為列舉;舉例來說,模糊關係(A 7 ,A 7 ,A 7 )→A 7 即為(F (8/3/1998),F (8/4/1998),F (8/5/1998))→F (8/6/1998)。Secondly, the present embodiment establishes a lambda -level fuzzy relation, and ( F ( t - λ ), F ( t - λ +1), ..., F ( t -2), F ( t -1)) represents the current state. (current state)", F ( t ) means "next state", and its fuzzy relation is ( F ( t - λ ), F ( t - λ +1),..., F ( t -2), F ( t -1)) → F ( t ) is a representation; for convenience of explaining the present invention, this embodiment sets λ = 3 in the λ -level fuzzy relation, but the data shown is merely an illustration of the present invention, not enumerated For example, the fuzzy relationship ( A 7 , A 7 , A 7 ) → A 7 is ( F (8/3/1998), F (8/4/1998), F (8/5/1998)) → F (8/6/1998).
於此,模糊關係如下表所示:Here, the fuzzy relationship is shown in the following table:
其中(A 2 ,A 2 ,A 1 )→#係指(F (8/28/1998),F (8/29/1998),F (8/31/1998))→F (9/1/1998),而F (9/1/1998)係未列出之資料,故以#為標記。又,前述列表中,每一群組即包含一個以上的模糊關係;本實施例依據前述列表之模糊關係,建立模糊預測規則。模糊預測規則係由一符合部分(matching part)及相應預測值(corresponding forecasted value)組成,前者係由群組之目前狀態構成;後者之計算則區分已訓練和未訓練之部分,已訓練部分係以次狀態基礎之估計方案(estimating based on next state scheme,EBN)計算之,未訓練之部分則以母投票(mater voting,MV)方案計算之。關於後續狀態基礎之估計方案(EBN),係將每一相應區間再區分為三等份的次區間,依據下述方程式(6)計算取得一預測值:Where ( A 2 , A 2 , A 1 )→# refers to ( F (8/28/1998), F (8/29/1998), F (8/31/1998))→ F (9/1/ 1998), while F (9/1/1998) is not listed, so it is marked with #. Moreover, in the foregoing list, each group contains more than one fuzzy relationship; in this embodiment, a fuzzy prediction rule is established according to the fuzzy relationship of the foregoing list. The fuzzy prediction rule is composed of a matching part and a corresponding forecasted value. The former is composed of the current state of the group; the latter calculation distinguishes the trained and untrained parts, and the trained part is Calculated by the estimating based on next state scheme (EBN), the untrained part is calculated by the mater voting (MV) scheme. For the follow-up state basis estimation scheme (EBN), each corresponding interval is further divided into three equal intervals, and a predicted value is obtained according to the following equation (6):
其中,n 表示同群組中次狀態(next state)總數,mid k ( )表示關於次狀態數k 對應區間之中點(midpoint),submid k 表示次狀態數k 對應區間中三個次區間之一者的中點。以上表群組4為例,僅一次狀態A 6 ,並依次狀態基礎之估計方案(EBN)等分區間I 6 (即(7285,7442])為三個次區間,分別為SR 6,1 =(7285,7337.3]、SR 6,2 =(7337.3,7389.6]和SR 6,3 =(7389.6,7442]。依前述群組2係取自模糊關係(F (8/6/1998),F (8/7/1998),F (8/10/1998))→F (8/11/1998);依次狀態基礎之估計方案(EBN)得知F (8/11/1998)對應實際資料Y (8/11/1998)(即7360)係落於次區間SR 6,2 ,該次區間中點submid 6 係7363.45(即7337.3+(7389.6-7337.3)/2);據此,以SR 6,2 之中點與區間I 6 中點mid 6 之平均值,並根據前述方程式,計算得知群組2之預測值為7363.475。Where n represents the total number of next states in the same group, mid k ( ) Represents the number of states times on the corresponding section among the k point (midpoint), submid k represents k times the number of states corresponding to the midpoint of the interval of three sub-interval by one. For example, the above table group 4 is only one state A 6 , and the inter-partition I 6 (ie (7285, 7442)) such as the state-based estimation scheme (EBN) is three sub-intervals, respectively SR 6,1 = (7285, 7337.3), SR 6 , 2 = (7337.3, 7389.6) and SR 6, 3 = (7389.6, 7442). According to the aforementioned group 2 is taken from the fuzzy relationship ( F (8/6/1998), F ( 8/7/1998), F (8/10/1998))→ F (8/11/1998); the order-based estimation scheme (EBN) knows that F (8/11/1998) corresponds to the actual data Y ( 8/11/1998) (ie 7360) is in the sub-interval SR 6,2 , and the submid 6 is 7363.45 (ie 7337.3+(7389.6-7337.3)/2) in this interval; accordingly, SR 6,2 among point interval I 6 6 average mid midpoint of, and in accordance with the equation that calculates the value of the group 2 7363.475 prediction.
針對未訓練部分,利用母投票(mater voting,MV)方案預測計算之;以上表群組14為例,依方程式(4)計算,設定W h =2,最新過去文字表示值A 1 之最高投票數為2,其餘文字表示值A 2 與A 2 之投票述各為1,則上表群組14之預測值計算如下:For the untrained part, the mater voting (MV) scheme is used to predict the calculation; the above table group 14 is taken as an example, and is calculated according to the equation (4), setting W h = 2, and the latest past text indicates the highest vote of the value A 1 The number is 2, and the remaining words indicate that the votes of the values A 2 and A 2 are each 1, and the predicted values of the group 14 of the above table are calculated as follows:
依據前數表列結果,可得出相關模糊預測規則;其中,一模糊預測規則包括一符合部分(Matching Part)及一預測部分(Forecasting Part);符合部分係同群組模糊關係之目前狀態,預測部分係預測值部分,本實施例所得模糊預測規則如下表所示:According to the results of the previous table, the relevant fuzzy prediction rules can be obtained. Among them, a fuzzy prediction rule includes a matching part and a prediction part; the current state of the part-group fuzzy relationship is met. The prediction part is the prediction value part. The fuzzy prediction rule obtained in this embodiment is shown in the following table:
據此,本實施例就1998年8月3日到8月31日之臺股指數期貨市場之歷史資料,所得預測值如下表所示:Accordingly, the historical data of the Taiwan Stock Index Futures Market from August 3 to August 31, 1998 in this example, the predicted values are as follows:
以上係本發明之一具體實施例,以假設之5個粒子中之粒子1為例示,建構粒子1之模糊規則;據此,關於其他粒子模糊規則之建立於一般熟知該項技術領域人士均得藉由本發明上述揭露之具體實施例予以具體實施之。The above is a specific embodiment of the present invention, and the particle 1 of the assumed five particles is taken as an example to construct the fuzzy rule of the particle 1; accordingly, the establishment of other particle fuzzy rules is generally known to those skilled in the art. It is embodied by the specific embodiments of the above disclosed embodiments of the present invention.
依據上述列表之結果,於前述方程式(2)、(3)中,乃使X id 限於(6500,7600],V id 限於[-50,50],C 1 與C 2 為2,而ω為1.4,並依據方程式(1)計算每一粒子之均方差;則各該5個粒子之隨機起始位置與均方差如下表所示:According to the results of the above list, in the above equations (2) and (3), X id is limited to (6500, 7600), V id is limited to [-50, 50], C 1 and C 2 are 2, and ω is 1.4, and calculate the mean square error of each particle according to equation (1); then the random starting position and mean square error of each of the five particles are as shown in the following table:
各該5個粒子之隨機起始速率如下表所示:The random starting rates of the five particles are shown in the following table:
基於前述對於每一粒子之7個區段的假設,本實施例得以前述表列之模糊預測規則進行預測;惟就一般熟知系爭技術領域人士應可知悉,對於粒子有不同之定義者,則模糊預測規則之選擇非以前述表列數據為限。Based on the foregoing assumptions for the seven segments of each particle, the present embodiment is predicted by the fuzzy prediction rules listed above; however, it should be known to those skilled in the art that if there are different definitions for particles, The choice of fuzzy prediction rules is not limited to the data in the above table.
據此,舉例來說,依方程式(1)、(2)、(3)可計算得粒子1之均方差(MSE)值,如下式計算:Accordingly, for example, the mean square error (MSE) value of the particle 1 can be calculated according to equations (1), (2), and (3), and is calculated as follows:
其中,預測資料數量N forecasted 為20,FD i ()表示Y (8/5/1998+i )之預測值;TD i 表示關於FD i 之相應歷史訓練資料(即Y (8/5/1998+i ))。應注意,FD 21 表示新測試資料(即Y (9/1/1998))之預測值,因而於本例示中未用以計算粒子1之均方差(MSE)值。Among them, the forecasted data quantity N forecasted is 20, FD i ( ) indicates the predicted value of Y (8/5/1998+ i ); TD i represents the corresponding historical training material for FD i (ie Y (8/5/1998+ i )). It should be noted that FD 21 represents the predicted value of the new test data (i.e., Y (9/1/1998)) and thus is not used in this illustration to calculate the mean square error (MSE) value of particle 1.
經前開之計算,本實施例之每一粒子均可得出其所屬均方差,並據以取得每一粒子之目前最佳位置;如下表所示:According to the calculation of the pre-opening, each particle of the embodiment can obtain the mean square error, and obtain the current optimal position of each particle according to the following table;
其中,依上表所示,本實施例之全部5個粒子在全部資料範圍內之目前最佳解(即方程式(1)之P gebst ),係為粒子4(因其均方差值最小)。其後,再依方程式(1)、(2)調整全部粒子至第二位置,並依方程式(3)取得相關位置之均方差值;依本實施例所例示之歷史資料經計算,第二位置與其均方差值表列如下:According to the above table, the current optimal solution of all five particles in the present embodiment in the entire data range (ie, P gebst of equation (1)) is particle 4 (since the mean squared difference is the smallest) . Thereafter, all the particles are adjusted to the second position according to equations (1) and (2), and the mean square difference of the relevant position is obtained according to equation (3); the historical data exemplified in the embodiment is calculated, and the second The location and its mean squared difference table are as follows:
依上表所示,本實施例之全部粒子在全部資料範圍內之目前最佳解(即方程式(1)之P gebst ),仍係粒子4。於此,本實施例仍得依據前述步驟,以方程式(1)、(2)調整全部粒子至第三位置,並依方程式(3)取得相關位置之均方差,並依上開步驟循環計算,直至滿足停止條件。當停止條件滿足時,即表示預測規則已完成訓練,藉由已完成訓練之預測規則,進行測試資料預測。As shown in the above table, the current best solution of all particles in this example in the entire data range (i.e., P gebst of equation (1)) is still particle 4. Here, in the embodiment, according to the foregoing steps, all the particles are adjusted to the third position by the equations (1) and (2), and the mean square error of the relevant position is obtained according to the equation (3), and the cycle is calculated according to the upper step. Until the stop condition is met. When the stop condition is satisfied, it means that the prediction rule has been completed, and the test data is predicted by the prediction rule of the completed training.
依據本發明之一具體實施例,乃藉由模糊時間序列理論與粒子群最佳化演算法,有效提升對於臺股指數期貨預測之準確率。以本發明之一具體實施例與其他先前技術之預測結果對照,本發明對於臺股指數期貨預測有更高之準確率,其中本發明係為16區間之三級模糊關係,預測結果如下表所示:According to an embodiment of the present invention, the accuracy of the prediction of the Taiwan stock index futures is effectively improved by the fuzzy time series theory and the particle swarm optimization algorithm. In comparison with the prediction results of other prior art embodiments of the present invention, the present invention has a higher accuracy rate for the prediction of the Taiwan stock index futures, wherein the present invention is a three-level fuzzy relationship of 16 intervals, and the prediction results are as follows: Show:
其中,上表所列之先前技術分別為:Linear model :y =-27.348x +7509Polynomial model of degree 2:y =1.2779x 2 -75.907x+7824.6Polynomial model of degree 3:y =0.1247x3 -5.8308x2 +33.592x+7454.9Moving average model :period =3由此可知,本發明相較於習知技術之臺股指數期貨預測有更高之準確率。Among them, the previous technologies listed in the above table are: Linear model : y =-27.348 x +7509 Polynomial model of degree 2: y =1.2779 x 2 -75.907x+7824.6 Polynomial model of degree 3: y =0.1247x 3 - 5.8308x 2 +33.592x+7454.9 Moving average model : period = 3 It can be seen that the present invention has a higher accuracy rate than the conventional stock index futures forecast.
從以上敘述,此領域之技藝者將得以領會,本發明之特定實施例係只為說明之目的敘述於此而非用以限制本發明。然而,具有此領域之通常知識之技藝者在不脫離本發明之精神及範圍下可做若干修改。因此,本發明除後附申請專利範圍之外係不受限。From the above, it will be appreciated by those skilled in the art that the present invention is described herein for the purpose of illustration only. However, a person skilled in the art can make a number of modifications without departing from the spirit and scope of the invention. Accordingly, the invention is not limited except in the scope of the appended claims.
10...歷史資料10. . . Historical data
201...定義粒子個數程序201. . . Define the number of particles program
202...設定粒子區間並模糊化程序202. . . Set particle interval and blur program
203...模糊關係群組建立程序203. . . Fuzzy relationship group establishment procedure
204...次狀態基礎估計方案計算程序204. . . Secondary state basic estimation scheme calculation program
205...母投票方案計算程序205. . . Parent voting scheme calculation program
206...粒子模糊預測規則建立程序206. . . Particle fuzzy prediction rule establishment program
207...均方差計算程序207. . . Mean variance calculation program
208...停止條件達成208. . . Stop condition reached
209...停止條件未達成209. . . Stop condition not reached
210...粒子位置移動程序210. . . Particle position shift program
211...預測規則完成訓練211. . . Prediction rule completion training
212...測試資料預測程序212. . . Test data prediction program
本發明之較佳實施例將於以下敘述及所附圖式得到進一步之說明,其中:The preferred embodiment of the present invention will be further described in the following description and the accompanying drawings, in which:
第一圖係為先前技術之習用模糊時間序列預測方法之流程圖。The first diagram is a flow chart of a prior art conventional fuzzy time series prediction method.
第二圖係為根據本發明之預測方法之流程圖。The second figure is a flow chart of the prediction method according to the present invention.
10...歷史資料10. . . Historical data
201...定義粒子個數程序201. . . Define the number of particles program
202...設定粒子區間並模糊化程序202. . . Set particle interval and blur program
203...模糊關係群組建立程序203. . . Fuzzy relationship group establishment procedure
204...次狀態基礎估計方案計算程序204. . . Secondary state basic estimation scheme calculation program
205...母投票方案計算程序205. . . Parent voting scheme calculation program
206...粒子模糊預測規則建立程序206. . . Particle fuzzy prediction rule establishment program
207...均方差計算程序207. . . Mean variance calculation program
208...停止條件達成208. . . Stop condition reached
209...停止條件未達成209. . . Stop condition not reached
210...粒子位置移動程序210. . . Particle position shift program
211...預測規則完成訓練211. . . Prediction rule completion training
212...測試資料預測程序212. . . Test data prediction program
Claims (6)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW98113806A TWI399699B (en) | 2009-04-24 | 2009-04-24 | Forecasting taifex based on particle swarm optimization |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW98113806A TWI399699B (en) | 2009-04-24 | 2009-04-24 | Forecasting taifex based on particle swarm optimization |
Publications (2)
Publication Number | Publication Date |
---|---|
TW201039264A TW201039264A (en) | 2010-11-01 |
TWI399699B true TWI399699B (en) | 2013-06-21 |
Family
ID=44995409
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW98113806A TWI399699B (en) | 2009-04-24 | 2009-04-24 | Forecasting taifex based on particle swarm optimization |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI399699B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102622496B (en) * | 2011-01-26 | 2016-07-06 | 中国科学院大气物理研究所 | A kind of adaptive multi-step forecasting procedure embedding fuzzy set state and system |
CN105185106B (en) * | 2015-07-13 | 2017-07-04 | 丁宏飞 | A kind of road traffic flow parameter prediction method based on Granule Computing |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070263900A1 (en) * | 2004-08-14 | 2007-11-15 | Swarup Medasani | Behavior recognition using cognitive swarms and fuzzy graphs |
-
2009
- 2009-04-24 TW TW98113806A patent/TWI399699B/en not_active IP Right Cessation
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070263900A1 (en) * | 2004-08-14 | 2007-11-15 | Swarup Medasani | Behavior recognition using cognitive swarms and fuzzy graphs |
Non-Patent Citations (2)
Title |
---|
吳淑芳, 模糊時間序列在台股加權指數日內交易之預測, 吳淑芳, 中華民國九十三年六月。 * |
許書瑤, 結合粒子群最佳化演算法與支援向量回歸於財務時間序列預測模式之建構-以日晶225指數及台灣加權股價指數為例, 許書瑤, 中華民國九十六年八月。 * |
Also Published As
Publication number | Publication date |
---|---|
TW201039264A (en) | 2010-11-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Ding et al. | Forecasting China's electricity consumption using a new grey prediction model | |
Khosravi et al. | Construction of optimal prediction intervals for load forecasting problems | |
Cheng et al. | Interval estimation of construction cost at completion using least squares support vector machine | |
CN107609289A (en) | The building material cost management-control method and system of structural fortification based on BIM models | |
CN104408518B (en) | Based on the neural network learning optimization method of particle swarm optimization algorithm | |
Tang et al. | Building material prices forecasting based on least square support vector machine and improved particle swarm optimization | |
CN116562514B (en) | Method and system for immediately analyzing production conditions of enterprises based on neural network | |
Yu et al. | An active construction dynamic schedule management model: using the fuzzy earned value management and BP neural network | |
Khairina et al. | Comparison of the trend moment and double moving average methods for forecasting the number of dengue hemorrhagic fever patients | |
Chen | Applying the hybrid fuzzy c-means-back propagation network approach to forecast the effective cost per die of a semiconductor product | |
Wang et al. | Multi-agent simulation for strategic bidding in electricity markets using reinforcement learning | |
Hyndman | Forecasting: An Overview. | |
TWI399699B (en) | Forecasting taifex based on particle swarm optimization | |
Sun et al. | DSM pricing method based on A3C and LSTM under cloud-edge environment | |
Chen et al. | A fuzzy back propagation network ensemble with example classification for lot output time prediction in a wafer fab | |
CN104408317A (en) | Metallurgy enterprise gas flow interval predicting method based on Bootstrap echo state network integration | |
Yundra et al. | Hybrid Model Combined Fuzzy Multi-Objective Decision Making with Feed Forward Neural Network (F-MODM-FFNN) For Very Short-Term Load Forecasting Based on Weather Data. | |
CN116681157A (en) | Power load multi-step interval prediction method based on prediction interval neural network | |
CN110991693A (en) | Load price-quantity curve aggregation system considering uncertainty of electricity purchase cost | |
Eya et al. | Improved medium term approach for load forecasting of Nigerian electricity network using artificial neuro-fuzzy inference system: a case study of University of Nigeria, Nsukka | |
Zhang et al. | Quantile huber function guided TCN for short-term consumer-side probabilistic load forecasting | |
Elahe et al. | An adaptive and parallel forecasting strategy for short-term power load based on second learning of error trend | |
Cuadrado-Garcia et al. | Improve tracking in the software development projects | |
Wang | Notice of Retraction: GM (1, 2) forecasting method for day-ahead electricity price based on moving average and particle swarm optimization | |
Li et al. | Is entropy an indicator of port traffic predictability? The evidence from Chinese ports |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
MM4A | Annulment or lapse of patent due to non-payment of fees |