Scheem is a lightweight, from-scratch neural network framework built entirely in Python from scratch (use numpy for fast calculation)
Here is how to use Scheem to solve the classic non-linear XOR Problem.
from scheem import Scheem
X = [
[0, 0],
[0, 1],
[1, 0],
[1, 1]
]
Y = [
[0],
[1],
[1],
[0]
]
# Supported Activation Functions: sigmoid, relu, softmax
activation = ["sigmoid", "sigmoid"]
# Architecture: 2 inputs, 2 hidden neurons, 1 output
model = Scheem([2, 2, 1], activation, X, Y)
model.train(iters=10000, lr=1.0, log_after=1000)
# Iteration: 0 | Cost: 0.68658831
# Iteration: 1000 | Cost: 0.01567361
# Iteration: 2000 | Cost: 0.00599156
# Iteration: 3000 | Cost: 0.00367255
# Iteration: 4000 | Cost: 0.00264094
# Iteration: 5000 | Cost: 0.00205936
# Iteration: 6000 | Cost: 0.00168660
# Iteration: 7000 | Cost: 0.00142752
# Iteration: 8000 | Cost: 0.00123710
# Iteration: 9000 | Cost: 0.00109129
model.accuracy(X, Y) # generally X_test and Y_test
# np.float64(1.0)
model.predict([0, 0])
# array([[0.00090511]])- For more demos check out demo directory
- For other implementation check out other
- Build the Core Layers in Rust or C++ for Performance
- Build in Numpy for simplicity and performance