> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oxen.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 🧐 Sentiment Analysis

> Sentiment Analysis is the process of categorizing the overall feeling and opinion of a piece of text. Usually it is broken down into multiple categories such as positive, negative, and neutral.

For example, "Tesla's stock skyrockets by 20%" would have **positive** sentiment, and "I hate when Airpods disconnect from my device" would have **negative** sentiment. This type of analysis can be useful for analyzing customer feedback at scale, monitoring brands on social media, predicting financial markets, and much more.

In this tutorial, we will show how you can use Oxen to do sentiment analysis with GPT-4o to categorize political spam synthetic data.

## Upload Your Dataset

Open the dataset you want to work with. You can find an example dataset on our [explore page](https://www.oxen.ai/explore) or if you want to follow along with the example, you can clone the [financial sentiment dataset](https://www.oxen.ai/ox/financial_sentiment) we are using.

```bash theme={null}
oxen clone https://hub.oxen.ai/ox/financial_sentiment --all
oxen create-remote --name "your-username/financial-sentiment"
oxen config --set-remote origin "your-username/financial-sentiment"
oxen push origin main
```

<img className="block" src="https://mintcdn.com/oxenai/GvHCMKbbr_BpHEwk/images/financial_sentiment_dataset.png?fit=max&auto=format&n=GvHCMKbbr_BpHEwk&q=85&s=24649416c88fa1cbb2ad97b1c44ae485" alt="Oxen.ai Financial Sentiment Repo" width="2880" height="1736" data-path="images/financial_sentiment_dataset.png" />

## Create a Model Evaluation

Open the file you want to run sentiment analysis on and press the glowing button with the rocket 🚀 on it at the top right of the screen.

<img className="block" src="https://mintcdn.com/oxenai/W8EBryVYRkX4WOUa/images/rmod_button.png?fit=max&auto=format&n=W8EBryVYRkX4WOUa&q=85&s=6555cb2650a84bdc133996caa90cfa0f" alt="Where to find model evaluations" width="2880" height="1736" data-path="images/rmod_button.png" />

## Setting Up The Evaluation

You will now find Oxen's model evaluation feature. This is where you can choose a model, setup a prompt, and choose the output column.

In this case, we will use [GPT-4o](https://platform.openai.com/docs/models/gpt-4o) and the following prompt:

```
Compute the sentiment of the text based on how well the companies are performing in the market.
Return only one of three options: positive, negative, or neutral.
Respond with one word, all lowercase.

Text:
{text}
```

After you have selected your model, give your evaluation a name, fill in your prompt with the values you want to pass to the model, and decide if you want to run a quick sample on a few rows or click "Next" to finalize the sentiment analysis preparations:

<img className="block" src="https://mintcdn.com/oxenai/W8EBryVYRkX4WOUa/images/rmod_prompt.png?fit=max&auto=format&n=W8EBryVYRkX4WOUa&q=85&s=54cdc47f09173c91e172383b9bcfbaca" alt="RMOD prompt example" width="2880" height="1736" data-path="images/rmod_prompt.png" />

## Select Your Destination

After clicking "Next" once your sample has been completed, you will see a commiting page. Here you will decide the target branch, target path, and if you would like to commit instantly or after reviewing the analysis. Once decided, simply click "Run Evaluation".

<img className="block" src="https://mintcdn.com/oxenai/W8EBryVYRkX4WOUa/images/rmod_commit_page.png?fit=max&auto=format&n=W8EBryVYRkX4WOUa&q=85&s=e8b5d04c11e08d2166899eeaa64d3856" alt="RMOD commit page" width="2880" height="1736" data-path="images/rmod_commit_page.png" />

## Monitor Your Evaluation

Feel free to grab a coffee, close the tab, or do something else while the evaluation is running. Your trusty Oxen Herd will be running in the background.

While the evaluation is running you will see a progress bar showing how many rows have been completed, an update of how many tokens are being used, and how expensive the run is so far.

<img className="block" src="https://mintcdn.com/oxenai/W8EBryVYRkX4WOUa/images/rmod_status_bar.png?fit=max&auto=format&n=W8EBryVYRkX4WOUa&q=85&s=489d4b7a31711b26f2b109dca56d5377" alt="RMOD processing bar" width="2880" height="1736" data-path="images/rmod_status_bar.png" />

## Next Steps

Once done, you will see your new dataset committed to the branch you specified. If you don't like the results, don't worry! Under the hood, all the runs are versioned so you can always revert to or compare to a previous version.

<img className="block" src="https://mintcdn.com/oxenai/W8EBryVYRkX4WOUa/images/rmod_final_page.png?fit=max&auto=format&n=W8EBryVYRkX4WOUa&q=85&s=4f3153c876609bf89699b0ed22adf21d" alt="RMOD completed" width="2880" height="1736" data-path="images/rmod_final_page.png" />

You can then search through the sentiment evaluation immediately with Oxen's Text2SQL feature. In this case, we are finding all the rows with negative sentiment.

<img className="block" src="https://mintcdn.com/oxenai/VndlMSXTb9YuU-Wl/images/text2sql_sentiment.png?fit=max&auto=format&n=VndlMSXTb9YuU-Wl&q=85&s=eb510472ab7618e812ade602faf874af" alt="Text2SQL example" width="2880" height="1736" data-path="images/text2sql_sentiment.png" />

You can also run queries such as *"What was the most common sentiment?"* or *"How many rows were classified as positive?"*

Congratulations! You've just seen how easy it is to run sentiment analysis on your data with Oxen. Feel free to tweak your prompt, model, or dataset and see how the results change.
