2

Is it possible to make a deep copy of a neural network in PYFANN (i.e. the python binding for FANN)? By a deep copy I mean a new completely independent neural net, with the same topology and weights.

I've seen copy functions and constructors in the FANN doc (http://leenissen.dk/fann/html/index/General.html), but could not see these in PYFANN.

Nikolay
  • 1,002
  • 11
  • 10

1 Answers1

0

I found a way to solve this - save to and load from a buffer file. It's not pretty but it works. Does anyone have a better idea?

Nikolay
  • 1,002
  • 11
  • 10
  • 1
    Can you describe how exactly you did this? I tried writing an ann-object to a StringIO buffer or a file, get "TypeError: must be convertible to a buffer, not neural_not". cPickle.dumps --> "can't pickle SwigPyObject". – ascripter Jan 31 '16 at 17:19
  • 1
    Ok, I understand: You probably used the save() and create_from_file() methods of the libfann.neural_net(). Ugly if you only need a backup during runtime, but it works. – ascripter Jan 31 '16 at 17:45
  • Yes, that's how I did it. – Nikolay Feb 03 '16 at 12:07