PyBrain Tutorial
Selected Reading
- PyBrain - Discussion
- PyBrain - Useful Resources
- PyBrain - Quick Guide
- PyBrain - Examples
- PyBrain - API & Tools
- PyBrain - Reinforcement Learning Module
- PyBrain - Connections
- PyBrain - Layers
- Training Network Using Optimization Algorithms
- PyBrain - Working with Recurrent Networks
- Working with Feed-Forward Networks
- PyBrain - Testing Network
- PyBrain - Training Datasets on Networks
- PyBrain - Importing Data For Datasets
- PyBrain - Datasets Types
- PyBrain - Working with Datasets
- PyBrain - Working with Networks
- PyBrain - Introduction to PyBrain Networks
- PyBrain - Environment Setup
- PyBrain - Overview
- PyBrain - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
PyBrain - Working with Networks
PyBrain - Working With Networks
A network is composed of modules, and they are connected using connections. In this chapter, we will learn to −
Create Network
Analyze Network
Creating Network
We are going to use python interpreter to execute our code. To create a network in pybrain, we have to use buildNetwork api as shown below −
C:pybrainpybrain>python Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "pcense" for more information. >>> >>> >>> from pybrain.tools.shortcuts import buildNetwork >>> network = buildNetwork(2, 3, 1) >>>
We have created a network using buildNetwork() and the params are 2, 3, 1 which means the network is made up of 2 inputs, 3 hidden and one single output.
Below are the details of the network, i.e., Modules and Connections −
C:pybrainpybrain>python Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "pcense" for more information. >>> from pybrain.tools.shortcuts import buildNetwork >>> network = buildNetwork(2,3,1) >>> print(network) FeedForwardNetwork-8 Modules: [<BiasUnit bias >, <LinearLayer in >, <SigmoidLayer hidden0 >, <LinearLay er out >] Connections: [<FullConnection FullConnection-4 : hidden0 -> out >, <FullConnection F ullConnection-5 : in -> hidden0 >, <FullConnection FullConnection-6 : bias -< out >, <FullConnection FullConnection-7 : bias -> hidden0 >] >>>
Modules consists of Layers, and Connection are made from FullConnection Objects. So each of the modules and connection are named as shown above.
Analyzing Network
You can access the module layers and connection inspanidually by referring to their names as follows −
>>> network[ bias ] <BiasUnit bias > >>> network[ in ] <LinearLayer in >Advertisements