-
Notifications
You must be signed in to change notification settings - Fork 1
/
5-union.py
115 lines (105 loc) · 2.61 KB
/
5-union.py
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
111
112
113
114
115
'''
Este código realiza testes com diferentes operadores de união
para funções de pertinência. Ele cria gráficos que mostram as
entradas, as saídas e a combinação das entradas e saídas para
cada tipo de operador de união. Os gráficos são salvos em arquivos de imagem.
'''
import numpy as np
import matplotlib.pyplot as plt
from fuzzy.membership_function import Membership_Function as MF
from fuzzy.operators import Union
from utils.graphs import Graph
range, inputs = MF.test_functions(7)
maximum = np.array([Union.maximum(inputs)])
Graph.inline_plot(
data= np.array([
inputs,
maximum,
np.concatenate((maximum,inputs), axis=0)
]),
title="Testes de união máxima",
range=range,
active_legend=True,
subtitle=['Entradas', 'Saídas', 'Entradas X Saídas'],
path_save="images/union_max.png",
label=[
['Tri', 'Tra', 'Gaus'],
['max'],
['max','Tri', 'Tra', 'Gaus']
],
fill=[
[False,False,False,],
[True],
[True,False,False,False],
]
)
probabilistic_sum = np.array([Union.probabilistic_sum(inputs)])
Graph.inline_plot(
data= np.array([
inputs,
probabilistic_sum,
np.concatenate((probabilistic_sum,inputs), axis=0)
]),
title="Testes de união soma probabilística",
range=range,
active_legend=True,
subtitle=['Entradas', 'Saídas', 'Entradas X Saídas'],
path_save="images/union_prob.png",
label=[
['Tri', 'Tra', 'Gaus'],
['prob_sum'],
['prob_sum','Tri', 'Tra', 'Gaus']
],
fill=[
[False,False,False,],
[True],
[True,False,False,False],
]
)
limited_sum = np.array([Union.limited_sum(inputs)])
Graph.inline_plot(
data= np.array([
inputs,
limited_sum,
np.concatenate((limited_sum,inputs), axis=0)
]),
title="Testes de união soma limitada",
range=range,
active_legend=True,
subtitle=['Entradas', 'Saídas', 'Entradas X Saídas'],
path_save="images/union_lim.png",
label=[
['Tri', 'Tra', 'Gaus'],
['lim_sum'],
['lim_sum','Tri', 'Tra', 'Gaus']
],
fill=[
[False,False,False,],
[True],
[True,False,False,False],
]
)
range, inputs = MF.test_functions(8)
drastic_sum = np.array([Union.drastic_sum(inputs)])
Graph.inline_plot(
data= np.array([
inputs,
drastic_sum,
np.concatenate((drastic_sum,inputs), axis=0)
]),
title="Testes de união soma drástica",
range=range,
active_legend=True,
subtitle=['Entradas', 'Saídas', 'Entradas X Saídas'],
path_save="images/union_dra.png",
label=[
['Tri', 'Tra', 'Gaus'],
['dra_sum'],
['dra_sum','Tri', 'Tra', 'Gaus']
],
fill=[
[False,False,False,],
[True],
[True,False,False,False],
]
)