MCPcopy Create free account
hub / github.com/DanielShalam/BPA / loop

Method loop

methods/pt_map/evaluation/test_standard.py:157–178  ·  view source on GitHub ↗
(self, model, n_epochs=20)

Source from the content-addressed store, hash-verified

155 print("output model accuracy", acc)
156
157 def loop(self, model, n_epochs=20):
158
159 self.probas = model.getProbas()
160 if self.verbose:
161 print("initialisation model accuracy", self.getAccuracy(self.probas))
162
163 if self.progressBar:
164 if type(self.progressBar) == bool:
165 pb = tqdm(total = n_epochs)
166 else:
167 pb = self.progressBar
168
169 for epoch in range(1, n_epochs+1):
170 if self.verbose:
171 print("----- epoch[{:3d}] lr_p: {:0.3f} lr_m: {:0.3f}".format(epoch, self.alpha))
172 self.performEpoch(model, epochInfo=(epoch, n_epochs))
173 if (self.progressBar): pb.update()
174
175 # get final accuracy and return it
176 op_xj = model.getProbas()
177 acc = self.getAccuracy(op_xj)
178 return acc
179
180
181if __name__ == '__main__':

Callers 1

test_standard.pyFile · 0.45

Calls 4

getAccuracyMethod · 0.95
performEpochMethod · 0.95
getProbasMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected