{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Word2Vecを用いるセンチメント分析" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "import torch\n", "#device = torch.device('mps') # macbook\n", "device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## データ準備\n", "\n", "### CSVファイルを読み込む" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | index | \n", "brand | \n", "sentiment | \n", "text | \n", "
---|---|---|---|---|
0 | \n", "2401 | \n", "Borderlands | \n", "Positive | \n", "im getting on borderlands and i will murder yo... | \n", "
1 | \n", "2401 | \n", "Borderlands | \n", "Positive | \n", "I am coming to the borders and I will kill you... | \n", "
2 | \n", "2401 | \n", "Borderlands | \n", "Positive | \n", "im getting on borderlands and i will kill you ... | \n", "
3 | \n", "2401 | \n", "Borderlands | \n", "Positive | \n", "im coming on borderlands and i will murder you... | \n", "
4 | \n", "2401 | \n", "Borderlands | \n", "Positive | \n", "im getting on borderlands 2 and i will murder ... | \n", "