Skip to content

Commit

Permalink
chore: using local file of mnist dataset instead of using keras package
Browse files Browse the repository at this point in the history
  • Loading branch information
disooqi committed Feb 16, 2024
1 parent 460580e commit 2ccabeb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Binary file added examples/data/mnist.npz
Binary file not shown.
16 changes: 10 additions & 6 deletions examples/mnist_original.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
98.58%
"""
import numpy as np
from keras.datasets import mnist
from natasy.data_preparation import Dataset
from natasy.neural_network.network import NeuralNetwork
from natasy.neural_network import Activation
from natasy.optimization import Optimizer
# from keras.datasets import mnist
from labeeb.data_preparation import Dataset
from labeeb.neural_network.network import NeuralNetwork
from labeeb.neural_network import Activation
from labeeb.optimization import Optimizer

class MNISTDataset(Dataset):
def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -55,7 +55,11 @@ def accuracy(self, network, training_accuracy=False):


if __name__ == '__main__':
(x_train, y_train), (x_test, y_test) = mnist.load_data()
with np.load("./data/mnist.npz", allow_pickle=True) as f:
x_train, y_train = f['x_train'], f['y_train']
x_test, y_test = f['x_test'], f['y_test']
# return (x_train, y_train), (x_test, y_test)
# (x_train, y_train), (x_test, y_test) = mnist.load_data()
mnist = MNISTDataset(train=(x_train, y_train), dev=(x_test, y_test))

nn01 = NeuralNetwork(n_features=784, n_classes=10)
Expand Down

0 comments on commit 2ccabeb

Please sign in to comment.