MCPcopy Create free account
hub / github.com/rushter/MLAlgorithms / error

Method error

mla/neuralnet/nnet.py:134–149  ·  view source on GitHub ↗

Calculate an error for given examples.

(self, X=None, y=None)

Source from the content-addressed store, hash-verified

132 return params
133
134 def error(self, X=None, y=None):
135 """Calculate an error for given examples."""
136 training_phase = self.is_training
137 if training_phase:
138 # Temporally disable training.
139 # Some layers work differently while training (e.g. Dropout).
140 self.is_training = False
141 if X is None and y is None:
142 y_pred = self._predict(self.X)
143 score = self.metric(self.y, y_pred)
144 else:
145 y_pred = self._predict(X)
146 score = self.metric(y, y_pred)
147 if training_phase:
148 self.is_training = True
149 return score
150
151 @property
152 def is_training(self):

Callers 1

optimizeMethod · 0.80

Calls 1

_predictMethod · 0.95

Tested by

no test coverage detected