Skip to content
Lukáš Plevač edited this page Nov 30, 2019 · 6 revisions

Model is base class in lib. It allows you to merge individual layers and place them in your network, and then work with the neural network as a whole.

init code:

from PSNN import model

mymodel = model(array of layers objects)

init exmaple:

from PSNN import model, layers, activation

netmodel = model([
  layers.dense(2, activation.sigmoid()),
  layers.dense(1, activation.sigmoid())
])

Functions inside

  • model.dump(file) - dump network model to file with learned weights
  • model.dumps() - return dumped network model to string with learned weights
  • model.load(file) - load network model from file with learned weights
  • model.loads(str) - load dumped network model from string with learned weights
  • model.get(model) - get network model from server with learned weights
  • model.add(layer) - add layer to model
  • model.create(inputs) - create network and define howmany inputs network have
  • model.predict(inputs) - do prediction with network on inputs
  • model.clrmem() - clear recurrent base memory
  • model.mutate(rate) - randomly mutate network with rate
  • model.backPropagation(inputdata, target, lossfunc=MSE, rate=1) - do back propagation with (one) inputdata and target for it
  • model.backPropagationFit(self, inputs, targets, lossfunc=MSE, dynRateFunc=None, rate=1, epochs=1, offset=0) - do back propagation with inputs (array of input data) and targets (array of targets) for it
  • model.evolutionFit(self, inputs=None, targets=None, rate=1, replication=20, epochs=1, lossfunc=None, dynRateFunc=None, offset=0) - do evolution learning with inputs (array of input data) and targets (array of targets) for it
  • model.fit(self, inputs=None, targets=None, type="evolution", rate=1, replication=20, epochs=1, lossfunc=None, dynRateFunc=None, offset=0) - do specific type ("evolution", "layerEvolution" or "backPropagation") of learning with inputs (array of input data) and targets (array of targets) for it

Variables inside

  • model.debug = 0 - for debug network set 1, 2 or 3
  • model.poolSize = 4 - size of pool for multiprocessing
  • model.modelsServer = "http://80.211.100.17/PYSNN/" - address of server with models
Clone this wiki locally