-
Notifications
You must be signed in to change notification settings - Fork 2
/
save.py
83 lines (49 loc) · 1.61 KB
/
save.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
import pandas as pd
import matplotlib.pyplot as plt
from extention import ExtentionOps
from memfuncs import MemFunc
import numpy as np
df = pd.read_csv("tfmem.csv")
#print(df.head())
# p = ["City MPG - Poor", "Highway MPG - Good", "Horsepower - Average",
# "Risk - Low", "Value Loss - Low", "Price - Cheap"]
p = ["HighwayMPG-Good","Horsepower-Average","CityMPG-Poor","Price-cheap","Risk-Low","ValueLoss-Low","HighwayMPG-Good","Horsepower-Average","CityMPG-Poor","Price-cheap","Risk-Low","ValueLoss-Low"]
c = ['b','g','k','r','c','m']
e = ExtentionOps("add")
#e.convertToDomain()
X = np.arange(0,1.1, .05)
rows = [[0, 0, 0.2],[0.35, 0.55, 0.75],[0.4, 0.6, 0.8],[0.0557, 0.25567, 0.4557],[0, 0, 0.2],[0.7, 0.9, 1],[0, 0, 0.2],[0.35, 0.55, 0.75],[0.4, 0.6, 0.8]]
count = 0
for row in rows:
A = e.convertToDomain([row[0],row[1],row[1],row[2]])
#plt.plot(A[:,0],A[:,1],c='b',linewidth=2)
m1 = MemFunc("trap",[row[0],row[1],row[1],row[2]])
plt.plot(X,[m1.memFunc(i) for i in X ],c=c[count],linewidth=2)
plt.xlim([0,1])
plt.ylim([0,1])
plt.title(p[count])
plt.savefig("img/start-" + str(count) + ".png")
plt.clf()
# plt.show()
# t = input()
if count > 4:
break
count += 1
#
# plt.plot(B[:,0],B[:,1],c='b')
# plt.xlim([0,2])
# plt.ylim([0,1])
#
# A = []
# B = []
# for i in np.arange(0,1,.05):
# A.append([i,e.round2(mem1.memFunc(i))])
# B.append([i,e.round2(mem2.memFunc(i))])
# A = np.array(A)
# B = np.array(B)
# #A = [.2,.4,.4,.6]
# # B = [.4,.6,.6,.8]
# print("########")
# #p = e.comp(A)
# t = e.extention([A,B])
# #print(e.extention([p,t]))