(self, network)
| 37 | raise NotImplementedError |
| 38 | |
| 39 | def train_epoch(self, network): |
| 40 | losses = [] |
| 41 | |
| 42 | # Create batch iterator |
| 43 | X_batch = batch_iterator(network.X, network.batch_size) |
| 44 | y_batch = batch_iterator(network.y, network.batch_size) |
| 45 | |
| 46 | batch = zip(X_batch, y_batch) |
| 47 | if network.verbose: |
| 48 | batch = tqdm( |
| 49 | batch, total=int(np.ceil(network.n_samples / network.batch_size)) |
| 50 | ) |
| 51 | |
| 52 | for X, y in batch: |
| 53 | loss = np.mean(network.update(X, y)) |
| 54 | self.update(network) |
| 55 | losses.append(loss) |
| 56 | |
| 57 | epoch_loss = np.mean(losses) |
| 58 | return epoch_loss |
| 59 | |
| 60 | def train_batch(self, network, X, y): |
| 61 | loss = np.mean(network.update(X, y)) |
no test coverage detected