This is an implementation of Correlational Neural Network (CorrNet) described in the following paper : Sarath Chandar, Mitesh M Khapra, Hugo Larochelle, Balaraman Ravindran. Correlational Neural Networks.
For detailed description please refer to my blog post COMMON REPRESENTATION LEARNING USING DEEP CORRNET.
This implementation uses Python 2.7, Keras (2.0 or above) with Theano backend, and Scikit Learn.
Please extract the contents from training_and_testing_data_corrnet.rar file and keep it in the same folder as the DeepLearn_corrnet.py script.
Training and testing the model on MNIST dataset.
>>> left_view, right_view = prepare_data()
>>> model,branchModel = buildModel(loss_type)
>>> trainModel(model,left_view,right_view,loss_type=2,nb_epoch=40,batch_size=100)
>>> testModel(branchModel)
view1 to view2 transfer accuracy
0.8879
view2 to view1 transfer accuracy
0.8964
test sum-correlation
49.1316743225Reconstruction of one view given the other
>>> reconstruct_from_left(model,left_view[6:7])>>> reconstruct_from_right(model,right_view[6:7])
