Error

Dave
2007-09-11
2013-04-23
  • Dave
    Dave
    2007-09-11

    Hi,
    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!

    Thanks,
    Dave

    Error is as shown below:
    NB: the same error occurs executing net(conec)

    TESTNG NETWORK...
    Feed-forward neural network:
    inputs:     1
    hiddens:    4
    outputs:    1
    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>()
         44 print
         45 print "TESTNG NETWORK..."
    ---> 46 output, regression = net.test(input, target, iprint = 2)
         47
         48 # Make some plots

    C:\Python25\Lib\site-packages\ffnet\ffnet.py in test(self, input, target, iprint
    , filename)
        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.
    deo, inp)
        328         return output.tolist()
        329

    <class '_ffnet.error'>: failed in converting 2nd argument `conec' of _ffnet.norm
    call to C/Fortran array
    WARNING: Failure executing file: <sin.py>

     
    • Marek
      Marek
      2007-09-12

      Hi!

      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.

      Greetings
      Marek

       
    • Dave
      Dave
      2007-09-12

      Thanks for the quick reply - that fixed the problem!

      -Dave