Skip to content

Instantly share code, notes, and snippets.

@SkalskiP
Last active May 30, 2020 17:16
Show Gist options
  • Save SkalskiP/8c61fdfe011fa89e827f331fca29aaaa to your computer and use it in GitHub Desktop.
Save SkalskiP/8c61fdfe011fa89e827f331fca29aaaa to your computer and use it in GitHub Desktop.
Sequential Model
def train(
self, x_train: np.array, y_train: np.array,
epochs: int, batch_size: int = 64,
) -> None:
for epoch in range(epochs):
for x_batch, y_batch in generate_batches(x_train, y_train, batch_size):
y_hat_batch = self._forward(x_batch)
activation = y_hat_batch - y_batch
self._backward(activation)
self._update()
def predict(self, x: np.array) -> np.array:
return self._forward(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment