Package: fastlvm
Fast Sampling for Latent Variable ModelsWe present implementation of following latent variable models suitable for large scale deployment:CoverTree- Fast nearest neighbour searchKMeans- Simple, fast, and distributed clustering with option of various initializationGMM- Fast and distributed inference for Gaussian Mixture Models with diagonal covariance matricesLDA- Fast and distributed inference for Latent Dirichlet AllocationGLDA- Fast and distributed inference for Gaussian LDA with diagonal covariance matricesHDP- Fast inference for Hierarchical Dirichlet ProcessUnder active developmentOrganisationAll codes are undersrcwithin respective folderDependencies are provided underlibfolderPython wrapper classes reside infastlvmfolderFor running different models an example script is provided underscriptsdatais a placeholder folder where to put the databuildanddistfolder will be created to hold the executablesRequirementsgcc >= 5.0 or Intel® C++ Compiler 2017 for using C++14 featuresPython 3.6+Mac OS 10.12 or higher(for Mac version only)How to useThere are two ways to utilize the package: using Python wrapper or directly in C++PythonThrough Pypi```pip install fastlvm```

 On Mac OS:

 ```CFLAGS=-mmacosx-version-min=10.12 CXXFLAGS=-mmacosx-version-min=10.12 pip install fastlvm```ManuallyIf installing from the source on github...Just usepython setup.py installand then in python you canimport fastlvm. Example and test code is intest.py.APIThe python API details are provided inAPI.pdf, but all of the models utilise the following structure:class LVM:
    init(self, # hyperparameters)
        return model
    
    fit(self, X, ...):
        return validation score
        
    predict(self, X): 
        return prediction on each test example
        
    evaluate(self, X):             
        return test scoreIf you do not have root priveledges, install withpython setup.py install --userand make sure to have the folder in path.C++We will show how to compile our package and run, for example nearest neighbour search using cover trees, on a single machine using synthetic datasetFirst of all compile by hitting makemakeGenerate synthetic datasetpythondata/generateData.pyRun Cover Treedist/cover_treedata/train_100d_1000k_1000.datdata/test_100d_1000k_10.datThe make file has some useful features:if you have Intel® C++ Compiler, then you can insteadmakeintelor if you want to use Intel® C++ Compiler's cross-file optimization (ipo), then hitmakeinteltogetherAlso you can selectively compile individual modules by specifyingmake<module-name>or clean individually bymakeclean-<module-name>PerformanceUnit testingcdtests
python-munittestdiscover# requires unittest 3.2 and newerAttributionsWe use a distributed and parallel extension and implementation of Cover Tree data structure for nearest neighbour search. The data structure was originally presented in and improved in:Alina Beygelzimer, Sham Kakade, and John Langford. "Cover trees for nearest neighbor." Proceedings of the 23rd international conference on Machine learning. ACM, 2006.Mike Izbicki and Christian Shelton. "Faster cover trees." Proceedings of the 32nd International Conference on Machine Learning (ICML-15). 2015.We implement a modified inference for Gaussian LDA. The original model was presented in:Rajarshi Das, Manzil Zaheer, Chris Dyer. "Gaussian LDA for Topic Models with Word Embeddings." Proceedings of ACL (pp. 795-804) 2015.We implement a modified inference for Hierarchical Dirichlet Process. The original model and inference methods were presented in:Y. Teh, M. Jordan, M. Beal, and D. Blei. Hierarchical dirichlet processes. Journal of the American Statistical Association, 101(576):1566{1581, 2006.C. Chen, L. Du, and W.L. Buntine. Sampling table configurations for the hierarchical poisson-dirichlet process. In  European Conference on Machine Learning, pages 296-311. Springer, 2011.TroubleshootingIf the build fails and throws error like "instruction not found", then most probably the system does not support AVX2 instruction sets. To solve this issue, insetup.pyandsrc/cover_tree/makefileplease changemarch=core-avx2tomarch=corei7.