1

I am using a feedforward network from pybrain. I train it with currently available data. I want to store this network in mongodb so that in future with new available data, I could fetch this network and train it with more data(new ones) and save it back.

On saving it in mongodb it is raising error:

Traceback (most recent call last):
File "C:\Users\SATYA\Desktop\Pyth\Real Rail Status\neural_network.py", line 102, in <module>
    coll_neural_network.save(data)
  File "C:\Python27\lib\site-packages\pymongo\collection.py", line 288, in save
    manipulate, safe, check_keys=check_keys, **kwargs)
  File "C:\Python27\lib\site-packages\pymongo\collection.py", line 551, in update
    docs, check_keys, self.uuid_subtype, client)
InvalidDocument: Cannot encode object: <FeedForwardNetwork 'FeedForwardNetwork-5'>

Is there a way out to do this?

Satys
  • 2,319
  • 1
  • 20
  • 26
  • Clearly it doesn't know how you're expecting it to store a `FeedForwardNetwork` object in the database. How *were* you expecting it to do that? – jonrsharpe Apr 19 '15 at 09:55
  • I don't know, I thought I could directly save it with key as 'network' and value as the object. Can you tell me the methods for how to store such object in the database? Please ignore if I sound stupid. – Satys Apr 19 '15 at 10:00
  • I think you want to [pickle the object](http://stackoverflow.com/a/18090560/3497425) – kecer Apr 19 '15 at 10:19

0 Answers0