{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "1c8b9b57", "metadata": {}, "source": [ "# Using Frozen Parameters Bert for Sentiment Classification\n", "\n", "In this example, we will construct a text classifier with parameter frozen bert, and train in on the IMDB sentimental classifcation dataset\n", "\n", "## Dataset: IMDB Sentimental\n", "\n", "This is an binary classification dataset, you can download our processed dataset from here: \n", "- https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/fate/examples/data/IMDB.csv\n", "and place it in the examples/data folder. \n", "\n", "The orgin data is from: \n", "- https://ai.stanford.edu/~amaas/data/sentiment/" ] }, { "attachments": {}, "cell_type": "markdown", "id": "d0b7757b", "metadata": {}, "source": [ "## Check dataset" ] }, { "cell_type": "code", "execution_count": 9, "id": "5b87e19e", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "df = pd.read_csv('../../../../examples/data/IMDB.csv')" ] }, { "cell_type": "code", "execution_count": 10, "id": "718f82a0", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | id | \n", "text | \n", "label | \n", "
---|---|---|---|
0 | \n", "0 | \n", "One of the other reviewers has mentioned that ... | \n", "1 | \n", "
1 | \n", "1 | \n", "A wonderful little production. <br /><br />The... | \n", "1 | \n", "
2 | \n", "2 | \n", "I thought this was a wonderful way to spend ti... | \n", "1 | \n", "
3 | \n", "3 | \n", "Basically there's a family where a little boy ... | \n", "0 | \n", "
4 | \n", "4 | \n", "Petter Mattei's \"Love in the Time of Money\" is... | \n", "1 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "
1996 | \n", "1996 | \n", "THE CELL (2000) Rating: 8/10<br /><br />The Ce... | \n", "1 | \n", "
1997 | \n", "1997 | \n", "This movie, despite its list of B, C, and D li... | \n", "0 | \n", "
1998 | \n", "1998 | \n", "I loved this movie! It was all I could do not ... | \n", "1 | \n", "
1999 | \n", "1999 | \n", "This was the worst movie I have ever seen Bill... | \n", "0 | \n", "
2000 | \n", "2000 | \n", "Stranded in Space (1972) MST3K version - a ver... | \n", "0 | \n", "
2001 rows × 3 columns
\n", "