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.2.tar.gz (7.7 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.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for easyvae-1.3.2.tar.gz
Algorithm Hash digest
SHA256 291be6e39031fdf1a2b6a4697e39ebecb7c770089feb93618187d316795255c8
MD5 89c99822698f62b17e1c63c1c5555e6a
BLAKE2b-256 a71e608ef83b8e2bf45778348cda3e0e3bc17570d05efca66b568c6666aa7d28

See more details on using hashes here.

File details

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

File metadata

  • Download URL: easyvae-1.3.2-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.10.12

File hashes

Hashes for easyvae-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 528ea8c2077f74ff61863441653ff77c64aa23a58c9e4c3b9653563f9cd60488
MD5 59240ccf22273aa3f50677f95f7846a1
BLAKE2b-256 de5f42d4a56d2af08ab2ed174aa36d73363a28e69585146303ab780a4e12d5a9

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