-
Notifications
You must be signed in to change notification settings - Fork 0
/
section_Proposed_Method_label_proposed__.tex
110 lines (55 loc) · 11.6 KB
/
section_Proposed_Method_label_proposed__.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
\section{Proposed Method}
\label{proposed-method}
\subsection{Dataset}
\label{dataset}
The dataset used in this work was first used by Brown, Pelosi, and Dirska \cite{brown2013dynamic}, and can be found at the UCI Machine Learning Repository (https://archive.ics.uci.edu/ml/) under the name of "Dow Jones Index Data Set." In this work we only used the Open, High, Low, and Close prices, and we obtained the Average Directional Index (ADX), Stochastic Oscillator (SO), and Relative Strength Index (RSI) for the dataset records by using an online tool called FreeStockCharts located at the URL http://www.freestockcharts.com/. Basically, we added the Technical Indicators to the stocks provided in the dataset by Brown et al. using FreeStockCharts, and downloaded the full historical data from the platform. Then, a filtering was performed where only the relevant records were extracted (the same records that are present in the benchmarking dataset).
As a final step, another attribute was added to the dataset, which the authors of this work call "Directional Strength." Basically, this attribute tells how strong a movement was at a particular time in a time-series, and what its direction was (downtrend or uptrend). An absolute value of 100 of the Directional Strength means that it was a very strong movement, where all the traders in that financial market agree to buy or sell, where a value of 0 means strong indecision (and, for example, a Candlestick Pattern called Doji could arise). This Directional Strength indicator could have already been mentioned in the literature, but the authors of this work couldn't find a reference to this particular formula. The formula to calculate the Directional Strength is as follows:
\begin{equation} \label{directional-strength}
DS(t) = 100{{C(t) - O(t)} \over {H(t) - L(t)}}
\end{equation}
Where \textit{t} represents a particular point of time in the time-series, O represents the Open price, H the High, L the Low, and C the Close price.
\subsection{Decision Support System}
The final outcome of the Proposed Method is a recommendation to buy, sell or hold in a financial market. The system tells the user the direction which the market is going to take (downtrend or uptrend) and its strength, through the use of the Directional Strength indicator (see Subsection \ref{dataset}).
Nevertheless, the underlying method can be used to perform regression tasks, and it could be extended to perform classification tasks in a future work. What follows is the explanation of this underlying method.
\subsection{Communities of Agents}
\label{communities-of-agents}
As has been noted before, the Proposed Method is based on Agent-based Modeling (ABM). To implement a system based on ABM, the method developed the concept of a Community of agents. A Community is a collection of agents, who are the final actuators in the environment (the simulated financial market). The action of each of the agents in the community involves in providing certain "strength", which is a value between -100 and 100. The sum of all of the forces of the agents in a Community must be equal to the observed or real Directional Strength indicator for a particular record in the dataset. A Community receives its inputs, which are the Technical Indicators ADX(\textit{t}), SO(\textit{t}), and RSI(\textit{t}), and give as output the DS(\textit{t+1}) (the Directional Strength of a future record).
The method creates several Communities, which exchange genetic material of its agents among them, in order to produce better performing Communities, and their fitness is determined using a sum of the Mean-Squared Error and the absolute value of the sum of the strengths of its agents. The use of this summation was determined to be a good fitness indicator by trial and error, but other fitness functions could be used.
\subsection{Fuzzy Inference Systems}
Each of the agents in the Comunnities has a Fuzzy Inference System (FIS) that acts as its agent function. The inputs of this FIS, as has been mentioned before, are the ADX, SO, and RSI Technical Indicators. The output is a real number between -100 and 100 that represents the Directional Strength (DS). To arrive to this output number, one can choose a number of Membership Functions (MF) that act as inputs and a number of MF that act as outputs. By trial and error, the authors found that a number of 5 outputs gave really good results in most cases. As these MF are generated by a GP algorithm, they do not really have an human understandable interpretation. The FIS just defuzzifies the aggregation of the MF at their activation level determined by its inputs, and this will represent a DS for that particular agent.
The rule set is depicted below, and is comprised of 15 rules: 5 outputs for each of the 3 Technical Indicators.
\begin{enumerate}
\item if ADX is GPpred1 then DS is GPcons1
\item if ADX is GPpred2 then DS is GPcons2
\item if ADX is GPpred3 then DS is GPcons3
\item if ADX is GPpred4 then DS is GPcons4
\item if ADX is GPpred5 then DS is GPcons5
\item if RSI is GPpred6 then DS is GPcons6
\item if RSI is GPpred7 then DS is GPcons7
\item if RSI is GPpred8 then DS is GPcons8
\item if RSI is GPpred9 then DS is GPcons9
\item if RSI is GPpred10 then DS is GPcons10
\item if SO is GPpred11 then DS is GPcons11
\item if SO is GPpred12 then DS is GPcons12
\item if SO is GPpred13 then DS is GPcons13
\item if SO is GPpred14 then DS is GPcons14
\item if SO is GPpred15 then DS is GPcons15
\end{enumerate}
\subsubsection{Genetic Programming}
In order to create the MF of agents' FIS, a GP algorithm performs a number of operations among the initially generated Communities. These operations are the classical crossover and mutation operations, along with two new operations: migration and replace. The crossover operation simply chooses a subtree of the GP function of the \textit{i}th agent from a Community A, and passes it to the GP function of the \textit{i}th agent from a Community B. A subtree from the Community B is passed to the GP function of the \textit{i}th agent. As a result, two new agents are generated and replace the old agents. To determine what Communities are to be crossed over, a tournament is held where two random Communities are chosen from the population, and the one with the lowest MSE plus the absolute value of the sum of forces (as explained is Subsection \ref{communities-of-agents} is chosen; this will obtain the first Community. This process is repeated to obtain a second Community. As for the mutation operation, a subtree from a Community A is selected and randomly changed to produce a new GP function. The Community to be mutated is randomly selected from the population.
The migration operation is a rather simple one. According to a migration chance, an agent from a Community A will get interchanged with another agent from a Community B. In order to determine if this interchange is to be performed, the algorithm sees if the sum of the forces of Community A is of different sign than the sum of forces of Community B. This ensures that the migration will produce a Community closer to a zero-sum (the Community will be closer to the observed or real prices). As for the replace operation, a whole new Community is generated and replaces the Community with the highest absolute value of the MSE plus sum of forces. All the four operations have a pre-established chance of occurring (except for the replace chance, which is currently being dynamically adapted by using a FIS. See Subsection \ref{dynamic-adaptation-of-the-replace-chance}). One can see a flowchart of the general process in Figure \ref{flowchart-without-dynamic}.
In addition to this set of operations, the GP algorithm uses the parameters of population size (in this case, the number of Communities), the number of agents per Community, the number of generations, how many inputs the agents will process (in this case, the Technical Indicators), and how many outputs (which, in the end, as has been noted previously, get defuzzified into a Directional Strength value).
The generation of the Membership Functions (MF) is a novel or, at least uncommon, method (the authors of this work could not find any works that use this specific technique). The GP algorithm uses a sum of sines to produce functions that are converted to the MF of the FIS of the agents. An example of the functions which represent these MF are depicted in Figure \ref{sum-of-sines-mfs}, and a graphical representation of an input MF and an output MF are depicted in Figure \ref{input-mf} and Figure \ref{output-mf}, respectively. This means that the GP algorithm uses only two operators: the sum and the sine operators. The sum of sines is represented by the Formula \ref{sum-of-sines}.
\begin{equation} \label{sum-of-sines}
y = \sum_{i=1}^{n} a_{i} sin(b_{i}x + c_{i})
\end{equation}
Taking into consideration Formula \ref{sum-of-sines}, the GP algorithm uses the following literals set: \textit{a}, \textit{b}, and \textit{c} are random real numbers, where \textit{a} ranges from 0.0 to 0.3, \textit{b} ranges from 0.0 to 10.0, and \textit{c} ranges from 0.0 to 1.0. These ranges were obtained by trial and error, and other ranges could perform better. An additional real number literal is added to the set, which ranges from -1 to 1, along with the variable \text{x}, which takes the value of the current input (ADX, RSI or SO).
\subsection{Dynamic Adaptation of the Replace Chance}
\label{dynamic-adaptation-of-the-replace-chance}
The replace chance parameter, instead of being constant, is dynamically adapted using a Fuzzy Inference System (FIS) while the GP process is running. This idea was borrowed from the series of works by Castillo, et al. An example of this dynamic adaptation of parameters can be found in \cite{castillo2015new}, where the authors apply a FIS that controls the value of certain parameters in an Ant Colony Optimization (ACO) algorithm, proposing different architectures. Then these architectures are compared in performance. In the end, the authors prove that the dynamic adaptation of parameters through the use of FIS can greatly improve the performance of ACO. Additionally, one can find a survey of the application of this type of technique in the work by Valdez, Melin and Castillo \cite{valdez2014survey}.
In the Proposed Method, a similar approach is taken, where dynamic adaptation of parameters through FIS is used to avoid the stagnation of the GP algorithm. In this case, a stagnated GP algorithm would mean that it has been producing the same fitness over a number of generations, i.e., the absolute value of MSE plus sum of forces is not being lowered in the last N generations. To calculate this stagnation level, the authores of this work propose the Stagnation Index, which is described by the Formula \ref{si}, where S(P) means the Stagnation Index of P, P is the set of fitnesses over certain number of generations, and C(P) is the count of repeated fitnesses over the last N generations. For example, given the set P = {5, 5, 5, 3, 2, 1}, C(P) = 3.
\begin{equation} \label{si}
S(P) = 1 - \sqrt{1 \over C(P)}
\end{equation}
The Stagnation Index is given as input to a FIS, which gives as output a new replace chance for the replace operation. The objective of this dynamic adaptation of parameters is to obtain lower errors in a smaller amount of generations. This is proven in Section \ref{experiments-and-results}. Also, it is worth mentioning that this technique could be applied to the crossover, migration, and mutation chances, but due to a limitation of time, the authors of this work could only apply the technique to one parameter.
A new flowchart depicting the modified GP algorithm is shown in Figure \ref{flowchart-with-dynamic}.