Training a Neural Network to predict the output of a power plant
Neural networks are really powerful regressors, capable of fitting almost any arbitrary data. In this example, however, we will use a simple model to fit the data as we already know our data exerts a linear relationship.
Getting ready
To execute this recipe, you will need pandas
and PyBrain
. No other prerequisites are required.
How to do it…
We specify the fitANN(...)
method in a very similar way as we did in Chapter 3, Classification Techniques (the regression_ann.py
file). For brevity, some of the import statements have been removed:
import pybrain.structure as st import pybrain.supervised.trainers as tr import pybrain.tools.shortcuts as pb @hlp.timeit def fitANN(data): ''' Build a neural network regressor[1] ''' # create the regressor object ann = pb.buildNetwork(inputs_cnt, inputs_cnt * 3, target_cnt, hiddenclass=st.TanhLayer, outclass=st.LinearLayer, bias=True...