/korgorusz

Basic machine learning framework for creating neural networks

Primary LanguageJupyter NotebookGNU General Public License v3.0GPL-3.0

hmmm
Korgorusz

Korgorusz is a simple machine learning framework build on top of numpy.

Features

  • Modular design
  • Slow
  • No GPU support
  • Types
  • Depends only on numpy

One of the biggest advantages of Korgorusz is slowness - almost 10(~6.2) times slower than pytorch

plot time


Example

import numpy as np

from korgorusz.optimizers import SGDOptimizer
from korgorusz.layers import Linear
from korgorusz.activations import ReLU, Sigmoid
from korgorusz.utils import minibatch, mse, Model

x = np.random.randn(5,4)
y = np.random.randn(5,2)

optim = SGDOptimizer(learning_rate=0.01)
model = Model([
    Linear(4, 8),
    ReLU(),
    # ...
    Linear(8, 2),
    Sigmoid()])

for e in range(8):
    pred = model.forward(x)
    loss, d = mse(pred,y)
    model.backward(d)
    optim.update(model.layers_elements())

More examples in the notebooks.

Instalation

python -m venv venv
source venv/bin/activate
pip install korgorusz/.
# or
pip install korgorusz/.[dev]

Tests

pytest korgorusz    # test suite
mypy korgorusz      # type checks
black korgorusz     # formatting
pylint korgorusz/ -d R0903 --good-names=l2,x,y,i # linter

Implemented Algorithms

Activations

  • ReLU
  • Softmax
  • Sigmoid

Optimizers

  • SGD
  • Momentum
  • Adam

Losses

  • MSE
  • MAE
  • Cross-Entropy

Layers

  • Linear
  • Dropout
  • LayerNorm
  • Embedding

Name

Korgorusz is a slavic cat deamon.