Teradata Package for Python Function Reference - LDATopicSummary - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.

Teradata® Package for Python Function Reference

Product
Teradata Package for Python
Release Number
17.00
Published
November 2021
Language
English (United States)
Last Update
2021-11-19
lifecycle
previous
Product Category
Teradata Vantage

 
teradataml.analytics.mle.LDATopicSummary = class LDATopicSummary(builtins.object)
     Methods defined here:
__init__(self, object=None, summary=False, out_topicwordnum='all', word_weight=False, word_count=False, out_byword=True, object_sequence_column=None, object_order_column=None)
DESCRIPTION:
    The LDATopicSummary function displays in readable form information
    from the binary model teradataml DataFrame generated by the function
    LDA.
 
 
PARAMETERS:
    object:
        Required Argument.
        Specifies the name of the model teradataml DataFrame generated
        by the function LDA or instance of LDA, which contains the
        model.
 
    object_order_column:
        Required Argument.
        Specifies Order By columns for "object".
        Values to this argument can be provided as list, if multiple
        columns are used for ordering.
        Types: str OR list of Strings (str)
 
    summary:
        Optional Argument.
        Specifies whether to display only a summary of the information
        in the model table.
        Default Value: False
        Types: bool
 
    out_topicwordnum:
        Optional Argument.
        Specifies the number of top topic words and their topic identifiers
        to include in the output teradataml DataFrame for each training
        document. The value out_topicwordnum must be either a positive
        integer or the string "all". The value "all", specifies all
        topic words and their topic identifiers.
        Default Value: "all"
        Types: str
 
    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: bool
 
    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: bool
 
    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: bool
 
    object_sequence_column:
        Optional Argument.
        Specifies the list 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: str OR list of Strings (str)
 
RETURNS:
    Instance of LDATopicSummary.
    Output teradataml DataFrames can be accessed using attribute
    references, such as LDATopicSummaryObj.<attribute_name>.
    Output teradataml DataFrame attribute name is:
        result
 
 
RAISES:
    TeradataMlException
 
 
EXAMPLES:
    # Load example data.
    load_example_data("LDATopicSummary", "complaints_traintoken")
 
    # Create teradataml DataFrame objects.
    complaints_traintoken = DataFrame.from_table("complaints_traintoken")
 
    # Example 1 - Build a model using LDA and use it's output as direct
    # input to LDATopicSummary
    lda_out = LDA(data = complaints_traintoken,
                  topic_num = 5,
                  docid_column = "doc_id",
                  word_column = "token",
                  count_column = "frequency",
                  maxiter = 30,
                  convergence_delta = 1e-3,
                  seed = 2
                  )
 
    LDATopicSummary_out1 = LDATopicSummary(object=lda_out,
                             summary=False,
                             out_topicwordnum='all',
                             word_weight=False,
                             word_count=False,
                             out_byword=True,
                             object_sequence_column='topicid'
                             )
 
    # Print the result teradataml DataFrame.
    print(LDATopicSummary_out1)
 
    # Persist the model table generated by the LDA function.
    copy_to_sql(lda_out.model_table, "model_lda_out")
 
    # Create teradataml DataFrame objects.
    model_lda_out = DataFrame.from_table("model_lda_out")
 
    # Example 2 - summary argument True.
    LDATopicSummary_out2 = LDATopicSummary(object = model_lda_out,
                                          summary = True
                                          )
 
    # Print the result teradataml DataFrame.
    print(LDATopicSummary_out2.result)
 
    # Example 3 - out_byword is False.
    LDATopicSummary_out3 = LDATopicSummary(object = model_lda_out,
                                          out_topicwordnum = 'all',
                                          out_byword = False
                                          )
 
    # Print the result teradataml DataFrame.
    print(LDATopicSummary_out3)
 
    # Example 4 - Arguments word_weight and word_count are True.
    LDATopicSummary_out4 = LDATopicSummary(object = model_lda_out,
                                          word_weight = True,
                                          word_count = True,
                                          out_byword = True
                                          )
 
    # Print the result teradataml DataFrame.
    print(LDATopicSummary_out4)
__repr__(self)
Returns the string representation for a LDATopicSummary class instance.
get_build_time(self)
Function to return the build time of the algorithm in seconds.
When model object is created using retrieve_model(), then the value returned is 
as saved in the Model Catalog.
get_prediction_type(self)
Function to return the Prediction type of the algorithm.
When model object is created using retrieve_model(), then the value returned is 
as saved in the Model Catalog.
get_target_column(self)
Function to return the Target Column of the algorithm.
When model object is created using retrieve_model(), then the value returned is 
as saved in the Model Catalog.
show_query(self)
Function to return the underlying SQL query.
When model object is created using retrieve_model(), then None is returned.