Description
The TrainSentimentExtractor function trains a model, that is, takes training documents and outputs a maximum entropy classification model, which it installs on ML Engine. See Maximum Entropy for more information.
Usage
td_sentiment_trainer_mle (
data = NULL,
text.column = NULL,
sentiment.column = NULL,
language = "en",
model.file = NULL,
data.sequence.column = NULL
)
Arguments
data |
Required Argument. |
text.column |
Required Argument. |
sentiment.column |
Required Argument. |
language |
Optional Argument. |
model.file |
Required Argument. |
data.sequence.column |
Optional Argument. |
Value
Function returns an object of class "td_sentiment_trainer_mle" which
is a named list containing object of class "tbl_teradata".
Named list member can be referenced directly with the "$" operator
using name: output.
Examples
# Get the current context/connection
con <- td_get_context()$connection
# Load example data.
loadExampleData("sentimenttrainer_example", "sentiment_train")
# Create object(s) of class "tbl_teradata".
# The sample dataset contains collection of user reviews for different products.
sentiment_train <- tbl(con, "sentiment_train")
# Example 1 - Build and output a maximum entropy classification model to a binary file.
td_sentiment_trainer_mle_out <- td_sentiment_trainer_mle(data = sentiment_train,
text.column = "review",
sentiment.column = "category",
model.file = "sentimentmodel1.bin"
)