本文整理汇总了Python中ctu.nengoros.comm.nodeFactory.NodeGroup类的典型用法代码示例。如果您正苦于以下问题:Python NodeGroup类的具体用法?Python NodeGroup怎么用?Python NodeGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NodeGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fuzzynot_node
def fuzzynot_node(name):
g = NodeGroup("FuzzyNOT", True);
g.addNode(fNOT, "FuzzyNOT", "java");
module = NeuralModule(name+'_FuzzyNOT', g)
module.createEncoder("logic/gates/ina", "float", 1)
module.createDecoder("logic/gates/outa", "float", 1)
return module
示例2: async_timeaware_node
def async_timeaware_node(name):
g = NodeGroup("AsynTimeAwareNode", True);
g.addNode(time, "AsynTimeAwareNode", "java");
module = NeuralModule(name+'_AsynTimeAwareNode', g, False)
module.createEncoder("org/hanns/demonodes/pubsub/IN", "float", 4)
module.createDecoder("org/hanns/demonodes/pubsub/OUT", "float", 2)
return module
示例3: sync_timeaware_node
def sync_timeaware_node(name):
g = NodeGroup("SynMinMaxFloat", True);
g.addNode(time, "SynMinMaxFloat", "java");
module = NeuralModule(name+'_SynMinMaxFloat', g)
module.createEncoder("org/hanns/demonodes/pubsub/IN", "float", 4)
module.createDecoder("org/hanns/demonodes/pubsub/OUT", "float", 2)
return module
示例4: sync_minmaxfloat_node
def sync_minmaxfloat_node(name):
g = NodeGroup("SynMinMaxFloat", True);
g.addNode(mmf, "SynMinMaxFloat", "java");
module = NeuralModule(name+'_SynMinMaxFloat', g) # here: Nengo waits each step for response from node
module.createEncoder("org/hanns/demonodes/pubsub/IN", "float", 4)
neuron.createDecoder("org/hanns/demonodes/pubsub/OUT", "float", 2) # add FLOAT publisher
return module
示例5: async_minmaxfloat_node
def async_minmaxfloat_node(name):
g = NodeGroup("AsynMinMaxFloat", True);
g.addNode(mmf, "AsynMinMaxFloat", "java");
module = NeuralModule(name+'_AsynMinMaxFloat', g, False)
module.createEncoder("org/hanns/demonodes/pubsub/IN", "float", 4)
module.createDecoder("org/hanns/demonodes/pubsub/OUT", "float", 2)
return module
示例6: sync_minmaxint_node
def sync_minmaxint_node(name):
g = NodeGroup("SynMinMaxInt", True);
g.addNode(minmaxint, "SynMinMaxInt", "java");
module = NeuralModule(name+'_SynMinMaxInt', g) # here: Nengo waits each step for response from node
module.createEncoder("org/hanns/demonodes/pubsub/IN", "float", 4)
module.createDecoder("org/hanns/demonodes/pubsub/OUT", "int", 2)
return module
示例7: not_node
def not_node(name):
g = NodeGroup("NOT", True);
g.addNode(NOT, "NOT", "java");
module = NeuralModule(name+'_NOT', g)
module.createEncoder("logic/gates/ina", "bool", 1)
module.createDecoder("logic/gates/outa", "bool", 1)
return module
示例8: nand_node
def nand_node(name):
g = NodeGroup("NAND", True);
g.addNode(NAND, "NAND", "java");
module = NeuralModule(name+'_NAND', g)
module.createEncoder("logic/gates/ina", "bool", 1)
module.createEncoder("logic/gates/inb", "bool", 1)
module.createDecoder("logic/gates/outa", "bool", 1)
return module
示例9: fuzzyand_node
def fuzzyand_node(name):
g = NodeGroup("FuzzyAND", True);
g.addNode(fAND, "FuzzyAND", "java");
module = NeuralModule(name+'_FuzzyAND', g)
module.createEncoder("logic/gates/ina", "float", 1)
module.createEncoder("logic/gates/inb", "float", 1)
module.createDecoder("logic/gates/outa", "float", 1)
return module
示例10: or_node
def or_node(name):
g = NodeGroup("OR", True);
g.addNode(OR, "OR", "java");
module = NeuralModule(name+'_OR', g)
module.createEncoder("logic/gates/ina", "bool", 1)
module.createEncoder("logic/gates/inb", "bool", 1)
module.createDecoder("logic/gates/outa", "bool", 1)
return module
示例11: fuzzyMemIncLin
def fuzzyMemIncLin(name): # ____|----
g = NodeGroup("FuzzyMemIncLin", True);
g.addNode(flininc,"FuzzyMemIncLin","java");
module = NeuralModule(name+'_FuzzyMemIncLin', g)
module.createEncoder("logic/gates/ina", "float", 1) # x
module.createEncoder("logic/gates/confa", "float", 1) # alpha
module.createEncoder("logic/gates/confb", "float", 1) # beta
module.createDecoder("logic/gates/outa", "float", 1) # y
return module
示例12: fuzzyMemTriangle
def fuzzyMemTriangle(name): # ____|\____
g = NodeGroup("FuzzyMemTriangle", True);
g.addNode(ftriangle,"FuzzyMemTriangle","java");
module = NeuralModule(name+'_FuzzyMemTriangle', g)
module.createEncoder("logic/gates/ina", "float", 1) # x
module.createEncoder("logic/gates/confa", "float", 1) # alpha
module.createEncoder("logic/gates/confb", "float", 1) # beta
module.createEncoder("logic/gates/confc", "float", 1) # gamma
module.createDecoder("logic/gates/outa", "float", 1) # y
return module
示例13: make
def make(net,name='NeuralModule which interfaces demoSubscriber with the Nengo simulator', independent=True, useQuick=True):
node = "org.hanns.demonodes.pubsub.DemoSubscriber";
g = NodeGroup(name, independent); # Create group of nodes (represented as SimpleNode in the GUI)
g.addNode(node, "subscriber", "java"); # start java node and name it subscriber in the ROS network
module = NeuralModule('Subscriber_'+name, g, False) # Construct the neural module in the asynchronous mode
module.createEncoder("org/hanns/demonodes/pubsub", "float", 7) # Define IO: termination = input of neuron (n*int)
many=net.add(module) # add it into Nengo simulator
示例14: async_minmaxint_node
def async_minmaxint_node(name):
g = NodeGroup("AsynMinMaxInt", True); # create independent (True) group called..
g.addNode(minmaxint, "AsynMinMaxInt", "java"); # start java node and name it finder
module = NeuralModule(name+'_AsynMinMaxInt', g, False) # construct the Neural Module
# add encoder to the module (input)
# It is output on modem which is connected to input (topic name) to the ROS node
module.createEncoder("org/hanns/demonodes/pubsub/IN", "float", 4) # ..called TERMINATION of SimpleNode
# Add decoder to the module (output):
# It is input if modem which is connected to output (topic name) of the ROS node
module.createDecoder("org/hanns/demonodes/pubsub/OUT", "int", 2) # ..called ORIGIN of SimpleNode
return module
示例15: qlambdaASM
def qlambdaASM(name, noStateVars=2, noActions=4, noValues=5, logPeriod=100, maxDelay=1,
classname="org.hanns.rl.discrete.ros.sarsa.config.QlambdaCoverageReward",prospLen=3,synchronous=True):
"""Method that returns synchronous NeuralModule implementing the QLambda algorithm with
the ASM inbuilt. Configuration parameters of the node can be found in
the javadoc. Number of data inputs (size of the vector) to the module
is determined as 1+*noStateVars*, where the first element is the reward value.
The parameter *maxDelay* describes the number of time-steps in the closed-loop learning,
that is: how many time steps the module should wait before change of the state
to evalueate that the action had no-effect (state of the world has not changed).
Note: if the configEncoders (config INs) are not connected, the default values
are sent to the ROS node instead of zeros. So non-configured QLambda module
will learn with use of predefined parameters.
:param string mame: name of the neural module (TODO) to be created
:param integer noStateVars: number of state variables to be taken into account
:param integer noActions: number of actions the node can produce (encoding 1ofN is used)
:param integer noValues: the number of values that is expected for each state variable (interval [0,1] is sampled)
:param integer logPeriod: how often to print out the data
:param integer maxDelay: max delay in the closed-loop learning
:param string classname: full className of the ROS node to be launched
:param integer prospLen: size of the vector expected from the nodes prosperity publisher
:returns: NeuralModule that should be added into the network, the node represents the QLambda ROS node
"""
# this command is used to launch the ROSjava node
command = [classname, '_'+QLambda.noInputsConf+ ':=' + str(noStateVars),
'_'+QLambda.noOutputsConf+':='+str(noActions),
'_'+QLambda.sampleCountConf+':='+str(noValues),
'_'+QLambda.logPeriodConf+':='+str(logPeriod),
'_'+QLambda.filterConf+':='+str(maxDelay)]
# represent the ROS node by means of Neural Module
g = NodeGroup("RL", True);
g.addNode(command, "RL", "java");
module = NeuralModule(name+'_QLambda', g, synchronous)
# create config IO
module.createConfigEncoder(QLambda.topicAlpha,"float",QLambda.DEF_ALPHA); # alpha config input, def. value is DEF_ALPHA
module.createConfigEncoder(QLambda.topicGamma,"float",QLambda.DEF_GAMMA);
module.createConfigEncoder(QLambda.topicLambda,"float",QLambda.DEF_LAMBDA);
module.createEncoder(QLambda.topicImportance,"float",1); # default value is 0
# QLambdaCoverageReward classname => float[]{prosperity, coverage, reward/step}
module.createDecoder(QLambda.topicProsperity,"float", prospLen);
# create data IO
module.createDecoder(QLambda.topicDataOut, "float", noActions) # decode actions
module.createEncoder(QLambda.topicDataIn, "float", noStateVars+1) # encode states (first is reward)
return module