Demo

The cde.demo module contains a script that demonstrates how to build a network as described in the previous section. The program will create an artificial dataset that will be used for training and testing the model. It will create 9 different distributions each of which is a mixture of 6 Normal distributions. The \(x\) value for a data point is a one-hot encoded variable (0-8) and the \(y\) value is a random value drawn from the corresponding mixture distribution. The full set of command line options is described below.

>python -m cde.demo         \
    --output-dir /tmp       \
    --random-seed 2         \
    --dataset-size 50000    \
    --n-epochs 200          \
    --n-classes 9           \
    --n-mixtures 6          \
    kmn                     \
    --kernel-method uniform \
    --n-kernels 20

After running the command the program will output two files in the tmp directory. The first is a plot of the true densities of each of the mixture distributions, shown in Fig. 2.

_images/kmn-true-dist.svg

Fig. 2 True mixture distributions.

The second is a plot of the predicted densities for each class after 200 epochs, shown in Fig. 3.

_images/kmn-pred-dist.svg

Fig. 3 Predicted mixture distributions.

Command Line Options

Command line usage for the demo script.