Skip to main content

Kittylyst

kitty

A tiny Catalyst-like experiment runner framework on top of micrograd.

Implements Experiment, Runner and Callback Catalyst-core abstractions and has extra PyTorch-like micrograd modules - MicroLoader, MicroCriterion, MicroOptimizer and MicroScheduler.

Every module is tiny, with about 100 lines of code (even this readme). However, this is enough to make Kittylyst easily extendable for any number of data sources and support multi-stage experiments, as the demo notebook shows.

Potentially useful for educational purposes.

Installation

pip install kittylyst

Example usage

from micrograd.nn import MLP
import kittylyst as kt

loaders = {"train": kt.MicroLoader(...), "valid": kt.MicroLoader(...)}
model = MLP(2, [16, 16, 1])
criterion = kt.MicroCriterion()
optimizer = kt.MicroOptimizer(model)
scheduler = kt.MicroScheduler(optimizer, num_epochs=10)
experiment = kt.Experiment(
    model=model,
    criterion=criterion,
    optimizer=optimizer,
    scheduler=scheduler,
    loaders=loaders,
    num_epochs=10,
    callbacks=[
        kt.CriterionCallback(),
        kt.AccuracyCallback(),
        kt.OptimizerCallback(),
        kt.SchedulerCallback(),
        kt.LoggerCallback(),
    ],
    verbose=True,
)

kt.SupervisedRunner().run_experiment(experiment)

Running an experiment

The notebook demo.ipynb provides a full demo of running an Experiment with SupervisedRunner for binary classification task. This is achieved by training MLP from micrograd module with a simple svm "max-margin" binary classification loss (MicroCriterion) and SGD (MicroOptimizer) with learning rate decay (MicroScheduler).

As shown in the notebook, using a 2-layer neural net with two 16-node hidden layers we achieve the following decision boundary on the moon dataset:

2d neuron

Running codestyle

To run the codestyle check you will have to install catalyst-codestyle. Then simply:

catalyst-make-codestyle

License

MIT

Metadata

Release files for kittylyst 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kittylyst 0.1.0
File Size Uploaded
kittylyst-0.1.0.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kittylyst 0.1.0
File Interpreter ABI Platform
kittylyst-0.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 12.7 kB

Release files / kittylyst-0.1.0.tar.gz

Download URL kittylyst-0.1.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8bb978ff84c032b287fc1f9a825a9ad47cf1ac1a8100513270d85122537b3120
BLAKE2b-256 checksum
How to use checksums
76d797327091d5aad8afd15cef901adcc6fe9dbf16b32b859a39e0169ab54928
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Release files / kittylyst-0.1.0-py2.py3-none-any.whl

Download URL kittylyst-0.1.0-py2.py3-none-any.whl
Size 7.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
bdf1230fd2a3e5a02c4cc60acb0a88a3a80feb5bf18e532da221fc87e3b5b5cb
BLAKE2b-256 checksum
How to use checksums
81977723e798e4147333aa9184fa764ac9923e4830b78e5430856d7573ca3534
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page