I'm wanting to try out ffnet but I get the following error when I try to run the example sin.py.
Note: This problem occurs with both the 0.6 ffnet Windows binary from sourceforge and the latest svn version. I also tried two versions of networkx. I'm running windows XP.
networkx.__version__ = '0.33-svn' / '0.36-svn'
scipy.__version__ = '0.6.dev3271'
numpy.__version__ = '1.0.2.dev3543'
It looks like a very interesting package so any help getting it up and running would be greatly appreciated!
Error is as shown below:
NB: the same error occurs executing net(conec)
Feed-forward neural network:
connections and biases: 13
0-th dimension must be fixed to 1 but got 13
<class '_ffnet.error'> Traceback (most recent call last)
C:\src\ffnet\examples\sin.py in <module>()
45 print "TESTNG NETWORK..."
---> 46 output, regression = net.test(input, target, iprint = 2)
48 # Make some plots
C:\Python25\Lib\site-packages\ffnet\ffnet.py in test(self, input, target, iprint
753 input, target = self._testdata(input, target)
754 nump = len(input)
--> 755 output = array([self(inp) for inp in input])
756 # Calculate regression info
757 from scipy.stats import linregress
C:\Python25\Lib\site-packages\ffnet\ffnet.py in __call__(self, inp)
325 def __call__(self, inp):
326 output = netprop.normcall(self.weights, self.conec, self.units,
--> 327 self.inno, self.outno, self.eni, self.
328 return output.tolist()
<class '_ffnet.error'>: failed in converting 2nd argument `conec' of _ffnet.norm
call to C/Fortran array
WARNING: Failure executing file: <sin.py>
I know this error. It occurs when you use svn version of scipy and the tnc agorithm. The scipy people changed recently the output order of the fmin_tnc function. You have a couple of choices to fix this for now: 1. switch to the release version os scipy, 2. use another training function, 3. go to ffnet.py module, the line:
self.weights = optimize.fmin_tnc(.......)[ -1 ]
and change it to:
self.weights = optimize.fmin_tnc(.......)[ 0 ]
Also, in a short time, i'll try to get it to work for both cases and i commit the result to the svn.
Thanks for the quick reply - that fixed the problem!