numerical example appendix a in “a neuro-fuzzy modeling tool to estimate fluvial nutrient loads in...

6
NUMERICAL EXAMPLE APPENDIX A in “A neuro-fuzzy modeling tool to estimate fluvial nutrient loads in watersheds under time-varying human impact” Rafael Marcé 1* , Marta Comerma 1 , Juan Carlos García 2 , and Joan Armengol 1 1 Department of Ecology, University of Barcelona, Diagonal 645, 08028 Barcelona, Spain 2 Aigües Ter Llobregat, Sant Martí de l'Erm 30, 08970 Sant Joan Despí, Spain *E-mail: [email protected] April 2004

Upload: egbert-hunter

Post on 26-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: NUMERICAL EXAMPLE APPENDIX A in “A neuro-fuzzy modeling tool to estimate fluvial nutrient loads in watersheds under time-varying human impact” Rafael Marcé

NUMERICAL EXAMPLE  APPENDIX A

in

“A neuro-fuzzy modeling tool to estimate fluvial nutrient loads in watersheds under time-varying human impact”

Rafael Marcé1*, Marta Comerma1, Juan Carlos García2,

and Joan Armengol1

1Department of Ecology, University of Barcelona, Diagonal 645, 08028 Barcelona, Spain

2Aigües Ter Llobregat, Sant Martí de l'Erm 30, 08970 Sant Joan Despí, Spain

*E-mail: [email protected]

 April 2004

Page 2: NUMERICAL EXAMPLE APPENDIX A in “A neuro-fuzzy modeling tool to estimate fluvial nutrient loads in watersheds under time-varying human impact” Rafael Marcé

What is fuzzy logic?

0

1

Binary logic

SPRING SUMMERWINTER FALL

Time (day of the year)

SPRING SUMMERWINTER FALL

In binary logic the function that relates the value of a variable with the probability of a judged statement are a ‘rectangular’ one. Taking the seasons as an example...

Prob

abil

ity

0

1

Fuzzy logic

Time (day of the year)

SPRING SUMMERWINTER FALL

In fuzzy logic the function can take any shape. The gaussian curve is a common choice...

Pro

bab

ilit

y March 7th

Winter = 1

The result will always be ‘one’ for a season and ‘zero’ for the rest

March 7th

Winter = 0.8

Spring = 0.2

In fuzzy logic, the truth of any statement becomes a

matter of degree.

Page 3: NUMERICAL EXAMPLE APPENDIX A in “A neuro-fuzzy modeling tool to estimate fluvial nutrient loads in watersheds under time-varying human impact” Rafael Marcé

Fuzzy reasoning with ANFIS

Given an available field database, we define an input-output problem. In this case, the nutrient concentration in a river (output) predicted from daily flow and time (inputs).

The first step is to solve the structure identification. We apply the trial-and-error procedure explained in the text with different number of MFs in each input. Suppose that the results were as follows:

MFs in input FLOW MFs in input TIME Residual Mean Square Error

1 1 7.52

1 2 5.36

2 1 5.21

2 2 2.95

3 2 2.05

2 3 2.35

3 3 2.04

4 4 2.01

5 5 1.99

This option is considered the

optimum trade-off between number of

MFs and fit.

Page 4: NUMERICAL EXAMPLE APPENDIX A in “A neuro-fuzzy modeling tool to estimate fluvial nutrient loads in watersheds under time-varying human impact” Rafael Marcé

Fuzzy reasoning with ANFIS

Then, the structure identification is automatically solved generating a set of 6 if-and-then rules, i.e. a rule for each possible combination of input MFs. For each rule, an output MF (in this case a constant, because we work with zero-order Sugeno-type FIS) is also generated.

Rule 1 If FLOW is LOW and TIME is EARLY ON then CONCENTRATION is C1

Rule 2 If FLOW is LOW and TIME is LATER ON then CONCENTRATION is C2

Rule 3 If FLOW is MODERATE and TIME is EARLY ON then CONCENTRATION is C3

Rule 4 If FLOW is MODERATE and TIME is LATER ON then CONCENTRATION is C4

Rule 5 If FLOW is HIGH and TIME is EARLY ON then CONCENTRATION is C5

Rule 6 If FLOW is HIGH and TIME is LATER ON then CONCENTRATION is C6

The next step is to draw the MFs in each input space, an also to assign a value for each output constant. This is the parameter estimation step, which is solved by the Hybrid Learning Algorithm using the available database. Suppose that the algorithm gives the following results:

Just for convenience, we rename the different input MFs with intuitive linguistic labels, such High or Early on.

HIGH

0

1

Flow

MODERATELOW

0 10

Pro

babi

lity

0

1

Time

EARLY ON LATER ON

0 10

Pro

babi

lity

C1 = 16.23

C2 = 18.56

C3 = 10.58

C4 = 16.13

C5 = 6.59

C6 = 10.60

Remember that a gaussian curve can be defined with two parameters. We give a graphical representation for clarity.

Page 5: NUMERICAL EXAMPLE APPENDIX A in “A neuro-fuzzy modeling tool to estimate fluvial nutrient loads in watersheds under time-varying human impact” Rafael Marcé

Now the Fuzzy Inference System is finished.

The following slide is a numerical example showing how an output is calculated from an input.

Page 6: NUMERICAL EXAMPLE APPENDIX A in “A neuro-fuzzy modeling tool to estimate fluvial nutrient loads in watersheds under time-varying human impact” Rafael Marcé

Rule 1 If FLOW is LOW and TIME is EARLY ON then CONCENTRATION is C1

Rule 2 If FLOW is LOW and TIME is LATER ON then CONCENTRATION is C2

Rule 3 If FLOW is MODERATE and TIME is EARLY ON then CONCENTRATION is C3

Rule 4 If FLOW is MODERATE and TIME is LATER ON then CONCENTRATION is C4

Rule 5 If FLOW is HIGH and TIME is EARLY ON then CONCENTRATION is C5

0

1

Prob

abili

ty

0

1

0

1

Prob

abili

ty

0

1

0

1

0

1

0

1

0

1

0

1

Prob

abili

ty

0

1

Prob

abili

ty

0

1

Prob

abili

ty

0

1

Prob

abili

ty

0 10 0 10Rule 6 If FLOW is HIGH and TIME is LATER ON then CONCENTRATION is C6

0

1

0

1

0

1

0

1

0

1

0

1

16.23

18.56

10.58

16.13

6.59

10.60

Logical operations

p = 0

p = 0

p= 0.1

p = 0

p= 0.4

p = 0

1.058 + 2.6360.1 + 0.4

7.388OUTPUT CONCENTRATION

VALUE8 2.5INPUT VALUE for FLOW

p = 0

p = 0 p = 0

p = 0

p = 0

p = 0.4

p = 0.1

p = 0.1

p = 0.4

p = 0.75

p = 0.75

p = 0.4

INPUT VALUE for TIME

X =

X =

X =

X =

X =

X =

0

0

1.058

0

2.636

0

Given an input, the first step to solve the FIS is the fuzzyfication of inputs, i.e.

to obtain the probability of each linguistic value in each rule.

The six rules governing the Fuzzy Inference System are represented with a graphical representation of the MFs that

apply in each rule.

The last step is the defuzzyfication procedure, when the consequents are

aggregated (weighted mean) to obtain a crisp output

The third step is to calculate the consequent of each rule depending on

their weight (or probability)

MIN = AND

The second step is to combine the probabilities on the premise part to get the weight (or probability) of each rule.It is demonstrable that applying the and logical operator is equivalent to solve

for the minimum value of the intersection of the MFs