Skip to content

Handmade neural network library, made for learning purposes.

Notifications You must be signed in to change notification settings

Descrout/cobweb-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Handmade neural network library, made for learning purposes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages