How to save and recover PyBrain training?

后端 未结 3 1204
心在旅途
心在旅途 2020-12-07 16:04

Is there a way to save and recover a trained Neural Network in PyBrain, so that I don\'t have to retrain it each time I run the script?

3条回答
  •  抹茶落季
    2020-12-07 16:15

    NetworkWriter is the way to go. Using Pickle you can't retrain network as Jorg tells.

    You need something like this:

    from pybrain.tools.shortcuts import buildNetwork
    from pybrain.tools.customxml import NetworkWriter
    from pybrain.tools.customxml import NetworkReader
    
    net = buildNetwork(4,6,1)
    
    NetworkWriter.writeToFile(net, 'filename.xml')
    net = NetworkReader.readFrom('filename.xml')
    

提交回复
热议问题