Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 876 Bytes

README.md

File metadata and controls

40 lines (31 loc) · 876 Bytes

Cobweb

Inefficient but easy to understand neural network library.
Cobweb has been made from scratch.
It doesn't use any external library.
(not even numpy 😱)

Create a neural network

from cobweb import Cobweb
# inputs, outputs
nn = Cobweb(3, 4)
nn.add_layer(8)
nn.add_layer(16, activation="tanh") #default = sigmoid 

# Fully connected layers:
# 3 -> 8 -> 16 -> 4

Training (Backpropagation)

# inputs, label
nn.train([0.6, 0.88, 0.36], [1, 0, 0, 0])

Make a prediction

guess = nn.predict([0.6, 0.88, 0.36])
print(guess)

Save and Load Model

# Save
nn.save("filename.json")
# Load
loaded_nn = Cobweb.load("filename.json")

You can checkout cobweb/matris.py for the handmade matrix math class.