Beispiel #1
0
''''
Spirit Animal User ID: SalmonSloth
Date the file was last edited: December 6, 2018
Challenge Number: 6

SOURCES OF HELP:
a) https://stackoverflow.com/questions/7115437/how-to-embed-a-small-numpy-array-into-a-predefined-block-of-a-large-numpy-arra  
b) Took help from Lecture 20 slide provided by Dr. Jones
c) Checked some Youtube videos
e) Googled
f)Asked some questions to Paul

'''

from __future__ import division
import neuro
import program
#training inputs and their respective target
inputs = program.outcomes
targets = program.target

#number of repetitions to train the network
reps = 1000
network = []  #makes an empty list to contain the neural net
network = neuro.setup_network(inputs)
neuro.train(network, inputs, targets, reps)
neuro.writeNetworkToFile("myNetwork.net", network)
Beispiel #2
0
# newT = []
# targets = open('myTest.csv', 'r')
# targets = targets.read()
# targets = targets.split('\n')
# if targets[-1] == '':
# 	targets.pop()
# for i in targets:
# 	newT.append(i.split(','))
# 	print(float(newT))

reps = 1000
network = []
netowrk = neuro.setup_network(inputs)
neuro.train(network, inputs, targets, reps)
neuro.writeNetworkToFile('myNetwork.net', network)

count = 0
myGrid = open('myNetwork.csv', 'w+')


def search(x, y):
    if grid[x][y] == 2:
        print('Solved... This is a Maze!')
        return True
    elif grid[x][y] == 1:
        print('Wall! at %d, %d' % (x, y))
        return False
    elif grid[x][y] == 3:
        print('Visiting %d, %d' % (x, y))
        return False
0,0,0,0,0,1,0,1,0,1,
0,0,0,0,0,1,1,1,1,1,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
],
[
0,0,0,0,0,0,0,0,0,0,    
0,0,0,0,1,1,1,1,1,0,
0,0,0,0,1,0,1,0,1,0,
0,0,0,0,1,1,1,1,1,0,
0,0,0,0,1,0,1,0,1,0,
0,0,0,0,1,1,1,1,1,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
]]

targets = [[.6],[.6],[.6],[.6],[.5],[.5],[.5],[.5],[.5],[.3],[.3],[.3],[.3],
[.3],[.3],[.2],[.2],[.2],[.2],[.2],[.2],[.1],[.1],[.1],[.1],[.1],[.1],[.4],
[.4],[.4],[.4],[.4],[.4],[.4],[.4]]

reps = 550
network = []

network = neuro.setup_network(inputs)
neuro.train(network, inputs, targets, reps)
neuro.writeNetworkToFile("results.net", network)