Creating custom connectivity in PyBrain neural networks

前端 未结 2 785
终归单人心
终归单人心 2021-01-31 18:12

I want to create an artificial neural network (in PyBrain) that follows the following layout:

\"layout\"

Ho

2条回答
  •  爱一瞬间的悲伤
    2021-01-31 18:42

    An alternative way to the one suggested by schaul is to use multiple input layers.

    #create network
    net = FeedForwardNetwork()
    
    # create and add modules
    input_1 = LinearLayer(6)
    net.addInputModule(input_1)
    input_2 = LinearLayer(3)
    net.addInputModule(input_2)
    h1 = SigmoidLayer(2)
    net.addModule(h1)
    h2 = SigmoidLayer(2)
    net.addModule(h2)
    outp = SigmoidLayer(1)
    net.addOutputModule(outp)
    
    # create connections
    net.addConnection(FullConnection(input_1, h1))
    net.addConnection(FullConnection(input_2, h2))
    net.addConnection(FullConnection(h1, h2))
    net.addConnection(FullConnection(h2, outp))
    
    net.sortModules()
    

提交回复
热议问题