Skip to main content

Python implementation of a Classical and Variational Autoencoders using NumPy

Project description

Python AutoEncoder from scratch using Numpy

Latent-space of the MNIST dataset

Latent-space representation of the MNIST dataset using Variational Autoencoder

Usage

  1. To install from source :
$ git clone git@github.com:lenoctambule/autoencoder.git
$ pip install -e autoencoder/

Or install from PyPI :

$ pip install easyvae
  1. Optionally, run mnist_test.py to see it in action on the MNIST dataset.
$ cd examples
$ py mnist_test.py 

Training

Instatiate an ClassicalAutoencoder or VariationalAutoencoder object :

from easyvae.autoencoder import ClassicalAutoencoder, VariationalAutoencoder
from easyvae.activations import LeakyReLU

autoencoder = ClassicalAutoencoder(
    [768, 64, 16],
    [16, 64, 768],
    0.01,
    LeakyReLU()
)
# or
autoencoder = VariationalAutoencoder(
    [768, 64, 16],
    [16, 64, 768],
    0.01,
    LeakyReLU()
)

And then via the train_dataset method to train over a dataset :

autoencoder.train_dataset(data)

Or via the train method to input each data points iteratively :

autoencoder.train(v)

After training, you can save your model via the save method and load that model using load method :

autoencoder.save("mymodel.npy")
autoencoder.load("mymodel.npy")

Inference

Use your Autoencoder object with the encode, decode, forward methods like so :

example = ...
code = autoencoder.encode(example)
output = autoencoder.decode(code)
output, code = autoencoder.forward(example)

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

easyvae-1.3.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easyvae-1.3-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file easyvae-1.3.tar.gz.

File metadata

  • Download URL: easyvae-1.3.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for easyvae-1.3.tar.gz
Algorithm Hash digest
SHA256 c71efc3717b71de96b61b1290cf3fdac45f8075e3344ff3cd80ff6c435b35d1b
MD5 2ecc2eaa40c9a8b7eebc48a7c767c493
BLAKE2b-256 164f672fbdd54adb32398cd07811094a36586ab8e10bd002b5888d33e117bba0

See more details on using hashes here.

File details

Details for the file easyvae-1.3-py3-none-any.whl.

File metadata

  • Download URL: easyvae-1.3-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for easyvae-1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2e7e4b7ff13a78f81a110097cdccd99f7df876a7120def9daefacbff2f44e8d0
MD5 b07d65d36d7cef587a88ab50373a5896
BLAKE2b-256 15eb86adfb1663c613a83fc7311ee86de07bd8e1db226dab69c9931c1cf0293f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page