It's exactly the example in the docs just with more samples.
Here is a sample of code
In [1]: import numpy
In [2]: import bob.learn.mlp
In [3]: mlp = bob.learn.mlp.Machine((3, 3, 2, 1))
In [4]: input_to_hidden0 = numpy.ones((3,3), 'float64')
In [5]: hidden0_to_hidden1 = 0.5*numpy.ones((3,2), 'float64')
In [6]: hidden1_to_output = numpy.array([0.3, 0.2], 'float64').reshape(2,1)
In [7]: bias_hidden0 = numpy.array([-0.2, -0.3, -0.1], 'float64')
In [8]: bias_hidden1 = numpy.array([-0.7, 0.2], 'float64')
In [9]: bias_output = numpy.array([0.5], 'float64')
In [10]: mlp.weights = (input_to_hidden0, hidden0_to_hidden1, hidden1_to_output)
In [11]: mlp.biases = (bias_hidden0, bias_hidden1, bias_output)
In [12]: d0 = numpy.array([[.3, .7, .5], [.2, .1, .6]]) # input
In [13]: t0 = numpy.array([[.0], [1.0]]) # target
In [14]: trainer = bob.learn.mlp.BackProp(1,
bob.learn.mlp.SquareError(mlp.output_activation), mlp,
train_biases=False) # Creates a BackProp trainer with a batch size of
1
In [15]: trainer.train(mlp, d0, t0) # Performs the Back Propagation
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-15-24b52d1aed62> in <module>()
----> 1 trainer.train(mlp, d0, t0) # Performs the Back Propagation
RuntimeError: array dimensions do not match 1 != 2
> You received this message because you are subscribed to a topic in the
> Google Groups "bob-devel" group.
> To unsubscribe from this topic, visit
>
https://groups.google.com/d/topic/bob-devel/aqDH5YzT4J0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to