Skip to content

zhanwenchen/nn_numpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Neural Network with NumPy

A simple logistic regression library built with NumPy.

Example Usage

from network import Network

train_X = train_images # (28*28*1=784, 60000)
train_Y = train_labels # (1, 60000)
test_X = test_images # (28*28*1=784, 10000)
test_Y = test_labels # (1, 10000)
num_hidden_layers = 3
layer_width = 5
learning_rate = 0.1
num_iterations = 3000

nn = Network(train_X, train_Y, num_hidden_layers, layer_width)
costs = nn.fit(train_X, train_Y, learning_rate, num_iterations)
print("test accuracy = %s" % (nn.evaluate(test_X, test_Y)))

# Visualize for a single
test_example_5 = test_X[:,4]
predicted_label_for_one_example = nn.predict(test_example_5)
print("For one example, the nn predicted", predicted_label_for_one_example)

About

Neural networks with NumPy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages