predict_model: Model prediction

Description Usage Arguments Value Author(s) See Also Examples

View source: R/ttgsea.R

Description

From the result of the function "ttgsea", we can predict enrichment scores. For each new term, lemmatized text, predicted enrichment score, Monte Carlo p-value and adjusted p-value are provided. The function "token_vector" is used for encoding as we did for training. Of course, mapping from tokens to integers should be the same.

Usage

1
2
predict_model(object, new_text, num_simulations = 1000,
              adj_p_method = "fdr")

Arguments

object

result of "ttgsea"

new_text

new text data

num_simulations

number of simulations for Monte Carlo p-value (default: 1000)

adj_p_method

correction method (default: "fdr")

Value

table for lemmatized text, predicted enrichment score, MC p-value and adjusted p-value

Author(s)

Dongmin Jung

See Also

stats::p.adjust

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
library(reticulate)
if (keras::is_keras_available() & reticulate::py_available()) {
  library(fgsea)
  data(examplePathways)
  data(exampleRanks)
  names(examplePathways) <- gsub("_", " ",
                            substr(names(examplePathways), 9, 1000))
  set.seed(1)
  fgseaRes <- fgsea(examplePathways, exampleRanks)
  
  num_tokens <- 1000
  length_seq <- 30
  batch_size <- 32
  embedding_dims <- 50
  num_units <- 32
  epochs <- 1
  
  ttgseaRes <- fit_model(fgseaRes, "pathway", "NES",
                         model = bi_gru(num_tokens,
                                        embedding_dims,
                                        length_seq,
                                        num_units),
                         num_tokens = num_tokens,
                         length_seq = length_seq,
                         epochs = epochs,
                         batch_size = batch_size,
                         use_generator = FALSE)
  
  set.seed(1)
  predict_model(ttgseaRes, "Cell Cycle")
}

dongminjung/ttgsea documentation built on Dec. 30, 2021, 8:51 a.m.