Creating a Network
To create a network, PyBrain provides us with pybrain.tools.shortcuts. We can import buildNetwork shortcuts from this. The source code is given below,
Python3
# Python program to demonstrate how to create a network # Import libraries from pybrain.tools.shortcuts import buildNetwork # Creating a network # This network has two inputs, four hidden # and one output neuron myNetwork = buildNetwork( 2 , 4 , 1 ) print (myNetwork) |
Output:
FeedForwardNetwork-8
Modules:
[<BiasUnit ‘bias’>, <LinearLayer ‘in’>, <SigmoidLayer ‘hidden0’>, <LinearLayer ‘out’>]
Connections:
[<FullConnection ‘FullConnection-4’: ‘hidden0’ -> ‘out’>, <FullConnection ‘FullConnection-5’: ‘in’ -> ‘hidden0’>, <FullConnection ‘FullConnection-6’: ‘bias’ -> ‘out’>, <FullConnection ‘FullConnection-7’: ‘bias’ -> ‘hidden0’>]
How To Save The Network In XML File Using PyBrain
In this article, we are going to see how to save the network in an XML file using PyBrain in Python.
A network consists of several modules. These modules are generally connected with connections. PyBrain provides programmers with the support of neural networks. A network can be interpreted as an acyclic directed graph where each module serves the purpose of vertex/node and connections are assumed to edge.