Teradata R Package Function Reference | 17.00 - 17.00 - LDATopicSummary - Teradata R Package

Teradata® R Package Function Reference

prodname
Teradata R Package
vrm_release
17.00
created_date
September 2020
category
Programming Reference
featnum
B700-4007-090K

Description

The LDATopicSummary function displays readable information from the binary model tbl_teradata generated by the Latent Dirichlet Allocation i.e., LDATrainer (td_lda_mle) function.

Usage

  td_lda_topic_summary_mle (
      object = NULL,
      summary = FALSE,
      out.topicwordnum = "all",
      word.weight = FALSE,
      word.count = FALSE,
      out.byword = TRUE,
      object.sequence.column = NULL,
      object.order.column = NULL
  )

Arguments

object

Required Argument.
Specifies the model tbl_teradata generated by td_lda_mle.
This argument can accept either a tbl_teradata or an object of "td_lda_mle" class.

object.order.column

Optional Argument.
Specifies Order By columns for "object".
Values to this argument can be provided as vector, if multiple columns are used for ordering.
Types: character OR vector of Strings (character)

summary

Optional Argument.
Specifies whether to display only a summary of the information in the model tbl_teradata.
Default Value: FALSE
Types: logical

out.topicwordnum

Optional Argument.
Specifies the number of top topic words and their topic identifiers to include in the output tbl_teradata for each training document. The value of "out.topicwordnum" must be either a positive integer in quotes or "all".
The value "all" specifies all topic words and their topic identifiers.
Types: character

word.weight

Optional Argument.
Specifies whether to display the weight (probability of occurrence) of each unique word in each topic. The weights for the unique words in each topic are normalized to 1.
Default Value: FALSE
Types: logical

word.count

Optional Argument.
Specifies whether to display the count (number of occurrences) of each unique word in each topic. Topic distribution is factored into word counts.
Default Value: FALSE
Types: logical

out.byword

Optional Argument.
Specifies whether to display each topic-word pair in its own row. If you specify FALSE, each row contains a unique topic and all words that occur in that topic, separated by commas.
Default Value: TRUE
Types: logical

object.sequence.column

Optional Argument.
Specifies the vector of column(s) that uniquely identifies each row of the input argument "object". The argument is used to ensure deterministic results for functions which produce results that vary from run to run.
Types: character OR vector of Strings (character)

Value

Function returns an object of class "td_lda_topic_summary_mle" which is a named list containing object of class "tbl_teradata".
Named list member can be referenced directly with the "$" operator using name: result.

Examples

    # Get the current context/connection
    con <- td_get_context()$connection
    
    # Load example data.
    loadExampleData("lda_example","complaints_traintoken")
    
    # Create object(s) of class "tbl_teradata".
    complaints_traintoken <- tbl(con, "complaints_traintoken")
    
    # Example 1 - This example uses the model tbl_teradata generated by td_lda_mle() function 
    # to display only a summary of the information in the model. 
    td_lda_out <- td_lda_mle(data=complaints_traintoken,
                             docid.column='doc_id',
                             word.column='token',
                             topic.num=3,
                             alpha=0.1,
                             eta=0.1,
                             maxiter=50,
                             convergence.delta=0.0001,
                             seed=2,
                             out.topicnum='all',
                             out.topicwordnum='none'
                            )
    td_lda_topic_summary_mle_out <- td_lda_topic_summary_mle(object = td_lda_out,
                                                             summary = TRUE)
    
    # Example 2 - This example displays all topic words and their topic identifiers
    # with each row contains a unique topic and all words that occur in that topic, 
    # separated by commas.
    td_lda_topic_summary_mle_out <- td_lda_topic_summary_mle(object = td_lda_out,
                                                             out.topicwordnum = 'all',
                                                             out.byword = TRUE
                                                             )
    
    # Example 3 - This example displays each topic-word pair with wordweight, wordcount,
    # each topic-word pair in its own row.
    td_lda_topic_summary_mle_out <- td_lda_topic_summary_mle(object = td_lda_out,
                                                             word.weight = TRUE,
                                                             word.count = TRUE,
                                                             out.byword = TRUE
                                                             )