コード例 #1
0
ファイル: neural.py プロジェクト: arjunbalussery/proj
print l

inp = np.reshape(inp,(-1,l))


print tar[1]
print inp

#target = np.reshape(target,(-1,1))

# Create network with 2 layers and random initialized
#norm = Norm(input)
#input = norm(input)


net = nl.net.newff(minmax(inp), [10, l], transf = [nl.trans.TanSig(), nl.trans.LogSig()])
net.trainf = nl.train.train_bfgs

error = net.train(inp, tar, epochs=10, show=5, goal=0.01)
"""
test = [0,1]

test = np.reshape(test,(-1,2))

out = net.sim(test)

print out


"""
コード例 #2
0
import numpy as np
import input
import target
from neurolab.tool import minmax

# Create train samples
input = np.array(input.data)
target = np.asfarray(target.data)
input = input[: target.shape[0]]

# Create network with 2 layers and random initialized
#norm = Norm(input)
#input = norm(input)
print input.shape
print target.shape
print '----------',minmax(input)
net = nl.net.newff(minmax(input), [12, 4], transf = [nl.trans.TanSig(), nl.trans.LogSig()])
net.trainf = nl.train.train_bfgs
error = net.train(input, target, epochs=1000, show=10, goal=0.02)
print '-------',error[-1]
net.save('net.net')
#Simulate network
print '\nprinting the simulated output';
net=nl.load('net.net')
output = net.sim(input)
out = output
for i in range(len(output)):
	m=max(output[i])
	print '[',m,']',
	for j in range(4):
		if output[i,j] == m: