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")
Metadata
Release files for hox 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hox-1.2.0.tar.gz | 3.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hox-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.7 kB
Release files / hox-1.2.0.tar.gz
| Download URL | hox-1.2.0.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a03b228ac464f2154f7ef35249bd090ecd6494ce78acf443fa4d012c371e92c0
|
|
BLAKE2b-256 checksum How to use checksums |
7076305a715ea634d748d9267164a492b37e286234d566ae7fe66c139a11b65f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.0
|
Release files / hox-1.2.0-py3-none-any.whl
| Download URL | hox-1.2.0-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ef78ca45cd9e92864dbe2cc8a143d1fd43db6f49c4b4921f94aade99710d22c
|
|
BLAKE2b-256 checksum How to use checksums |
b64fd57a081c96b6994b40528af0384027b6ae2add72e03bf64b6ed26618a3ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.0
|