| |
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.
|