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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for easyvae-1.3.3.tar.gz
Algorithm Hash digest
SHA256 a6b3b3370e68a3d629259394b16c64aadeb911b7331ad1263da186441e82eae9
MD5 616c73aff7140685f4b8c733c343ded0
BLAKE2b-256 597ea1d6cf496f8ec929798ffe316a53c81bb7bd7234861d08f89a7148940147

See more details on using hashes here.

File details

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

File metadata

  • Download URL: easyvae-1.3.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.13

File hashes

Hashes for easyvae-1.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 29ce641c8915238b6f74f6d91526576ad3b9409c50437faed83c4541e2da1f0f
MD5 36ca3cf325c832020934cd4f924551b8
BLAKE2b-256 cbdeb3addcd012f55d9ecbd49da03d9440e28f713c99a4b02a14b22f8f6c8cc5

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