(self, model, n_epochs=20)
| 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 | |
| 181 | if __name__ == '__main__': |
no test coverage detected