Professional Documents
Culture Documents
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 99
Abstract- Gold is a precious metal since past and consequently its price forecast has been a subject of interest among
people. The demand for this commodity is on the rise. Due to increase in its demand, it is necessary to develop a model
that reflects the structure and pattern of gold market and forecast movement of gold price.
For this reason, we make an attempt to develop a forecasting model for predicting gold prices. We use Fuzzy C Mean
(FCM) based on the Takagi-Sugeno Model, to forecast gold price. The results obtained are satisfactory.
Index Terms- Gold price, forecasting, Fuzzy C Means, forecast, Time series, Takagi Sugeno, weighted least square.
—————————— ——————————
similar as possible. Clustering methods can be
heuristic, hierarchical or objective function Equation (2) states a function approximation
based. Here, we use fuzzy clustering problem. It is known to be good
methodology based on objective function for approximation if f approximates g over the
calculation of fuzzy membership function for whole space of inputs X= (x1, x2,…, xn). In
each observation and center of each cluster [8]. other words, we wish to tune fuzzy system
With the known membership function for each f(x/θ) so that e(x) is small.
input variable (inputs gold prices of two
consecutive months and output is the gold A fuzzy model of the MISO system is a set of n
price of next successive month), we can rules that can be built using the inputoutput
perform weighted least square computations training data. The general rule structure If
for determining the parameters of the linear Then rules for a MISO system can be
consequent functions. represented in the form.
The rest of the paper is organized as follows. In A1j and x2 is A2j then p1 is g j ( x)
1
section 2, we present modeling of Fuzzy Logic R1: If x1 is
Control System. Section 3, describes how
membership function is calculated using Also…also
clustering. Section 4, performs least square
methodology for calculating fuzzy rule Aj Aj g nj ( x)
consequents. In Section 5, we present a Rn: If x1 is 1 and x2 is 2 then pn is ,
numerical illustration to describe the where i = (1, R) and R is number of rules.
methodology. Finally the paper is concluded in
section 6. (3)
In MISO fuzzy system, in order to form Ifthen
rule we are using fuzzy clustering for
optimization to pick the clusters and hence the
2: MODELING OF FUZZY LOGIC CONTROL premise membership function parameters. The
SYSTEM consequent parameters are chosen using least
We consider a Multiple Input Single Output square method. TakagiSugeno method is
(MISO) system. The task is to use past gold forming the consequent portion of the IfThen
prices upto time t to predict the price of gold at rule, which is a function of crisp inputs.
time t+δt in the future. The input for this type The TakagiSugeno fuzzy system is defined by
of prediction is N number of prices equally the following equation.
spaced S i.e. monthly, yearly etc. Hence, if x1,
x2 have gold prices at t, t+1 and p is a gold
price at t+2 where t is point of time that is
R
spaced monthly w.r.t each year.
The fuzzy system for the gold price forecasting ∑g
j =1
j ( x )µ Hj ( x )
is defined as p = f (x / θ ) = R
f :x→ p ∑µ j
H ( x)
(1) j =1
(4)
Here we wish to identify g(x) that denotes the
whole physical system of time series consisting where
gold prices. We choose finite set of input R is the number of rules in rule base.
output data pairs G (training data set) where G
is a subset of g. This training dataset G is used µ Hj ( x ) is the membership function associated with H j
to construct a fuzzy system f by manipulating
θ so that f(x/θ) approximates g as closely as
possible. So that H j represents the premise certainty for rule j
g ( x) = f ( x / θ ) + e( x )
(2)
JOURNAL OF COMPUTING, VOLUME 3, ISSUE 3, MARCH 2011, ISSN 2151-9617
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 101
g j ( x) = aTj x
and where
u11 u12 ... u1n
a j = a j ,0 , a j ,1 , a j ,2 , a j ,3 ,..., a j ,n u u ... u2 n
and
U = 21 22 where i = 1, 2, …, M and k = 1,
x = 1, x T
...
uc1 uc 2 ... uMR
Here, we use fuzzy clustering coupled with (5)
least squares to train TakagiSugeno fuzzy j
system to determine the parameters Center of clusters v ,can be arrayed in Matrix V as
j
a j , µ Hj ( x) g j ( x) V = v , j =1, 2... R.
and .
(6)
FCM is use to find the membership function
3 CALCULATIONS OF MEMBERSHIP FUNCTION and cluster centers to minimize objective
USING CLUSTER ANALYSIS function.
Clustering of numerical data forms the basis of R M m
j = ∑∑ ( µij ) x i − v j
2
many classification and systemmodeling
algorithm. The purpose of clustering is to i =1 j =1
distill natural grouping of data from a data set,
producing a concise representation of a (7)
system’s behavior. [9] The FCM algorithm is where, R is number of clusters (rules), M
one of the most widely used clustering µ
algorithms. Professor Jim Bezdek originally number of input output data pairs, ij is
introduced this technique in 1991[10]. membership function of the ith data pair in j
j
FCM starts with an initial guess for the cluster th cluster, v is cluster center of jth cluster.
centers, which are intended to mark the mean Minimization of J results in cluster center
location of each cluster. The initial guess for being placed forming groups of data. Here,
these cluster centers is most likely incorrect. “fuzziness factor” is a parameter that
Additionally, FCM assigns every data point a determines the amount of overlapping of the
membership grade for each cluster. Iteratively, clusters and e(x) determines the error
updating the cluster centers and the tolerance.
membership grades for each data point, FCM We begin the process by initializing the cluster
iteratively moves the cluster centers to the
right location within a data set so that error is v0j ) via random number generator
centers (
minimized
vj
In fuzzy clustering, data are bound to each such that each component 0 should lie with
cluster by means of a membership function, the training dataset. Consequently, for the next
which represents the fuzzy behaviour of the iterations cluster center is calculated as
fuzzy system. We find the optimum
M
membership values of all data points in all
clusters whose factors are numbers between 0 ∑ x (µ i new m
ij )
and 1 represents the degree of membership v j
new = i =1
M
between data and centers of clusters.
Membership values of all data points in all
∑ (µ
i =1
new m
ij )
clusters uik, can be combined in a M×R (8)
matrix represented as We compute the membership values for each
cluster center as
JOURNAL OF COMPUTING, VOLUME 3, ISSUE 3, MARCH 2011, ISSN 2151-9617
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 102
The consequent parameters in each rule are
−1 estimated separately using WLS method by
1
minimizing the following criterion
R x i − vold
2 m −1
j
2
= ∑ M
µijnew j j = ∑ ( µij ) 2 ( y i − ( xi )T a j )
k =1 x i − vold
2
k
i =1 For j=1,2, …,
R. (11)
(9) T
x i = 1, ( xi )T
where , is a unitary column
where i= 1,2,…,M and j=1,…,R. such that
R µ
extend the regression matrix. ij is
∑µ new
ij =1 membership function for ith data pair and jth
summation j =1 . cluster that resulted from clustering algorithm.
We will compare the distance between the
aj
vj , defines the output associated to jth rule
current cluster centers new and the initial
j j for ith training data pair,
y i is the output
v v
cluster centers = at the end of first
old 0
portion of the ith data pair d(i) =
( xi , yi ) .
iteration and will proceed based on following
criteria Rule consequent can be computed as
j
vnew − vold
j
< e( x ) g j ( x) = aTj x
If (for j = 1,2,…,R) where
Calculate the final membership functions a j = a j ,0 , a j ,1 , a j ,2 , a j ,3 ,..., a j ,n
w.r.t each clusters and stop and
Else x = 1, x T
Continue with iterations, that is compute , for j=1, …, R.
membership grades and cluster centers and
check for the condition.
(10) (12)
The statement (10) states that cluster centers ( Here, the weighted least squares estimated of
j the consequent parameter is calculated as
v ) accurately represents the input data.
new
v1new 2
vnew 3
vnew 4
vnew 27
28
0.512074284
0.178786969
0.473211254 0.01140021 0.003314252
0.809491037 0.009200616 0.002521377
29 0.029682667 0.967200617 0.002472734 0.000643982
30 0.011427255 0.986788978 0.001428753 0.000355014
298.78683962 388.2553923 646.743709680 900.456608058 31 0.006468743 0.992424863 0.000888401 0.000217993
981938 9515228 35691 16692 32 0.06499012 0.928591473 0.005079924 0.001338483
298.67637230 390.4146410 659.596276549 913.295833458 33 0.107138085 0.88478855 0.006358755 0.00171461
34 0.034692706 0.961715847 0.002848272 0.000743175
965627 2851739 65277 86525
35 0.005009345 0.994291361 0.000558655 0.000140639
36 0.000724496 0.999153389 0.0000981 0.0000241
37 0.001243759 0.998550907 0.000164762 0.0000406
38 0.0000526 0.999938999 0.0000067 0.00000166
TABLE 3: CLUSTER CENTERS DURING ITERATION 2 39 0.002567062 0.997052189 0.000304628 0.0000761
40 0.002121147 0.997577434 0.000240921 0.0000605
v1new 2
vnew 3
vnew 4
vnew 41
42
0.000388164
0.00079582
0.999549447 0.00005 0.0000124
0.999068365 0.000109087 0.0000267
43 0.001103859 0.998721501 0.000139971 0.0000347
44 0.004001849 0.99530467 0.000557209 0.000136272
295.73772065 385.9424821 639.610092719 895.049730689 45 0.006232446 0.992540155 0.000989827 0.000237572
631 36 553 370 46 0.002943143 0.996532331 0.000421771 0.000102754
295.70988111 387.0276010 649.482028813 905.160417527 47 0.001275617 0.998528828 0.000156602 0.000039
48 0.002267398 0.99741395 0.000254617 0.000064
270 73 850 164
49 0.004211959 0.995219258 0.000454012 0.00011477
50 0.00237717 0.997283694 0.000271094 0.000068
At each iteration cluster center are calculated 51
52
0.003222715
0.004052342
0.996209831 0.000456167 0.000111287
0.995204888 0.000597726 0.000145044
based on values of the immediate previous 53 0.001335072 0.998431931 0.000187263 0.0000457
54 0.00183962 0.997834359 0.000262131 0.0000639
vj vj 55 0.000800545 0.999064945 0.00010799 0.0000265
iteration i.e. as old = 0 . We compare the 56 0.000106202 0.999876748 0.0000137 0.00000338
57 0.0000199 0.999976938 0.00000254 0.000000628
distances between the current cluster centers 58 0.048332265 0.94629937 0.004259974 0.001108391
j
vj
59 0.043664404 0.951110771 0.00415424 0.001070584
vnew 60 0.01448673 0.98239335 0.002522499 0.000597421
and the previous cluster centers old that 61 0.030360413 0.961435673 0.0066803 0.001523615
is we check for condition (10) and we found 62 0.02705667 0.966003336 0.00564071 0.001299283
63 0.012960365 0.984203784 0.002293994 0.000541856
that condition was not satisfied so we proceed 64 0.008880765 0.989282813 0.001483099 0.000353323
65 0.005032608 0.994029148 0.000755376 0.000182868
with next iterations that is, calculating the 66 0.000441081 0.999486179 0.0000584 0.0000144
membership grades w.r.t. clusters and then 67 0.000979996 0.998853121 0.000134035 0.0000328
JOURNAL OF COMPUTING, VOLUME 3, ISSUE 3, MARCH 2011, ISSN 2151-9617
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 104
a2 = [163.7825, 0.241966, 0.293323]
Figure a1 Figure b1
a3 = [163.7825, 0.241966, 0.293323]
900
1200
800
a4 = [163.7825, 0.241966, 0.293323]
1000
700
600 800
those are equivalent to one other.
500 2007 Actual 2009 Actual
600
400 2007 Model 2009 Model
300 400
200
200
100
0
forecasting system:
In the present section we present some test
Figure c1 Figure d1
cases to investigate the accuracy of the
proposed fuzzy based gold forecasting system. Figure 2: Unfavorable results (a1, b1, c1, d1)
In literature it is a wellestablished fact that the
forecasting accuracy is inversely related to the
fluctuation of the data set. Our results also
strengthen the wellestablished fact. The
6 CONCLUSION:
accuracy of the forecasted results for the years In this paper, we have developed a simple,
1997, 1999, 2003, 2007 is very high (See Figures systematic and iterative methodology for
a, b, c, d) but at the same time the proposed forecasting gold price. The developed
model is not providing that much promising methodology relies on fuzzy clustering and
accuracy for the years 1994,1998, 2007, 2009(See weighted least square. Integration of the
Figure a1,b1,c1,d1 ). The reason for the varying cluster estimation methodology with the linear
results is due to the level of fluctuation in gold weighted least square estimation procedure
price. It is evident from the actual data that for helped in developing a fast and robust
the years for which the gold prices are less algorithm for identifying fuzzy models from
fluctuated the forecasting results are more numerical data. Robustness in respect to noisy
promising but the same time for the year for data is achieved by averaging the data that
which gold prices are highly fluctuated the takes place in both the cluster estimation and
forecasting results are not that much accurate. least square procedure.
The forecasting results obtained using the
400
350
350
300
proposed methodologies are very
300
250
250
encouraging. They are inline with the well
established fact in the literature of forecasting
1997 Actual 200
200
1999 Actual
1997 Model
1999 Model
150
150
100
50
100
50
that the forecasting accuracy is inversely
0
0
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
related to the fluctuation of the data set. Here
Year 1997 Year 1999
it is worthy to point out that the fluctuation in
Figure a Figure b gold prices depends on lots of external facts
like War, Gasoline price, etc. So the proposed
450
6 methodology is perfect in a scenario where the
0
dependence on these external factors is
400
350
5
0
0
300
4
0
250
200
2003 A c tual
2003 M odel
0
3
0
2005
Actu
2005
minimal.
150
0
2 al
Mod
100
0
50 0 el
0 1
0
J an Fe b M ar A pr M ay J un J ul A ug Se p Oct N ov Dec 0
Y e ar 2 003 0
0J F MA M J J A S ON D
a e a p aYea
u u u e c o e
n b r r yr n l g p t v c
REFERENCE:
200
5
[1] Amine Trabelsi, Frederic Lafont, Mohamed
Figure c Figure d Kamoun, Gilles Enea (2007), Fuzzy identification
Figure 1: Favorable results (a, b, c, d) of a greenhouse, Applied Soft Computing, 1092–
1101.
395
330
[2] JianQin Chen, YuGeng Xi, ZhongJun
390
385
320
Zhang (1998), A clustering algorithm for fuzzy
310
380
model identification, Fuzzy Sets and Systems, 319
Gold Prices
300
375 1998 A ctual
1994Actual
329.
1994Model 1998 Model
370 290
365
280
360
270
355
350 260
J an Feb Mar Apr May J un J ul Aug Sep Oct Nov Dec Jan Feb Mar Apr May Jun Jul A ug Sep Oc t Nov Dec
Year 1994 Ye ar 1998
JOURNAL OF COMPUTING, VOLUME 3, ISSUE 3, MARCH 2011, ISSN 2151-9617
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 106