Skip to main content

Python implementation of a Classical and Variational Autoencoders

Project description

Python AutoEncoder from scratch using Numpy

Usage

  1. To install from source :
$ git clone git@github.com:lenoctambule/autoencoder.git
$ pip install -e autoencoder/
  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.0.tar.gz (5.4 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.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for easyvae-1.0.tar.gz
Algorithm Hash digest
SHA256 11736f93b4dfa750e4bb95f6bdeeeb4a3c6068f827fc43fcf57ce199494d2a14
MD5 1435b5fde8ed9869930376f9ef09c711
BLAKE2b-256 b9b9dfd61e56fb4c0237a9fb1582933e87f79db8d235a26395d21ce53c9fd2d2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: easyvae-1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 678886c5176eabffa450aae12259ddecb9c2faa281661e7653308140caaf8fcb
MD5 a5e00374c1d2fbfc44d041882969a285
BLAKE2b-256 21ca8f62ea7a4882057581e9c0e4c1cb5e8b64c15804cfea24df4c5bd4d37004

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