Lightweight neual network library project.
Project description
HOX
HOX is not an alternative to big ml library like pytorch or tensorflow, it lacks features and optimization, such as gpu support. The goal is to create a lightweight library (< 100 lines of code) that is easy to use and quick to implement for creating small projects or experiment with ml.pip install hox
examples/mnist
train.py
from hox import *
import utils
#Create model (2 layers, 784 input neurons, 144 first layer, 10 output layer)
model = Model.create([Layer(784, 144, Relu()), Layer(144, 10, Sigmoid())])
#Upload mnist dataset
X, Y, x, y = utils.mnist()
#Shuffle the dataset to improve training stability
indices = np.random.permutation(len(X))
X, Y = X[indices], Y[indices]
#Train the model
model.train(X, Y, epochs = 1, rate = 2, batch_size = 16)
#Save the trained model
model.save("mnist")
accuracy.py
from hox import *
import utils
#Load model
model = Model.load("mnist")
#Upload mnist dataset
X, Y, x, y = utils.mnist()
#Accuracy tested on test10k data (x, y)
counter = 0
for i in range(len(x)):
if np.argmax(model.forward(x[i])) == y[i]:
counter +=1
print(str((counter*100)/len(y)) + "% accuracy")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hox-1.2.0.tar.gz
(3.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
hox-1.2.0-py3-none-any.whl
(4.5 kB
view details)
File details
Details for the file hox-1.2.0.tar.gz.
File metadata
- Download URL: hox-1.2.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a03b228ac464f2154f7ef35249bd090ecd6494ce78acf443fa4d012c371e92c0
|
|
| MD5 |
20495fd7c36f785766e87d5d29898810
|
|
| BLAKE2b-256 |
7076305a715ea634d748d9267164a492b37e286234d566ae7fe66c139a11b65f
|
File details
Details for the file hox-1.2.0-py3-none-any.whl.
File metadata
- Download URL: hox-1.2.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ef78ca45cd9e92864dbe2cc8a143d1fd43db6f49c4b4921f94aade99710d22c
|
|
| MD5 |
9a30ce3429523b7dcb9eef111b37ce77
|
|
| BLAKE2b-256 |
b64fd57a081c96b6994b40528af0384027b6ae2add72e03bf64b6ed26618a3ae
|