Open turnersr opened 4 years ago
Thanks. I can potentially add this to the FAQ if you like.
Oh, that would be wonderful. Thank you! Let me share how I made the graphs, too. I use a tool called NGT. It can export several different graph approximations. Two of the less well known ones are ANNG and CkNN.
https://arxiv.org/abs/1606.02353
https://arxiv.org/abs/1810.07355
A development branch of NGT located at https://github.com/masajiro/NGT/tree/devel . Let's pull it down and install it.
git clone https://github.com/masajiro/NGT.git NGT_DEV
cd NGT_DEV/
git checkout devel
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install cmake brew install gcc@9
export CXX=/usr/local/bin/g++-9 export CC=/usr/local/bin/gcc-9
mkdir build
cd build
cmake ..
make
make install
Once you make index you can export using ngt export-graph -k 15 refined-anng > approximate-knng.graph
For the record, I think the implementation of UMAP in scanpy can do this (although initially intended for single-cell data, lol!). You can tell it to layout whatever graph you like into 2D, even those that were not calculated using UMAP's fuzzy simplicial set implementation (such as vanilla k-nearest neighbor graphs).
Hello,
I tried to find an example of using external KNN graphs with UMAP. I wasn't able to find any so I created one and hope people find this snippet of code helpful. It's largely based on the internal APIs and functions within UMAP itself, but it works well for our purposes. An example of how to use the code is at the end and here is the example data from the Iris dataset: approximate-knng.txt
Any feedback would be welcomed.
Take care!
An example usage is a follows: