if krui.setFirstSite() :
		print "Selected site", krui.getSiteName()
	else :
		print "No site for current unit found"

	headline("unit functions")
	print "Unit 1 has the name", krui.getUnitName(1)
	print "Setting the name to foo"
	krui.setUnitName(1,"foo")
	print "Unit with name 'u35' has number", krui.searchUnitName("u35")

	for i in range(1,4) :
		print "Position of unit %d:" % i, krui.getUnitPosition(i)
	print "Swapping units 1 and 3"
	pos = krui.getUnitPosition(3)
	krui.setUnitPosition(3,krui.getUnitPosition(1))
	krui.setUnitPosition(1,pos)
	for i in range(1,4) :
		print "Position of unit %d:" % i, krui.getUnitPosition(i)
	pos = (2,1,0)
	print "Unit at position", pos, "has number", krui.getUnitNoAtPosition(pos,0)
	print "Next unit to the origin is unit",
	print krui.getUnitNoNearPosition((0,0,0),0,10,10)
	print "Setting unit center for unit 1, center 0"
	krui.setUnitCenters(1,0,(1.2,1.3,1.4,1.5))
	print "Unit centers for unit 1 and center 0:", str(krui.getUnitCenters(1,0))
	print "Input type of unit 10:", util.unit_input_types[krui.getUnitInputType(10)]
	print "Unit defaults:", krui.getUnitDefaults()


except:
Beispiel #2
0
krui.setLearnFunc('Std_Backpropagation')
krui.setUpdateFunc('Topological_Order')
krui.setUnitDefaults(1, 0, krui.INPUT, 0, 1, 'Act_Logistic', 'Out_Identity')

print "Creating the network out of thin air"

# build the input layer
pos = [0, 0, 0]
inputs = []
for i in range(1, 9):
    pos[0] = i
    num = krui.createDefaultUnit()
    inputs.append(num)
    krui.setUnitName(num, 'Input_%i' % i)
    krui.setUnitPosition(num, pos)
# hidden layer
pos[1] = 2
hidden = []
for i in range(1, 4):
    pos[0] = i + 3
    num = krui.createDefaultUnit()
    hidden.append(num)
    krui.setUnitName(num, 'Hidden_%i' % i)
    krui.setUnitTType(num, krui.HIDDEN)
    krui.setUnitPosition(num, pos)
    krui.setCurrentUnit(num)
    for src in inputs:
        krui.createLink(src, 0)

# output layer
Beispiel #3
0
    if krui.setFirstSite():
        print "Selected site", krui.getSiteName()
    else:
        print "No site for current unit found"

    headline("unit functions")
    print "Unit 1 has the name", krui.getUnitName(1)
    print "Setting the name to foo"
    krui.setUnitName(1, "foo")
    print "Unit with name 'u35' has number", krui.searchUnitName("u35")

    for i in range(1, 4):
        print "Position of unit %d:" % i, krui.getUnitPosition(i)
    print "Swapping units 1 and 3"
    pos = krui.getUnitPosition(3)
    krui.setUnitPosition(3, krui.getUnitPosition(1))
    krui.setUnitPosition(1, pos)
    for i in range(1, 4):
        print "Position of unit %d:" % i, krui.getUnitPosition(i)
    pos = (2, 1, 0)
    print "Unit at position", pos, "has number", krui.getUnitNoAtPosition(
        pos, 0)
    print "Next unit to the origin is unit",
    print krui.getUnitNoNearPosition((0, 0, 0), 0, 10, 10)
    print "Setting unit center for unit 1, center 0"
    krui.setUnitCenters(1, 0, (1.2, 1.3, 1.4, 1.5))
    print "Unit centers for unit 1 and center 0:", str(
        krui.getUnitCenters(1, 0))
    print "Input type of unit 10:", util.unit_input_types[
        krui.getUnitInputType(10)]
    print "Unit defaults:", krui.getUnitDefaults()
krui.setLearnFunc('Std_Backpropagation')
krui.setUpdateFunc('Topological_Order')
krui.setUnitDefaults(1,0,krui.INPUT,0,1,'Act_Logistic','Out_Identity')

print "Creating the network out of thin air"

# build the input layer
pos = [0,0,0]
inputs = []
for i in range(1,9) :
	pos[0] = i
	num = krui.createDefaultUnit()
	inputs.append(num)
	krui.setUnitName(num,'Input_%i' % i)
	krui.setUnitPosition(num, pos)
# hidden layer
pos[1]=2
hidden = []
for i in range(1,4) :
	pos[0] = i + 3
	num = krui.createDefaultUnit()
	hidden.append(num)
	krui.setUnitName(num,'Hidden_%i' % i)
	krui.setUnitTType(num,krui.HIDDEN)
	krui.setUnitPosition(num,pos)
	krui.setCurrentUnit(num)
	for src in inputs :
		krui.createLink(src,0)

# output layer