-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
41 lines (34 loc) · 1.35 KB
/
main.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
import util as ut
import cqqlCFL
# example usage
class main:
# loading data
# data, col_names = loadDataset()
# data = ut.normalizeDataset(data)
# data = shuffle(data)
# prepare testdata, trainingdata and validation data
# splitIndex = int((len(data) * 0.70))
# trainingData = data[:splitIndex]
# testData = data[splitIndex:]
# restData = data[splitIndex:]
# splitIndex = int((len(restData) * 2 / 3))
# testData = restData[splitIndex:]
# validationData = restData[:splitIndex]
# CQQL Classifier
# cqqlCFL = cqqlCFL.CQQL_Classifier()
# create all possibile minterms
# minterms = cqqlCFL.createMinterms(data[0].shape[0])
# bestActive = []
# bestAcc = 0
# theta_p
# extract minterms
# try each theta value
# for theta_p_threshold in np.arange(0, 1, 0.05):
# activeMinterms = cqqlCFL.extractMinterms(trainingData, minterms, theta_p_threshold)
# acc = cqqlCFL.classify(trainingData,
# minterms, activeMinterms, cqqlCFL.findThreshold(trainingData, minterms, activeMinterms)
# if acc > bestAcc:
# bestActive = activeMinterms
# theta_p = theta_p_threshold
# classify
# cqqlCFL.classify(testData, minterms, bestActive, theta_p)