Skip to main content

Python implementation of a Classical and Variational Autoencoders

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for easyvae-1.2.tar.gz
Algorithm Hash digest
SHA256 6fd88d03d13c03021575f06e46da713bbfa3e4f441526d3b57e1f3e258162b14
MD5 71b2a56996f4f0185c3b9e55e9290bd0
BLAKE2b-256 1c9cdb8bdeb937b8d9ca68fe5842f0b318065cec72df75c4bfad38ce48cd5606

See more details on using hashes here.

File details

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

File metadata

  • Download URL: easyvae-1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8aaa05d8e7dba6821c0fb088fbe75de7b9b5b9fa6f8e0fdc83d3459101599780
MD5 420801d2e0ede297bf46905455113b65
BLAKE2b-256 e82134c4439734ca95055ac8bf1faab9887aa3d1677246b40b62f924836ad102

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