Skip to content

On-premise users: click in-app to access the full platform documentation for your version of DataRobot.

Sentiment analysis example

The model in this example includes reviews or tweets. The goal is to get an uplift for the model by capturing the sentiment in the text. To do this, simply modify the blueprint (i.e., click Copy and Edit to start). The following is a simple blueprint.—text only—but the model could have features as well.

Hover over either the Matrix of word-grams counts or Elastic-Net Classifier nodes to see:

  • The type of input required for that task.
  • The type of output returned.

For example, the Matrix of word-grams counts task requires the input to be of type Text and it returns a data frame with all numeric features:

To capture sentiments in a text feature for this example, hover over the Text variables node and click the task selector plus sign (). In the Select a task dialog box, expand Preprocessing > Text Preprocessing to see the options for text manipulations. (Some of these options are also available via Advanced Tuning, but others can only be accessed here.) Select to add TextBlob Sentiment Featurizer.

The blueprint now shows a new node, outlined in red. When you hover over the node, you can see that it requires text:

Note that the node's output is a data frame with numerical features (Data Type: Numeric). Because the TextBlob Sentiment Featurizer is a preprocessing module, you must connect it to the model task. (Hover over the TextBlob node, drag the diagonal arrow () icon to the Elastic-Net Classifier node, and click.)

The new blueprint is ready to be trained. (Before training, you can change the feature list or the training sample size.)

Here is the model on the Leaderboard, shown as one of the top four models.


Updated September 15, 2023