Exemplo n.º 1
0
num_input = int(sys.argv[1])
num_hidden = int(sys.argv[2])
num_output = int(sys.argv[3])
file_data_testing = (sys.argv[4])
file_weights = (sys.argv[5])

format = file_data_testing[-4:-1]+file_data_testing[-1]

if (format == '.dat'):
	inps = loader.loadDat(file_data_testing)
elif (format == '.csv'):
	inps = loader.loadCsv(file_data_testing)

inps = loader.stringifyVar(inps,loader.normalizeVar(loader.getVar(inps)))
weights = jst.decodeWeights(loader.loadCsv(file_weights),num_input,num_hidden,num_output)

match = 0
tp1 = 0
pp1 = 0
tn1 = 0
pn1 = 0
for i in range(len(inps)):
 	if(jst.correct(inps[i],weights)):
 		match += 1
 	if(jst.truePositive1(inps[i],weights)):
 		tp1 += 1
 	if(jst.trueNegative1(inps[i],weights)):
 		tn1 += 1
 	if(jst.predictPositive1(inps[i],weights)):
 		pp1 += 1
Exemplo n.º 2
0
weight_interval = int(sys.argv[2])
pop_size = int(sys.argv[3])
gen_limit = int(sys.argv[4])

data_learning = sys.argv[5]
data_testing = sys.argv[6]

# print sys.argv[1]
inps = loader.loadDat(data_testing)
# inps = loader.stringifyVar(inps,loader.normalizeVar(loader.getVar(inps)))

start = time.time()

weights = de.de((num_output*num_hidden)+(num_hidden*num_input),weight_interval,pop_size,gen_limit,num_hidden,data_learning)

np.savetxt('weights.csv', np.array(weights), delimiter=',')

weights = jst.decodeWeights(weights)

end = time.time()
print end - start

match = 0
for i in range(len(inps)):
 	if(jst.correct(inps[i],weights)):
 		match += 1
print match,len(inps)
print "Persentase kecocokan = "+str((match*100)/len(inps))+"%"

#print num_hidden,weight_interval,pop_size,gen_limit,'ret = 1/(1+np.exp((-0.001*x)))'
Exemplo n.º 3
0
data_learning = sys.argv[5]
data_testing = sys.argv[6]

# print sys.argv[1]

inps = loader.loadCsv(data_testing)
inps = loader.stringifyVar(inps, loader.normalizeVar(loader.getVar(inps)))

start = time.time()

weights = jst.decodeWeights(
    de.de(
        (num_output * num_hidden) + (num_hidden * num_input),
        weight_interval,
        pop_size,
        gen_limit,
        num_hidden,
        data_learning,
    )
)

end = time.time()
print end - start

match = 0
for i in range(len(inps)):
    if jst.correct(inps[i], weights):
        match += 1
print match, len(inps)
print "Persentase kecocokan = " + str((match * 100) / len(inps)) + "%"