# 3.20. Auto-encoder with Conv2D¶

In [22]:

from conx import *

In [23]:

net = Network("Auto-Encoding with Conv")
net.add(Layer("output", 28 * 28, vshape=(28,28), activation='softmax'))
net.connect()

In [24]:

net.compile(error="mse", optimizer="adam")

In [25]:

net.dataset.get("mnist")

In [26]:

net.dataset.summary()


Dataset name: MNIST

Original source: http://yann.lecun.com/exdb/mnist/

The MNIST database of handwritten digits, available from this page, has 70,000 examples. It is a subset of a larger set available from NIST. The digits have been size-normalized and centered in a fixed-size image. It is a good database for people who want to try learning techniques and pattern recognition methods on real-world data while spending minimal efforts on preprocessing and formatting.

Dataset Split: * training : 70000 * testing : 0 * total : 70000

Input Summary: * shape : [(28, 28, 1)] * range : [(0.0, 1.0)]

Target Summary: * shape : [(10,)] * range : [(0.0, 1.0)]

In [27]:

net.dataset.set_targets_from_inputs()

WARNING: network 'Auto-Encoding with Conv' target bank #0 has a multi-dimensional shape, which is not allowed

In [28]:

net.dataset.targets.reshape(28 * 28)

In [29]:

net.dataset.summary()


Dataset name: MNIST

Original source: http://yann.lecun.com/exdb/mnist/

The MNIST database of handwritten digits, available from this page, has 70,000 examples. It is a subset of a larger set available from NIST. The digits have been size-normalized and centered in a fixed-size image. It is a good database for people who want to try learning techniques and pattern recognition methods on real-world data while spending minimal efforts on preprocessing and formatting.

Dataset Split: * training : 70000 * testing : 0 * total : 70000

Input Summary: * shape : [(28, 28, 1)] * range : [(0.0, 1.0)]

Target Summary: * shape : [(784,)] * range : [(0.0, 1.0)]

In [30]:

net.dashboard()

In [31]:

net.dataset.chop(100)

In [32]:

net.dataset.split(0.1)

In [33]:

net.dataset.summary()


Dataset name: MNIST

Original source: http://yann.lecun.com/exdb/mnist/

The MNIST database of handwritten digits, available from this page, has 70,000 examples. It is a subset of a larger set available from NIST. The digits have been size-normalized and centered in a fixed-size image. It is a good database for people who want to try learning techniques and pattern recognition methods on real-world data while spending minimal efforts on preprocessing and formatting.

Dataset Split: * training : 90 * testing : 10 * total : 100

Input Summary: * shape : [(28, 28, 1)] * range : [(0.0, 1.0)]

Target Summary: * shape : [(784,)] * range : [(0.0, 1.0)]

In [34]:

net.reset()
net.train(50, plot=True)

========================================================================
|  Training |  Training |  Validate |  Validate
Epochs |     Error |  Accuracy |     Error |  Accuracy
------ | --------- | --------- | --------- | ---------
#   50 |   0.10628 |   0.00000 |   0.10314 |   0.00000