Professional Documents
Culture Documents
Germano C. Vasconcelos
Centro de Informtica - UFPE
Variaes da Lgica Clssica: Lgica Fuzzy
3
Caractersticas: Lgica Fuzzy
4
Conjuntos Fuzzy
.5
Funo de
pertinncia
5
Conjuntos Fuzzy
Definio formal
Um conjunto fuzzy A em X expresso como um conjunto
de pares ordenados:
A = {( x , A ( x )) | x X }
Funo de Universo ou
Conjunto
pertinncia Universo de discurso
fuzzy
(MF)
.8
.5 alto nos EUA
alto na Itlia
.1
7
1.75 Altura (m)
Formulao da Funo de Pertinncia
1 1
Grau de Pertinncia
Grau de Pertinncia
0.8 0.8
0.6 0.6
0.4 0.4
0.2 0.2
0 0
0 20 40 60 80 100 0 20 40 60 80 100
1 1
Grau de Pertinncia
Grau de Pertinncia
0.8 0.8
0.6 0.6
0.4 0.4
0.2 0.2
0 0 8
0 20 40 60 80 100 0 20 40 60 80 100
Universo Discreto
0.6
X = {0, 1, 2, 3, 4, 5, 6} (discreto)
0.4 A = Nmero ideal de filhos
0.2 A = {(0, .1), (1, .3), (2, .7), (3, 1),
(4, .6), (5, .2), (6, .1)}
0
0 2 4 6
X = Nmero de filhos
9
Universo Contnuo
X = (Conjunto de nmeros
(b) Universo Contnuo reais positivos) (contnuo)
1
B = Pessoas com idade em
Grau de Pertinncia
0.8
0.6
torno de 50 anos
0.4
1.2
Jovem Maduro Idoso
Grau de Pertinncia
0.8
0.6
0.4
0.2
0
0 10 20 30 40 50 60 70 80 90
X = Idade
11
Variveis Lingsticas
12
Representao
A B
1 1
A est contido em B
0.8 0.8
Grau de Pertinncia
0.6 0.6
1 B
0.4 0.4
0.8 A 0.2 0.2
0.6
0 0
0.4
0.2 (c) Conjunto Fuzzy "A ou B" (d) Conjunto Fuzzy "A e B"
0
1 1
0.8 0.8
0.6 0.6
0.4 0.4
0.2 0.2
13
0 0
Grau de Crena x Grau de Verdade
Aplicao das
Fuzificao Defuzificao das
regras
das variveis variveis
15
Fuzzificao
Etapa na qual os valores numricos so
transformados em graus de pertinncia para um valor
lingstico
16
Determinao das regras
Descrio das situaes nas quais h reaes atravs
de regras de produo (If - then). Cada regra na sada
especifica uma ou vrias concluses.
17
Regras If - then
Estilo Mamdani
Se a presso alta, ento o volume pequeno
alta pequeno
Estilo Sugeno
Se a velocidade mdia, ento a resistncia = 5 * velocidade
mdia
resistncia = 5*velocidade
18
Sistema de inferncia
.3
.1
2 Velocidade
Regra 1: w1 = .3; r1 = 2
Regra 2: w2 = .8; r2 = 4*2 Resistncia = (wi*ri) / wi
Regra 3: w3 = .1; r3 = 8*2 = 7.12 19
Avaliao das regras
20
Agregao das Regras
21
Defuzzificao
22
Fuzzificao e Certeza
Lgica Fuzzy um clculo de compatibilidade. Ela trabalha com
a descrio das caractersticas das propriedades ;
Lgica Fuzzy x Probabilidade ;
Descreve caractersticas que variam continuamente, associando
partes dos valores a significados semnticos ;
Poder relacionado a existncia de overlap;
Representa uma medida de pertinncia de um elemento a um
conjunto Fuzzy;
No acaba com o tempo. uma propriedade intrnseca de um
evento ou objeto.
23
Fuzzificao e Impreciso
24
Fuzzificao e Impreciso
25
Fuzzificao e Impreciso
Curiosidade do Cotidiano:
Dilogo entre Glauber e Carina para decidir
O quo rpido um carro rpido
26
Fuzzificao e Impreciso
28
Fuzzificao e Impreciso
CONCLUSES ?
29
Fuzzificao e Certeza
30
Fuzzificao
Engloba:
Anlise do Problema;
Definio das Variveis;
Definio das Funes de Pertinncia; e
Criao das Regies.
31
Fuzzificao
32
Fuzzificao
TRIANGULAR:
TRAPEZOIDAL:
Lento Rpido
34
Fuzzificao - Exemplo
35
Inferncia
Engloba:
Definio das proposies;
Anlise das Regras; e
Criao da regio resultante.
36
Inferncia
PROPOSIES CONDICIONAIS
PROPOSIES NO CONDICIONAIS
37
Inferncia
PROPOSIES CONDICIONAIS:
if W is Z then X is Y
PROPOSIES NO-CONDICIONAIS:
X is Y
38
Inferncia
AGREGAO:
Calcula a importncia de uma determinada regra para a situao
corrente.
COMPOSIO:
Calcula a influncia de cada regra nas variveis de sada.
39
Inferncia
Regras de Inferncia:
40
Defuzzificao
41
Defuzzificao
Exemplos:
z0 z0 z0
42
Lgica Fuzzy no Mundo
43
Sistemas Neuro-fuzzy
Redes neurais e lgica fuzzy so ferramentas
naturalmente complementares
Redes neurais desempenham bem o tratamento de
dados e lgica fuzzy com raciocnio em mais alto
nvel, usando informao lingustica de
especialistas no domnio
Sistemas fuzzy no possuem habilidade de
aprendizagem e adaptao a novos ambientes
Redes Neurais podem aprender mas no explicam
o conhecimento adquirido
44
Sistemas neuro-fuzzy integrados combinam
computao paralela com capacidade de
aprendizagem das redes neurais e habilidade de
representao de conhecimento e explicao dos
sistemas fuzzy
45
Um sistema neuro-fuzzy uma rede neural
funcionalmente equivalente a um modelo de
inferncia fuzzy
46
A estrutura de um sistema neuro-fuzzy similar
a uma rede neural multi-camadas
47
Rede Neuro-fuzzy
Layer 1 Layer 2 Layer 3 Layer 4 Layer 5
A1 A1 R1
x1 R1
x1 x1
A2 R2
x1 A2 R2
wR3 C1
C1
A3 A3 R3 R3 wR6
y
wR1
B1 B1 R4 R4 wR2
x2 C2
wR4
C2
R5 wR5
x2 x2 B2
B2 R5
x2
R6
B3
B3 R6
48
Camada 1 a Camada de Entrada. Cada neurnio
transmite sinais crisps diretamente para a
prxima camada:
yi(1) = xi(1)
( 2) b
0, if xi a
2
2 xi( 2) a
b b
yi( 2) = 1 ( 2)
, if a < xi < a +
b 2 2
( 2) b
0, if xi a +
2
50
Funes de Ativao Triangulares
1 1
a = 4, b =6 a = 4.5, b =6 a = 4, b =6
0.8 0.8
a = 4, b =4
0.6 0.6
0.4 0.4
0.2 0.2
0
0 1 2 3 4 5 6 7 8
X 0
0 1 2 3 4 5 6 7 8
X
51
Camada 3 a Camada de Regras Fuzzy. Cada
neurnio nesta camada corresponde a uma simples
regra fuzzy. Um neurnio de regra fuzzy recebe
entrada dos neurnios de fuzificao que
representam os conjuntos fuzzy nos antecedentes
das regras. Por exemplo, neurnio R1, que
corresponde Regra 1, recebe entradas dos
neurnios A1 e B1
A interseo pode ser implementada pelo operador
produto. Sada do neurnio i na Camada 3 dada por:
53
Camada 5 a Camada de Defuzificao. Cada
neurnio nesta camada representa uma sada
simples do sistema neuro-fuzzy. Toma-se os
conjuntos fuzzy de sada clipados pelas
respectivas foras de disparo e as combina em um
conjunto fuzzy nico.
C1 aC1 bC1 + C 2 aC 2 bC 2
y=
C1 bC1 + C 2 bC 2
55
Como um Sistema Neuro-fuzzy aprende?
Um sistema neuro-fuzzy essencialmente uma
rede multi-camadas, portanto, algoritmos de
aprendizagem padres para redes neurais como o
backpropagation podem ser aplicados
0
1
0
0
57
O conjunto de dados usado para treinar o sistema neuro-fuzzy de
cinco regras abaixo:
Weight
3 0.72
L 0.4
0.61
S 4
x2 0.2 wR2
0.79
L 5 0
0 10 20 30 40 50
Epoch
58
Sistema neuro-fuzzy de oito regras
0.8
S 1 0 wR2 wR8
x1 2
0.7
0.78
3
0.6 wR3 wR5
L 0.69 S
0.5
4 0
y
0.4
5 0.62
0.3 wR6 & wR7
S 6 0 L
0.2
x2 0 wR1
7
0.80
0.1 wR4
L 8 0
0 10 20 30 40 50
Epoch
59
A Comparative Analysis of Hybrid Neural
Systems in a Large Scale Credit Risk
Assessment Application
Bruno P. de Amorim, Germano C. Vasconcelos
Center for Informatics, Federal University of Pernambuco
{bpa, gcv}@cin.ufpe.br
Lourdes M. Brasil
Post-Graduation Program in Knowledge Management and Information
Technology,Catholic University of Brasilia
lmb@pos.ucb.br
Introduction
Despite the potential advantages of HNS, their performance
in large- scale situations have not been yet fully proved
63
Rule Extraction Techniques
FWD
It is performed in a very simple way through the memory connections mji which are used
in the fuzzy predicates (nearly mij)
Produces one rule for each class and all the relevant features must be present in the rules
REFuNN and AREFuNN
Proposed for extracting fuzzy rules from the FuNN model
Use the architecture and weights of the network to extract the rules and make use of
thresholds to reduce the number of rules and features in the antecedent part
TREPAN
Extracts a decision tree that approximates the function represented by the network
Is scalable with respect to the database size, model complexity and execution time
Produces decision trees that maintain a high level of fidelity with their respective oracles,
while being comprehensible and accurate
Does not impose requirements on either the architecture or training method
64
Experimental Comparative Analysis
Financial credit-risk evaluation
A large scale, real-life and complex application
A classification problem that defines whether a credit will
be given or not to an applicant
Database obtained from a Brazilian financial company
27 input features (the database coded has 68 features)
2 classes (good and bad payers)
60,141 records (48,218 good cases and 11,923 bad cases)
It contains personal and financial data about credit applications
and the history of defaulting on the credit approval
It was divided into three sets (training 50%, validation 50%
and test 25%)
65
Experimental Comparative Analysis
Experimental Methodology
Several configurations were analyzed using the same
initial weights
The best configuration found (lowest validation MSE)
was used to perform 30 runs with different initial weights
Analysis of the models FWD, FuNN, and MLP with
respect to:
Error rates
ROC curves
Portfolio on maintained clients
66
Experimental Comparative Analysis
Error rates
67
Experimental Comparative Analysis
ROC Curves
Comparisons based on the test accuracy omits two important aspects:
Usually the class distribution can not be precisely specified
The costs associated with the types of error (Type I and Type II) can be
different and change over time
P 100 P 100
e e
r 80 r 80
c c
60 60
e e
n 40 n 40
t t
a 20 a 20
g g
0 e 0
e 0 6 12 17 23 29 34 40 46 51 57 63 69 74 80 86 91 97 0 6 12 17 23 29 34 40 46 51 57 63 69 74 80 86 91 97
Cutpoint Cutpoint
Bad payers Total clients Bad payers Total clients
Cutpoint
Bad payers Total clients
71
Experimental Comparative Analysis
Feature Selection
Feature selection process of the FWD model
The features with relevance higher than 0.3 were considered relevant
26 final relevant features
Decision tree extracted by TREPAN
29 final relevant features
72
Experimental Comparative Analysis
Comprehensibility of the extracted rules -
FWD
The FWD rule extraction technique produced extensive rules for the high
dimensional credit concession problem
Another problem is the semantic representation of boolean features. All the
features are manipulated as numerical and the semantic representation of
boolean variables becomes inappropriate
73
Experimental Comparative Analysis
Comprehensibility of the extracted rules REFuNN and
AREFuNN
REFuNN extracted 5 rules (3 rules IF marital_status1 is false (0,81) AND
for the good payers and 2 rules for marital_status4 is false (0,77) AND
the bad payers) residencial_city2 is false (0,53) AND
AREFuNN extracted 9 rules (5 residencial_ddd1 is false (0,64) AND
rules for the good payers and 4 zip_code1 is high (0,85) AND
rules for the bad payers) zip_code2 is medium (0,63) AND
Although the set extracted by type_client1 is true (0,85) AND
AREFuNN was larger than that spouse_income is high (0,66) AND
given by REFuNN, the rules income is small (0,82)
obtained by AREFuNN are simpler THEN client is good payer (0,62)
The extracted rule sets were larger
than those extracted from the FWD IF marital_status5 is true AND
network, but the number of residencial_ddd4 is false AND
conditions per rule is small income is small AND
zip_code2 is medium AND
employment_time is small
THEN client is bad payer
74
Experimental Comparative Analysis
Comprehensibility of the extracted rules -
TREPAN
A small and very comprehensible tree was produced from
which 13 rules were derived (7 rules for the good payer
class and 6 rules for the bad payer class)
Although the rule set given by TREPAN was larger than
those extracted by the other techniques, the number of
conditions per rule is small and the rule application is
very direct
IF age > 0.26 AND flag_residencial_phone 0
THEN client is good payer
75
Conclusions
The results obtained indicate that
HNS are very attractive to be used in real- world applications
HNS can be considered as an alternative to the traditional
neural models without performance loss and with the
additional functionality of representing the learned knowledge
in a comprehensible way
Further works can be conducted to
Test and validate the neuro
- fuzzy models, feature selection
and rule extraction techniques in other real- world problems
Extent the FWD model in order to make it able to solve non -
linearly separable problems, to produce more than one rule per
class and to support more than one membership function per
feature 76
Bibliografia
78
Given input and output linguistic values, a neuro-
fuzzy system can automatically generate a complete
set of fuzzy IF-THEN rules.
Let us create the system for the XOR example.
This system consists of 22 2 = 8 rules. Because
expert knowledge is not embodied in the system
this time, we set all initial weights between Layer 3
and Layer 4 to 0.5.
After training we can eliminate all rules whose
certainty factors are less than some sufficiently
small number, say 0.1. As a result, we obtain the
same set of four fuzzy IF-THEN rules that
represents the XOR operation.
79
Neuro-fuzzy systems: summary
The combination of fuzzy logic and neural
networks constitutes a powerful means for
designing intelligent systems.
Domain knowledge can be put into a neuro-fuzzy
system by human experts in the form of linguistic
variables and fuzzy rules.
When a representative set of examples is available,
a neuro-fuzzy system can automatically transform
it into a robust set of fuzzy IF-THEN rules, and
thereby reduce our dependence on expert
knowledge when building intelligent systems.
80