Skip to content

Instantly share code, notes, and snippets.

@mjs2600
Created February 27, 2015 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjs2600/ef3dccb0eb261742b802 to your computer and use it in GitHub Desktop.
Save mjs2600/ef3dccb0eb261742b802 to your computer and use it in GitHub Desktop.
NN Cost Function
class Trainer(object):
def __init__(self, nn, data, label):
self.nn = nn
self.data = data
self.label = label
def __call__(self, weights):
from pybrain.utilities import percentError
self.nn._setParameters(weights)
output = self.nn.activateOnDataset(self.data)
return percentError(output, self.label)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment