Run python train-deep-taxonnet.py --config ./configs/fmnist.json to train deep taxonomic network on Fashion-MNIST dataset using default configurations.
Few training configurations to play around:
dataset: fashion-mnist, mnist, cifar-10decoder_name/decoder_name: omniglot for 28x28 pixel data, resnet18 for 32x32 pixel dataenc_hidden_dim: 128 for omniglot encoder, 512 for resnet18dec_hidden_dim: [128, 1, 1] for omniglot encoder, [512, 1, 1] for resnet18
You can use the provided infer_latent_dim.ipynb to calculate the dimenstions for images other than 32x32 or 28x28
Load pre-trained models using testing.ipynb to calculate ACC, NMI, DP, LP for hierarchical clustering performance.
This repo provides pre-trained models on MNIST and Fashion MNIST under the ./models folder.
Load pre-trained models using viz_gen.ipynb to visualize (sub-)tree. The provided nodebook can visualzie 1. clusters using the test images, and 2. clusters with model generated images.
- ResNet-18 Encoder-Decoder was adopted (with modification to 32x32 image) from https://github.com/eleannavali/resnet-18-autoencoder (we didn't use the their 'light' version).
The scripts folder contains shell commands for training Deep Taxonomic Network model.
The training configuration is stored as JSON files in the scripts/configs/ folder
Run run_config.sh in slurm system.
encoder.py and decoder.py stores the encoder and decoder architecure
train-deep-taxonnet.py are the main training loops. The former one trains the autoencoder baseline model.
DeepTaxonNet.py is the main model.
utils.py contains all utility functions.
- Install the
cmake-buildbranch at Cobweb
Moved to cobweb_symbolic folder
cobweb_symbolic.py contains a wrapper class so you can have the cobweb tree in python.
See cobweb-sym-example.ipynb
The python version of the cobweb tree is a python Dictionary object with keys:
mean, mean_sq, logvar, count, node_id, children
Note that the parents in cobweb symbolic may have more than two chidlren so it is NOT a complete binary tree (you can see the tree in the following visualization).
The cobweb symbolic tree comes with a hyper-parameter depth. If you set the depth to infinity, the tree will keep expanding until it reaches the leaf determined by the Categorical Utility.
COBWEBNN.py contains the current version of the CobwebNN model
We use D3.js for visualization. Line 55 of the tree_viz.html contains the JSON file name that we wish to visualize. Once a visualization JSON file is created, make sure you update the file name at line 55.
To run the HTML, go to your working directory, open terminal and run python -m http.server 8080 (either python or python3 is fine, depending on your environment. And if port 8080 is in use, you can use different port number).
Once the server is running, open a browser and go to http://localhost:8080/tree_viz.html, a tree will show up if you scroll the page to the right. Click the node to expand/close.