|
| 1 | +# Joint t-sne |
| 2 | +This is the implementation for paper [Joint t-SNE for Comparable Projections of Multiple High-Dimensional Datasets]([ddd](http://www.yunhaiwang.net/Vis2021/joint-tsne)). |
| 3 | + |
| 4 | +## abstract: |
| 5 | +We present Joint t-Stochastic Neighbor Embedding (Joint t-SNE), a technique to generate comparable projections of multiple high-dimensional datasets. Although t-SNE has been widely employed to visualize high-dimensional datasets from various domains, it is limited to projecting a single dataset. When a series of high-dimensional datasets, such as datasets changing over time, is projected independently using t-SNE, misaligned layouts are obtained. Even items with identical features across datasets are projected to different locations, making the technique unsuitable for comparison tasks. To tackle this problem, we introduce edge similarity, which captures the similarities between two adjacent time frames based on the Graphlet Frequency Distribution (GFD). We then integrate a novel loss term into the t-SNE loss function, which we call vector constraints, to preserve the vectors between projected points across the projections, allowing these points to serve as visual landmarks for direct comparisons between projections. Using synthetic datasets whose ground-truth structures are known, we show that Joint t-SNE outperforms existing techniques, including Dynamic t-SNE, in terms of local coherence error, Kullback-Leibler divergence, and neighborhood preservation. We also showcase a real-world use case to visualize and compare the activation of different layers of a neural network. |
| 6 | + |
| 7 | + |
| 8 | +### Environment |
| 9 | ++ This is a hybrid programming based on C++ and Python, and supported by shell script. |
| 10 | ++ It requires [Qt](https://www.qt.io/), [Python 3.6](https://www.python.org/), [numpy](https://numpy.org/) and [scikit-learn](https://scikit-learn.org/). |
| 11 | + |
| 12 | +## How to use |
| 13 | +1. Put the directory of your data sequence, e.g. "YOUR_DATA" in **Joint_tsne/data**. There are several requirements on the format and organization of your data: |
| 14 | + + Each data frame is named as *f_i.txt*, where *i* is the time step/index of this data frame in the sequence. |
| 15 | + + The *j* th row of the data frame contains both the feature vector and label of the *j* th item, which is seperated by \tab. The label is at the last position. |
| 16 | + + All data frames must have the same number of rows, and the the same item is at the same row in different data frames to compute the node similarities one by one. |
| 17 | + |
| 18 | + |
| 19 | +2. Create a configuration file, e.g. "YOUR_DATA.json" in **Joint_tsne/config**, which is organized as a json structure. |
| 20 | + |
| 21 | +<code> |
| 22 | + |
| 23 | +```json |
| 24 | +{ |
| 25 | + "algo": { |
| 26 | + "k_closest_count": 3, |
| 27 | + "perplexity": 70, |
| 28 | + "bfs_level": 1, |
| 29 | + "gamma": 0.1 |
| 30 | + }, |
| 31 | + "thesne": { |
| 32 | + "data_name": "YOUR_DATA", |
| 33 | + "pts_size": 2000, |
| 34 | + "norm": false, |
| 35 | + "data_ids": [1, 3, 6, 9], |
| 36 | + "data_dims": [100, 100, 100, 100, 100, 100, 100, 100, 100, 100], |
| 37 | + "data_titles": [ |
| 38 | + "t=0", |
| 39 | + "t=1", |
| 40 | + "t=2", |
| 41 | + "t=3", |
| 42 | + "t=4", |
| 43 | + "t=5", |
| 44 | + "t=6", |
| 45 | + "t=7", |
| 46 | + "t=8", |
| 47 | + "t=9" |
| 48 | + ] |
| 49 | + } |
| 50 | +} |
| 51 | +``` |
| 52 | +</code> |
| 53 | + |
| 54 | +In this file, *algo* represents the hyperparamters of our algorithm except for *bfs_level*, which always equals to 1. *thesne* contains the information of the input data. Please remember that *data_name* must be consistent with the directory name in the previous step. |
| 55 | + |
| 56 | +3. Create a shell script e.g. "YOUR_DATA.sh" in **Joint_tsne/scripts** as below: |
| 57 | + |
| 58 | +<code> |
| 59 | + |
| 60 | +```shell |
| 61 | +# !/bin/bash |
| 62 | +# 1. specify the configuration file with absolute file path |
| 63 | +config_path="xxx/Joint_tsne/config/YOUR_DATA.json" |
| 64 | + |
| 65 | +workdir=$(cd $(dirname $0); pwd) |
| 66 | + |
| 67 | +# 2. build knn graph for each data frame |
| 68 | +python3 ../codes/graphBuild/run.py $config_path |
| 69 | + |
| 70 | +# 3. compute edge similarities between each two adjacent data frames |
| 71 | +buildDir="../codes/graphSim/build" |
| 72 | +if [ ! -d $buildDir ]; then |
| 73 | + mkdir $buildDir |
| 74 | + echo "create directory ${buildDir}" |
| 75 | +else |
| 76 | + echo "directory ${buildDir} already exists." |
| 77 | +fi |
| 78 | +cd $buildDir |
| 79 | +qmake ../ |
| 80 | +make |
| 81 | + |
| 82 | +# bin is dependent on your operating system |
| 83 | +bin=./graphSim.app/Contents/MacOS/graphSim |
| 84 | +$bin $config_path |
| 85 | + |
| 86 | +cd $workdir |
| 87 | + |
| 88 | +# 4. run t-sne optimization |
| 89 | +python3 ../codes/thesne/run.py $config_path |
| 90 | +``` |
| 91 | +</code> |
| 92 | + |
| 93 | +There are several places you should pay attention to. |
| 94 | ++ Again, *config_path* must be consitent with the name of configuration file in previous step |
| 95 | ++ *bin* is dependent on your operating system. If you use linux, you should change it to |
| 96 | + |
| 97 | + bin=./graphSim |
| 98 | + |
| 99 | +4. change your directory to **Joint_tsne/scripts** and type |
| 100 | + |
| 101 | +<code> |
| 102 | + |
| 103 | + sh YOUR_SHELL.sh |
| 104 | + |
| 105 | +</code> |
| 106 | + |
| 107 | +The final embeddings will be generated in **Joint_tsne/results/YOUR_DATA**. |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | +### Example |
| 113 | +You can find an example in **Joint_tsne/scripts/10_cluster_contract.sh**. |
0 commit comments