Subject: Re: Centroide for fuzzy expertsystem
From: Jonathan G. Campbell (email@example.com)
Date: Tue May 30 2000 - 12:39:12 MET DST
Lars Hansen wrote:
> Dear all,
> I'm a student doing my master (Geography and Computer Science). I'm making a
> fuzzy expert system for a Geographic Information System called Arc View. The
> idea is to let the user put as many tumb-rules he knows into the system and
> then come out with a crisp output, that for example says: this farm leaches
> 25 kg N pr. Hectare.
> But I'm not a mathematician and I'm having trouble with an algoritm for
> Centroid defuzzyfication.
> If anybody has som code they could show me, that takes the centroid from a
> number of output sets created with MIN-inferencing and MAX-composition, I
> would appreciate it.
> My output - set look something like this:
> * *
> * ***** * *
> * **** * * * *
> * * * * *
> * * * * * * *
> Lars Hansen
m(y3)+ *** * *
| * ** *
y1 y5 y12
Just to explain centroid, using an example not unlike your's and
assuming a discrete universe for the output let the union of consequent
sets be as in the figure; i.e. m(y1)=0, m(y3)=m(y4) = m(y5) = ... then
the centroid is
y^ = (sum m(yi).yi)/sum m(yi)
which, if the m(yi) were masses on a beam, would the point at which the
beam would balance -- centre of mass.
If y is continuous (likely), the sum is integral; in that case, I'd
advise a visit to T.Masters, Practical Neural Network Recipes in C++,
Academic Press (??), 1993 which shows that the integral can be
simplified if the m(y) is composed of a sequence of trapezoids. Masters
gives C++ code which could be translated to any language.
If m(y) is not a sequence of trapezoids, then you may have to resort to
some numerical integration technique; a quick and dirty technique would
be to sample m(y) at closely spaced yi, and use the summation above. But
you would need to be able to identify a finite support for m(y) (i.e.
where m(y) /= 0).
Contact me directly if you need further help.
Hope this helps,
-- Jonathan G. Campbell, School of Computer Science, The Queen's University of Belfast, BT7 1NN Tel +44 (0)28 90 274623 firstname.lastname@example.org http://www.cs.qub.ac.uk/~J.Campbell Physical office: Room G26, Bernard Crossland Building, 18 Malone Road.
This archive was generated by hypermail 2b25 : Tue May 30 2000 - 12:41:01 MET DST