RunBhtSNE: Run a usual t-SNE.

Description Usage Arguments Examples

Description

Run a usual t-SNE.
Input: binary file (.dat) describing similarities from Compute_similarities.
Output : directory containing text files (.txt), including 'Y_final.txt' used for plot or RunNetSNE ('learn' mode).
Requirment: C++ implementation of Net-SNE installed and functional.

Usage

1
2
3
4
5
6
7
RunBhtSNE(out.dims = 2L, max.iter = 1000L, theta = 0.5,
          mom.init = 0.5, mom.final = 0.8, mom.switch.iter = 250L,
          early.exag.iter = 250L, learn.rate = 200,
          batch.frac = NULL, seed = -1, verbose = TRUE, random.init = TRUE,
          save.iters.cache = FALSE, path.netSNE.dir = path.netSNE.dir,
          path.to.bin.file = path.to.bin.file,
          path.to.simil.file, path.output.dir)

Arguments

out.dims

Integer; Specifies the output dimensionality (default: 2)

max.iter

Integer; Specifies the number of iterations (default: 1e3)

theta

Double; Bounded by 0 and 1, controls the accuracy-efficiency tradeoff in SPTree for gradient computation; 0 means exact (default: 0.5)

mom.init

Double; Bounded by 0 and 1, defines the momentum used before n=mom.switch.iter iterations (default: 0.5)

mom.final

Double; Bounded by 0 and 1, defines the momentum used after n=mom.switch.iter iterations (default: 0.8)

mom.switch.iter

Integer; Number of iterations before switching the value of momentum (default: 250)

early.exag.iter

Integer; Number of iterations of early exaggeration (default: 250)

learn.rate

Double; Learning rate used for gradient steps (default: 200.0)

batch.frac

Integer: Number of points to update at each iteration (default: NULL, i.e. all of them)

seed

Integer; Equivalent to set.seed (default: -1, i.e. use current time as seed)

verbose

Logical; Should the outputs be printed to the console? (default: TRUE)

random.init

Logical; Set to TRUE to allow random initialization (default: TRUE)

save.iters.cache

Integer; Number of iterations after which an intermediary embedding is repeatidly recorded. The final embedding (Y_final.txt) is always saved (default: NULL, i.e. no intermediary embedding is recorded, only the definitive one after max.iter)

path.netSNE.dir

Character; The path to the directory containing the executables created after Net-SNE installation (usually : path/to/netsne-master/bin). Must end with the name of directory with exectuables (here: '/bin')

path.to.bin.file

Character; The path to the binary file of the train data matrix obtained with Write_binary_file

path.to.simil.file

Character; The path to the binary file containing the similarities of the train data matrix obtained with Compute_similarities

path.output.dir

Character; The path to save to output directory containing the .txt files

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (out.dims = 2, max.iter = 1000L, theta = 0.5, mom.init = 0.5,
    mom.final = 0.8, mom.switch.iter = 250L, early.exag.iter = 250,
    learn.rate = 200, batch.frac = NULL, seed = -1, verbose = TRUE,
    random.init = TRUE, save.iters.cache = FALSE, path.netSNE.dir = path.netSNE.dir,
    path.to.bin.file = path.to.bin.file, path.to.simil.file,
    path.output.dir)
{
    command = paste(path.netSNE.dir, "RunBhtsne", sep = "/")
    command = paste(command, path.netSNE.dir, "--input-P", path.to.simil.file,
        "--out-dir", path.output.dir, sep = " ")
    command = paste(command, "--out-dim", out.dims, "--max-iter",
        max.iter, "--rand-seed", seed, "--theta", theta, "--learn-rate",
        learn.rate, "--mom-init", mom.init, "--mom-final", mom.final,
        "--mom-switch-iter", mom.switch.iter, "--early-exag-iter",
        early.exag.iter, sep = " ")
    if (!random.init) {
        command = paste(command, "--skip-random-init", sep = " ")
    }
    if (!is.null(batch.frac)) {
        command = paste(command, "--batch-frac", batch.frac,
            sep = " ")
    }
    if (!is.null(save.iters.cache)) {
        command = paste(command, "--cache-iter", save.iters.cache,
            sep = " ")
    }
    if (!verbose) {
        command = paste(command, "> /dev/null", sep = " ")
    }
    if ("crayon" %in% installed.packages()[, 1]) {
        cat(crayon::bold(crayon::red("\n\nRunning BhtSNE !\n\n")))
    }
    else {
        cat("\n\nRunning BhtSNE !\n\n")
    }
    system(command)
  }

schwikowskilab/rNetSNE documentation built on May 4, 2019, 6:40 p.m.