# Sentiment analysis example
URL: https://docs.datarobot.com/en/docs/reference/pred-ai-ref/cml-ref/cml-sentiment-example.html

> Apply Composable ML to capture sentiment from text.

# 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](https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/cml/cml-blueprint-edit.html#access-the-blueprint-editor) (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](https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/cml/cml-blueprint-edit.html#use-the-task-selector) plus sign ( [https://docs.datarobot.com/en/docs/images/icon-plus.png](https://docs.datarobot.com/en/docs/images/icon-plus.png)). 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](https://docs.datarobot.com/en/docs/classic-ui/modeling/analyze-models/evaluate/adv-tuning.html), 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](https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/cml/cml-blueprint-edit.html#work-with-nodes). (Hover over the TextBlob node, drag the diagonal arrow ( [https://docs.datarobot.com/en/docs/images/icon-diagonal-arrow.png](https://docs.datarobot.com/en/docs/images/icon-diagonal-arrow.png)) icon to the Elastic-Net Classifier node, and click.)

The new blueprint is [ready to be trained](https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/cml/cml-blueprint-edit.html#train-new-models). (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.

---
