Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
1845 lines (1844 sloc) 83.1 KB
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "Q2FtGCN6bVsg"
},
"source": [
"# Finding Fact-checkable Tweets with Machine Learning\n",
"\n",
"This notebook was copied and modified from one originally created by Jeremy Howard and the other folks at [fast.ai](https://fast.ai) as part of [this fantastic class](https://course.fast.ai/). Specifically, it comes from Lesson 4. You can [see the lession video](https://course.fast.ai/videos/?lesson=4) and [the original class notebook](https://github.com/fastai/course-v3/blob/master/nbs/dl1/lesson3-imdb.ipynb). \n",
"\n",
"For more information about this project, and details about how to use this work in the wild, check out our [Quartz AI Studio blog post about the checkable-tweets project](https://qz.ai/?p=89).\n",
"\n",
"-- John Keefe"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "iPm37jhhPCVo"
},
"source": [
"## Using this notebook\n",
"\n",
"You can run a [version of this notebook live](https://colab.research.google.com/drive/1Hq1OAe_-zLWVw8I_ZJO1euDxaCKPQzqe#scrollTo=Q2FtGCN6bVsg) using Google Colaboratory.\n",
"\n",
"That way you can use Colab's \"GPU runtime,\" to process data and train models faster. Alternatively, you can copy this repo onto a computer with a GPU or try running it on a (slower) CPU."
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"collapsed": true,
"id": "mHe4vsWQbVsj"
},
"outputs": [],
"source": [
"# These lines set up some preferences\n",
"%reload_ext autoreload\n",
"%autoreload 2\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"collapsed": true,
"id": "Rkdn_3eMbVsn"
},
"outputs": [],
"source": [
"# Now we get fast.ai\n",
"from fastai.text import *"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "9TPvnzypbVsq"
},
"source": [
"### Take a peek at the tweet data"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "I21aOI9xbVsr"
},
"source": [
"Working with Dan Keemahill and Madlin Mekelburg over a couple of weeks during the 2019 Texas state legislative session, I have have a set of 3,797 tweets humans at the Austin American-Statesman have determined are – or are not – statements that can be fact-checked. "
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 204
},
"colab_type": "code",
"collapsed": false,
"id": "kWwuVUg9QHo8",
"outputId": "703590d9-71c2-4d1b-96cf-aa0a113be58a"
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Unnamed: 0</th>\n",
" <th>tweet_text</th>\n",
" <th>checkable</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0</td>\n",
" <td>TOMORROW: Dallas Workers Head to TX Capitol to...</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1</td>\n",
" <td>Texas House members told to stop secretly reco...</td>\n",
" <td>True</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2</td>\n",
" <td>SB 1163 - Relating to establishing and funding...</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>3</td>\n",
" <td>Did you know that we’re carbon neutral* when i...</td>\n",
" <td>True</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>4</td>\n",
" <td>Check our this article on the Baylor sexual as...</td>\n",
" <td>False</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Unnamed: 0 tweet_text checkable\n",
"0 0 TOMORROW: Dallas Workers Head to TX Capitol to... False\n",
"1 1 Texas House members told to stop secretly reco... True\n",
"2 2 SB 1163 - Relating to establishing and funding... False\n",
"3 3 Did you know that we’re carbon neutral* when i... True\n",
"4 4 Check our this article on the Baylor sexual as... False"
]
},
"execution_count": 5,
"metadata": {
"tags": []
},
"output_type": "execute_result"
}
],
"source": [
"# Here I read the csv into a data frame I called `austin_tweets`\n",
"# and take a look at the first few rows\n",
"path = Path('./data')\n",
"austin_tweets = pd.read_csv(path/'hand_coded_austin_tweets.csv')\n",
"austin_tweets.head()"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "eym6ulq0bVuz"
},
"source": [
"## Building the language model"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "62pxEwWPbVvI"
},
"source": [
"Before we make a model that classifies whether tweets are checkable, we're going to build a model that 'understands' the rules of English – the language model. \n",
"\n",
"Even several thousand tweets isn't enough to teach a computer patterns of English, so we'll start with a language model pretrained on a thousands of Wikipedia articles called [wikitext-103](https://einstein.ai/research/blog/the-wikitext-long-term-dependency-language-modeling-dataset). That language model has been trained to guess the next word in a sentence based on all the previous words. It has a recurrent structure with a hidden state that is updated each time it sees a new word. This hidden state thus contains information about the sentence up to that point.\n",
"\n",
"We'll take that Wikitext model and fine-tune it for our particular dataset–the #txlege tweets. Because the English of #txlege tweets isn't the same as the English of Wikipedia, we'll adjust the internal parameters of the model by a little bit. That includes adding words that might be extremely common in the tweets but would be barely present in wikipedia–and therefore might not be part of the vocabulary the model was trained on."
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "FT0C6-vpbVvK"
},
"source": [
"### Adding more tweets for the language model\n",
"\n",
"We'll use the text in the 3,797 tweets we already have to help the language model better \"understand\" our data set. To give it even more examples, I collected several days worth of (uncategorized) #txlege tweets, which are in a file called `tweet_corpus.txt`.\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 204
},
"colab_type": "code",
"collapsed": false,
"id": "18kBCGjhbVvQ",
"outputId": "e36434d1-d47d-44c0-c6ab-82a61843ad2a"
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>tweet_text</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>State Rep. @CBellJr earned an F on this year's...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>#txlege https://t.co/1qqa0sFEnY</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>ICYMI: @dallasnews editorial weighs in on the ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>My life is complete! #txlege #FlagDay #mindblo...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>On June 14, 1777, our nation adopted the U.S. ...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" tweet_text\n",
"0 State Rep. @CBellJr earned an F on this year's...\n",
"1 #txlege https://t.co/1qqa0sFEnY\n",
"2 ICYMI: @dallasnews editorial weighs in on the ...\n",
"3 My life is complete! #txlege #FlagDay #mindblo...\n",
"4 On June 14, 1777, our nation adopted the U.S. ..."
]
},
"execution_count": 6,
"metadata": {
"tags": []
},
"output_type": "execute_result"
}
],
"source": [
"# read in the corpus, which has one tweet per row,\n",
"# and take a look at the first frew rows\n",
"corpus_tweets = pd.read_csv(path/'tweet_corpus.txt')\n",
"corpus_tweets.head()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"colab_type": "code",
"collapsed": false,
"id": "aQyQIh_vNhrH",
"outputId": "9a6afe30-01c4-4445-d7a7-8c835d7d62fc"
},
"outputs": [
{
"data": {
"text/plain": [
"(3797, 3688, 7485)"
]
},
"execution_count": 7,
"metadata": {
"tags": []
},
"output_type": "execute_result"
}
],
"source": [
"# here I concatenate the two tweet sets\n",
"lm_tweets = pd.concat([austin_tweets,corpus_tweets], sort=True)\n",
"\n",
"# as a sanity check, let's look at the size of each set, \n",
"# and then the ontatenated set\n",
"len(austin_tweets), len(corpus_tweets), len(lm_tweets),"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "g55U1v3mbVvm"
},
"source": [
"Great: Now we have 7,485 tweets to use for the language model.\n",
"\n",
"One thing to note ... the first set had two columns, `checkable` and `tweet_text`, while the corpus had just one collumn, `tweet_text`. The combined has the original two columns, though many of the entries will be `NaN` for \"not a number.\" Thats okay, because we're only going to use the `tweet_text` column for the language model.\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 204
},
"colab_type": "code",
"collapsed": false,
"id": "LPVLlF5sbVvn",
"outputId": "5aba630c-8742-4147-b818-d4d32dff8e2d"
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Unnamed: 0</th>\n",
" <th>checkable</th>\n",
" <th>tweet_text</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>3683</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>From our friends at @ProgressTX: One of the to...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3684</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>@GregAbbott_TX The Texas House failed Texans. ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3685</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>Good to see one recommendation from Gov. Abbot...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3686</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>Our executive director @antgutierrez spoke to ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3687</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Unnamed: 0 checkable tweet_text\n",
"3683 NaN NaN From our friends at @ProgressTX: One of the to...\n",
"3684 NaN NaN @GregAbbott_TX The Texas House failed Texans. ...\n",
"3685 NaN NaN Good to see one recommendation from Gov. Abbot...\n",
"3686 NaN NaN Our executive director @antgutierrez spoke to ...\n",
"3687 NaN NaN NaN"
]
},
"execution_count": 8,
"metadata": {
"tags": []
},
"output_type": "execute_result"
}
],
"source": [
"# show the last few rows ... and we can see NaNs in the `checkable` column, \n",
"# which is ok here because we don't use that column in the language model\n",
"lm_tweets.tail()"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"collapsed": true,
"id": "pFp92p9NbVvs"
},
"outputs": [],
"source": [
"# But we can't have NaN in the 'tweet_text' column, because it will make things unhappy.\n",
"# Let's fix that:\n",
"lm_tweets.dropna(subset=['tweet_text'], inplace=True)\n",
"\n",
"# Saving as csv for easier reading in a moment\n",
"lm_tweets.to_csv(path/'lm_tweets.csv')"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "3fU_R9lxbVv7"
},
"source": [
"Fast.ai uses a concept called a \"[data bunch](https://docs.fast.ai/basic_data.html)\" to handle machine-learning data, which takes care of a lot of the more fickle machine-learning data preparation.\n",
"\n",
"We have to use a special kind of data bunch for the language model, one that ignores the labels, and will shuffle the texts at each epoch before concatenating them all together (only the training set gets shuffled; we don't shuffle for the validation set). It will also create batches that read the text in order with targets (aka the best guesses) that are the next word in the sentence.\n"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"collapsed": true,
"id": "C2rJuWVCbVv5"
},
"outputs": [],
"source": [
"# Loading in data with the TextLMDataBunch factory class, using all the defaults\n",
"data_lm = TextLMDataBunch.from_csv(path, 'lm_tweets.csv', text_cols='tweet_text', label_cols='checkable')\n",
"data_lm.save('data_lm_tweets')"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "pwB-RJOjOSG_"
},
"source": [
"### Quick digression: Let's look at the data\n",
"\n",
"The data bunch function does some nifty things behind the scenes. Let's take a moment to look at what is happening. (This is optional, but interesting!)\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "YMqNHzHabVub"
},
"source": [
"#### Tokenization"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "wLWA1H6VbVub"
},
"source": [
"The first step of processing is to split the raw tweets into words, or more exactly tokens. The easiest way to do this would be to split the string on spaces, but fast.ai is smarter:\n",
"\n",
"- we need to take care of punctuation\n",
"- some words are contractions of two different words, like isn't or don't\n",
"- we may need to clean some parts of our texts, if there's HTML code for instance\n",
"\n",
"To see what the tokenizer had done behind the scenes, let's have a look at a few texts in a batch."
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 323
},
"colab_type": "code",
"collapsed": false,
"id": "QwRe7uZ1bVu5",
"outputId": "b49a87ff-818d-476c-df73-836a7153c5a5"
},
"outputs": [
{
"data": {
"text/html": [
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th>idx</th>\n",
" <th>text</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>0</td>\n",
" <td>/ t.co / oiavkdc6e5 # txlege xxbos xxmaj vetoes to date for the 86th # txlege session : xxup hb xxunk and sbs xxunk , xxunk , 511 , xxunk , xxunk . xxmaj this is already equal to the number vetoed from the xxunk session , and there are several days left to veto more bills . xxmaj yikes . xxmaj the last veto xxunk by the xxmaj texas</td>\n",
" </tr>\n",
" <tr>\n",
" <td>1</td>\n",
" <td>xxmaj now enjoy that beer at your happy hour tonight and i ’ll see you after my marathon night on the xxmaj texas xxmaj house floor on the campaign trail ! # txlege # johnsonfordallas https : / / t.co / xxunk xxbos xxmaj happy xxmaj friday ! xxmaj here 's our latest xxmaj weekly xxmaj update ! \\n xxmaj we 're at our 100th xxmaj day and we</td>\n",
" </tr>\n",
" <tr>\n",
" <td>2</td>\n",
" <td>solved because we can all become plumbers , ” said xxmaj sunset xxmaj vice xxmaj chair @chrispaddie https : / / t.co / xxunk # txlege xxbos “ xxmaj in a conference call with reporters , the researchers said when women abruptly lose health coverage so soon after giving birth , it can force them to xxunk medication and other ongoing treatment they may need , including support for postpartum</td>\n",
" </tr>\n",
" <tr>\n",
" <td>3</td>\n",
" <td># xxunk to # xxunk , # xxunk , made calls , sent emails , showed up in # txlege offices to demand $ for xxup isd ’s to provide xxunk xxmaj now , we organize locally . xxmaj great job @edaustin_tx ! # teamtsta # redfored https : / / t.co / xxunk xxbos xxmaj thanks to the xxunk &amp; &amp; @repescobar for a xxunk xxunk on how we</td>\n",
" </tr>\n",
" <tr>\n",
" <td>4</td>\n",
" <td>college campuses that must end . https : / / t.co / xxunk xxbos xxmaj proud to stand with xxunk to offer xxunk xxunk to first time xxup xxunk offenders . xxmaj this bill would protect texans from repeat offenders while allowing for first time offenders to have recourse . # menendez4tx # txlege https : / / t.co / xxunk xxbos i ’m not saying that my son xxunk</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {
"tags": []
},
"output_type": "display_data"
}
],
"source": [
"# Note that language models can use a lot of GPU, here\n",
"# If you're not using Google Colab you may need to decrease batch size\n",
"bs=48\n",
"data_lm = load_data(path, 'data_lm_tweets', bs=bs)\n",
"data_lm.show_batch()"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "CAlddd1CbVug"
},
"source": [
"The texts are truncated at 100 tokens for more readability. We can see that it did more than just split on space and punctuation symbols: \n",
"- the \"'s\" are grouped together in one token\n",
"- the contractions are separated like this: \"did\", \"n't\"\n",
"- content has been cleaned for any HTML symbol and lower cased\n",
"- there are several special tokens (all those that begin by xx), to replace unknown tokens (see below) or to introduce different text fields (here we only have one)."
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "pF6JV9osbVuh"
},
"source": [
"#### Numericalization"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "Nbllo71jbVui"
},
"source": [
"Once we have extracted tokens from our texts, we convert to integers by creating a list of all the words used. We only keep the ones that appear at least twice with a maximum vocabulary size of 60,000 (by default) and replace the ones that don't make the cut by the unknown token `UNK`.\n",
"\n",
"The correspondance from ids to tokens is stored in the `vocab` attribute of our datasets, in a dictionary called `itos` (for int to string)."
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 187
},
"colab_type": "code",
"collapsed": false,
"id": "ub9Wpy0VbVui",
"outputId": "9d86f928-8baf-4d26-86cb-9a230aa1b8de"
},
"outputs": [
{
"data": {
"text/plain": [
"['xxunk',\n",
" 'xxpad',\n",
" 'xxbos',\n",
" 'xxeos',\n",
" 'xxfld',\n",
" 'xxmaj',\n",
" 'xxup',\n",
" 'xxrep',\n",
" 'xxwrep',\n",
" '/']"
]
},
"execution_count": 12,
"metadata": {
"tags": []
},
"output_type": "execute_result"
}
],
"source": [
"data_lm.vocab.itos[:10]"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "2dHeF4qzbVup"
},
"source": [
"And if we look at what a what's in our datasets, we'll see the tokenized text as a representation:"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 54
},
"colab_type": "code",
"collapsed": false,
"id": "rirfNAiLbVup",
"outputId": "be6d8556-6076-45a6-af2f-10c3c663d62c"
},
"outputs": [
{
"data": {
"text/plain": [
"Text xxbos xxmaj the xxmaj texas xxmaj house gave initial passage to a bill to legalize broader use of medical marijuana this week . xxmaj but the bill still faces a major xxunk in the more - conservative xxmaj senate . https : / / t.co / oiavkdc6e5 # txlege"
]
},
"execution_count": 13,
"metadata": {
"tags": []
},
"output_type": "execute_result"
}
],
"source": [
"data_lm.train_ds[1][0]"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "lSYlLii3bVus"
},
"source": [
"But the underlying data is all numbers"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"colab_type": "code",
"collapsed": false,
"id": "pcaoh2nobVut",
"outputId": "65463433-ce44-4b0a-e372-5a479096d824"
},
"outputs": [
{
"data": {
"text/plain": [
"array([ 2, 5, 12, 5, 25, 5, 51, 563, 2613, 1207])"
]
},
"execution_count": 14,
"metadata": {
"tags": []
},
"output_type": "execute_result"
}
],
"source": [
"data_lm.train_ds[1][0].data[:10]"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "fbwXbu_6Tk7T"
},
"source": [
"### Back to making the Language Model"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "rY0LkJCQbVwF"
},
"source": [
"We can then put all of our tweets (now stored in `data_lm`) in a learner object very easily with the Wikitext model loaded with the pretrained weights (here called `AWD_LTSM`). They'll be downloaded the first time you'll execute the following line and stored in `~/.fastai/models/`"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"collapsed": true,
"id": "EiiXrA6zbVwH"
},
"outputs": [],
"source": [
"learn = language_model_learner(data_lm, AWD_LSTM, drop_mult=0.3)"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "RfAXUyLnOB_J"
},
"source": [
"One of the most important settings when we actually _train_ our model is the **learning rate**. I'm not going to dive into it here (though I encourage you to explore it), but will use a fast.ai tool to find the best learning rate to start with:"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"colab_type": "code",
"collapsed": false,
"id": "W7b-Z94dbVwL",
"outputId": "f6044993-11ab-4889-c0fe-892243e61a2e"
},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {
"tags": []
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"LR Finder is complete, type {learner_name}.recorder.plot() to see the graph.\n"
]
}
],
"source": [
"learn.lr_find()"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 283
},
"colab_type": "code",
"collapsed": false,
"id": "Un204GpfbVwO",
"outputId": "607fdc89-064b-427b-e92e-f35bdc868923"
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZIAAAEKCAYAAAA4t9PUAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xl8XXWd//HXJ/vaJG3SfUn30kJb\n27RAKQgCZVFEFAdchtXpr4qIGy7jYxzE0Rm3cXBQEBAUFRyoFgW0FIulrJaUrkBbum+kSbeszf75\n/XFvJYRsb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ZHcCP3X0O8BHgvujyTcDZ7v4eIrPpfrfFc2YBV7r7e6OP3wN8\nHpgKjAPOauN1MoGX3X0GsBL4lxavf4e7n8Y7Z1RtU3Sep/OJzC4AUAtc4e6ziFwD50fRIPsasM3d\nZ7r7rWa2AJgIzAVmArPN7JzOXk+kp/THSRul/7gAmNpiZtQB0RlTc4BfmdlEIjMeJ7d4ztPu3vKa\nD6vcfS+Ama0lMtfR861ep563J7pcDVwYvX8mb1/L4SHgh+3UmR7d9gjgDSLXhoDIXEffjYZCc3T9\nkDaevyB6WxN9nEUkWFa283oiPUpBIn1ZAnCGu9e2XGhmdwJ/c/croscbVrRYXd1qG3Ut7jfR9s9M\ng799sLG9Nh055u4zo9PgPwXcBPyEyPVHCoDZ7t5gZjuBtDaeb8B/uvvPT/B1RXqEdm1JX7aMyIy5\nAJjZ8em2c3h7auzrAnz9l4nsUgO4urPG7l5D5HK6XzKzJCJ1lkZD5DxgTLRpJZDd4qlPATdER1uY\n2QgzG9xDfRDplIJE+ooMM9vb4vZFIr+Ui6IHoF8nMv0/wPeB/zSzNQQ7Kv888EUzW0/k4kLlnT3B\n3dcQmen3Y0SuP1JkZhuAa4gc28HdDwEvRE8X/oG7LyOy6+ylaNvFvDNoRAKl039FAhLdVXXM3d3M\nrgY+5u6Xd/Y8kXijYyQiwZkN3Bk90+ooIVy+WCQWNCIREZFu0TESERHpFgWJiIh0i4JERES6RUEi\nIiLdoiAREZFuUZCIiEi3/H/YjwEuUj/3pgAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"tags": []
},
"output_type": "display_data"
}
],
"source": [
"learn.recorder.plot(skip_end=15)"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "td3D3mK8TtHa"
},
"source": [
"This gives us a graph of the optimal learning rate ... which is the point where the graph really dives downward (`1e-02`). Again, there's much more on picking and learning rates in the fast.ai course."
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "BQA3dZWPachE"
},
"source": [
"Now we can train the Language Model. (Essentailly, we're training it to be good at guessing the *next word* in a sentence, given all of the previous words.)\n",
"\n",
"The variabales we're passing are `1` to just do one cycle of learning, the learning rate of `1e-2`, and some momentum settings we won't get into here -- but these are pretty safe. "
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 80
},
"colab_type": "code",
"collapsed": false,
"id": "pveLnA6kbVwQ",
"outputId": "38ef873c-5c2a-461d-9688-d8f4e1edbd5f"
},
"outputs": [
{
"data": {
"text/html": [
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: left;\">\n",
" <th>epoch</th>\n",
" <th>train_loss</th>\n",
" <th>valid_loss</th>\n",
" <th>accuracy</th>\n",
" <th>time</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>0</td>\n",
" <td>4.192750</td>\n",
" <td>3.598085</td>\n",
" <td>0.369016</td>\n",
" <td>00:25</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {
"tags": []
},
"output_type": "display_data"
}
],
"source": [
"learn.fit_one_cycle(1, 1e-2, moms=(0.8,0.7))"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 80
},
"colab_type": "code",
"collapsed": false,
"id": "o-dYIVFcbVwS",
"outputId": "aa2db805-6429-4592-f905-0479b9872820"
},
"outputs": [
{
"data": {
"text/html": [
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: left;\">\n",
" <th>epoch</th>\n",
" <th>train_loss</th>\n",
" <th>valid_loss</th>\n",
" <th>accuracy</th>\n",
" <th>time</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>0</td>\n",
" <td>3.981636</td>\n",
" <td>3.663427</td>\n",
" <td>0.369721</td>\n",
" <td>00:25</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {
"tags": []
},
"output_type": "display_data"
}
],
"source": [
"learn.fit_one_cycle(1, 1e-1, moms=(0.8,0.7))\n"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"collapsed": true,
"id": "yMTSnTqIbVwU"
},
"outputs": [],
"source": [
"# optionally save and reload the model (file is about 150MB)\n",
"learn.save('fit_head')\n",
"learn.load('fit_head');"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "M8kZOKSybVwX"
},
"source": [
"To complete the fine-tuning, we \"unfreeze\" the original Wikitext language model and let the new training efforts -- work their way into the original neural network."
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 359
},
"colab_type": "code",
"collapsed": false,
"id": "kTfuNCuhbVwX",
"outputId": "1e99e6bc-8421-4d63-faf3-4c16fb3f07f6"
},
"outputs": [
{
"data": {
"text/html": [
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: left;\">\n",
" <th>epoch</th>\n",
" <th>train_loss</th>\n",
" <th>valid_loss</th>\n",
" <th>accuracy</th>\n",
" <th>time</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>0</td>\n",
" <td>3.221620</td>\n",
" <td>3.594337</td>\n",
" <td>0.380122</td>\n",
" <td>00:31</td>\n",
" </tr>\n",
" <tr>\n",
" <td>1</td>\n",
" <td>3.098113</td>\n",
" <td>3.497657</td>\n",
" <td>0.391009</td>\n",
" <td>00:31</td>\n",
" </tr>\n",
" <tr>\n",
" <td>2</td>\n",
" <td>2.900118</td>\n",
" <td>3.467964</td>\n",
" <td>0.397901</td>\n",
" <td>00:31</td>\n",
" </tr>\n",
" <tr>\n",
" <td>3</td>\n",
" <td>2.594839</td>\n",
" <td>3.485903</td>\n",
" <td>0.401159</td>\n",
" <td>00:31</td>\n",
" </tr>\n",
" <tr>\n",
" <td>4</td>\n",
" <td>2.229434</td>\n",
" <td>3.589874</td>\n",
" <td>0.398919</td>\n",
" <td>00:31</td>\n",
" </tr>\n",
" <tr>\n",
" <td>5</td>\n",
" <td>1.875757</td>\n",
" <td>3.713223</td>\n",
" <td>0.398731</td>\n",
" <td>00:31</td>\n",
" </tr>\n",
" <tr>\n",
" <td>6</td>\n",
" <td>1.575312</td>\n",
" <td>3.859700</td>\n",
" <td>0.395990</td>\n",
" <td>00:31</td>\n",
" </tr>\n",
" <tr>\n",
" <td>7</td>\n",
" <td>1.386395</td>\n",
" <td>3.937915</td>\n",
" <td>0.395097</td>\n",
" <td>00:31</td>\n",
" </tr>\n",
" <tr>\n",
" <td>8</td>\n",
" <td>1.247221</td>\n",
" <td>4.008004</td>\n",
" <td>0.394095</td>\n",
" <td>00:31</td>\n",
" </tr>\n",
" <tr>\n",
" <td>9</td>\n",
" <td>1.155052</td>\n",
" <td>4.024599</td>\n",
" <td>0.393687</td>\n",
" <td>00:31</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {
"tags": []
},
"output_type": "display_data"
}
],
"source": [
"# This takes about 5 minutes!\n",
"learn.unfreeze()\n",
"learn.fit_one_cycle(10, 1e-3, moms=(0.8,0.7))"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"collapsed": true,
"id": "xq3OgYK-bVwb"
},
"outputs": [],
"source": [
"# optionally save what we have - file is about 300MB\n",
"learn.save('fine_tuned')"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "fv0mZuVhbVwd"
},
"source": [
"While 39% accuracy may _seem_ low ... in this case it means the language model correctly guessed the next word in a sentence more than 1/3 of the time. That's pretty good! And we can see that even when it's wrong, it makes some pretty \"logical\" guesses. \n",
"\n",
"Let's give it a starting phrase and see how it does:\n"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 88
},
"colab_type": "code",
"collapsed": false,
"id": "_Wws03kmbVwd",
"outputId": "dd545482-c5c8-4e93-a79e-64578e6478a3"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"I wonder if this is any chance you ’ll recognize that we have nothing better about me . # txlege https : / / t.co / SMPT1HLS5Z xxbos The first Repub @txlgbtqcaucus who deserves to have a vote on the #\n",
"I wonder if this is true this session ? We are probably trying to get it to the Governor in 2020 . This is how i really do n’t know . # txlege https : / / t.co / XXBOS\n",
"I wonder if this bill comes over again about the state 's failure to adequately fund Texas parks , # txlege # DFW https : / / t.co / khai7pcxke xxbos Last session , House Bill 3490 was vetoed\n"
]
}
],
"source": [
"TEXT = \"I wonder if this\"\n",
"N_WORDS = 40\n",
"N_SENTENCES = 3\n",
"\n",
"print(\"\\n\".join(learn.predict(TEXT, N_WORDS, temperature=0.75) for _ in range(N_SENTENCES)))"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "hj3aD0UebVwr"
},
"source": [
"Remember, these are not real ... they were _generated_ by the model when it tried to guess each of the next words in the sentence! Generating text like this is not why we made the language model (though you can see where text-generation AI starts from!)\n",
"\n",
"Also note that the model is often crafting the response _in the form of a tweet!_\n",
"\n",
"We now save not only the model, but also its encoder, which is the mathematical representation of what the language model \"understands\" about English patterns."
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"collapsed": true,
"id": "thkQAeQ2bVwr"
},
"outputs": [],
"source": [
"# have to save this one, about 130MB\n",
"learn.save_encoder('fine_tuned_enc') "
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "zt6pDPEDbVww"
},
"source": [
"## Building the classifier model\n",
"\n",
"This is the model that will use our langauge model **and** the hand-coded tweets to guess if new tweets are fact-checkable or not.\n",
"\n",
"We'll create a new data bunch that only grabs the hand-coded tweets and keeps track of the labels there (true or false, for fact-checkability). We also pass in the `vocab` -- which is the list of the most useful words from the language model."
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"collapsed": true,
"id": "ntIAhZbbbVw1"
},
"outputs": [],
"source": [
"data_clas = TextClasDataBunch.from_csv(path, 'hand_coded_austin_tweets.csv', vocab=data_lm.vocab, text_cols='tweet_text', label_cols='checkable')\n",
"\n",
"data_clas.save('data_clas_tweets')"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "I3wfbjMrRDzf"
},
"source": [
"And here's how the computer has tokenized the tweets:"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 323
},
"colab_type": "code",
"collapsed": false,
"id": "iBHYA4q_bVw7",
"outputId": "9016b7b9-b035-4f6d-a0c8-8bc7b304c55b"
},
"outputs": [
{
"data": {
"text/html": [
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th>text</th>\n",
" <th>target</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>xxbos @cjtackett @williamstodd78 @atpe_montye @pastors4txkids xxunk xxunk xxunk @officialatpe @texans4e @teachthevote @lmcgaughy @senlarrytaylor @kirkpwatson xxunk @txedvote xxunk xxunk xxmaj stats are likely wrong . xxmaj plus , many biz only few make top salary . xxmaj in # xxup hb3 / # xxup sb4 xxup tx is planning to make a substantial xxunk - billion permanent investment in merit pay programs . xxmaj do your really think effective teachers will</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
" <td>xxbos # xxunk xxmaj baseball xxmaj xxunk : xxmaj april 8th \\n \\n 2 . xxmaj xxunk xxmaj xxunk \\n xxmaj record : ( 16 - 6 - 1 ) xxmaj last xxmaj week : # 3 \\n \\n 4 . xxmaj xxunk - xxmaj jefferson xxmaj xxunk \\n xxmaj record : ( 12 - 8 ) xxmaj last xxmaj week : # 8 \\n \\n</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
" <td>xxbos xxmaj on our way back to xxmaj south xxmaj carolina . xxmaj hope to see you in : \\n xxunk xxmaj xxunk today at 5 ( xxup xxunk xxunk xxmaj middle xxmaj school xxmaj gym ) \\n xxunk xxmaj xxunk xxmaj saturday at xxunk ( xxmaj xxunk 's xxmaj xxunk xxmaj restaurant ) \\n xxunk xxmaj xxunk xxmaj saturday at 3 ( xxmaj xxunk xxmaj hall</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
" <td>xxbos xxmaj just now : xxmaj desk mtg of the xxmaj senate xxmaj education xxmaj committee to vote out the following : \\n \\n xxup hb 18 ( xxmaj bettencourt , xxmaj fallon , xxmaj hall , &amp; &amp; xxmaj hughes voting no ) \\n xxup hb 65 \\n xxup hb xxunk \\n xxup hb xxunk \\n xxup hb xxunk \\n xxup hb xxunk</td>\n",
" <td>False</td>\n",
" </tr>\n",
" <tr>\n",
" <td>xxbos xxmaj xxunk xxmaj easter photo where we look like we ’ve got it all together . ( xxmaj we do n’t ! ) xxmaj all in all , we ’re as happy as we look in this photo . xxmaj we ’ve got our issues , xxunk &amp; &amp; challenges . xxmaj but xxmaj jesus is xxmaj alive - and that makes us way too blessed to be xxunk</td>\n",
" <td>False</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {
"tags": []
},
"output_type": "display_data"
}
],
"source": [
"data_clas.show_batch()"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "WCwf-DyEbVxA"
},
"source": [
"We can then create a model to classify tweets. You can see that in the next two lines we include the processed, hand-coded tweets (`data_clas`), the original Wikitext model (`AWD_LSTM`), and the knowledge we saved after infusing the language model with tweets (`fine_tuned_enc`)."
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"collapsed": true,
"id": "xlJKU0g3bVxA"
},
"outputs": [],
"source": [
"learn = text_classifier_learner(data_clas, AWD_LSTM, drop_mult=0.5)\n",
"learn.load_encoder('fine_tuned_enc')"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "ElVQYvpPRwOJ"
},
"source": [
"Again, we need to find the best learning rate, where the slope starts to drop ..."
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"colab_type": "code",
"collapsed": false,
"id": "qtLBfovqbVxC",
"outputId": "c9687d87-8db6-47d4-e4ac-fc6f2991243f"
},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {
"tags": []
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"LR Finder is complete, type {learner_name}.recorder.plot() to see the graph.\n"
]
}
],
"source": [
"learn.lr_find()"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 283
},
"colab_type": "code",
"collapsed": false,
"id": "KvESjgILbVxI",
"outputId": "63ddca80-8175-4f5e-f5df-f74429276416"
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEKCAYAAADjDHn2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xl8nWWZ//HPlX1Pmibd9422tFAg\nlKWIgCwFUQQFCzKCW38qoIg64zKCAzLqjA5uuACDCwqIoFgQKYggA7bQFLpDSxfSJqW0TdqkzUly\nsly/P87TcgjZ2uZsyff9ej2vnnOf+znPdZrlyr08923ujoiISE/SEh2AiIgkPyULERHplZKFiIj0\nSslCRER6pW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RsIAAAAA\nSUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"tags": []
},
"output_type": "display_data"
}
],
"source": [
"learn.recorder.plot()"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "Az5OuN6_hJaF"
},
"source": [
"Again, we're using the point where the learning rate slopes down to train our model -- here `1e-2`. We're also using \"momentums\" which we'll get into another time."
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 80
},
"colab_type": "code",
"collapsed": false,
"id": "S5g2xmtlbVxJ",
"outputId": "79971cc2-dde2-4dfc-a340-7dcae79f2bdd"
},
"outputs": [
{
"data": {
"text/html": [
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: left;\">\n",
" <th>epoch</th>\n",
" <th>train_loss</th>\n",
" <th>valid_loss</th>\n",
" <th>accuracy</th>\n",
" <th>time</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>0</td>\n",
" <td>0.358472</td>\n",
" <td>0.232218</td>\n",
" <td>0.914474</td>\n",
" <td>00:05</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {
"tags": []
},
"output_type": "display_data"
}
],
"source": [
"learn.fit_one_cycle(1, 1e-2, moms=(0.8,0.7))"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "hBqDZ37oSMkc"
},
"source": [
"Accuracy of 91%! We can still do more training ... partly because the validation loss is still less than the training loss. Also we freeze the model except the last layer using `freeze_to(-2)`"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 80
},
"colab_type": "code",
"collapsed": false,
"id": "27B3A5PDbVxP",
"outputId": "40597d91-76eb-4089-9b20-486eff538e64"
},
"outputs": [
{
"data": {
"text/html": [
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: left;\">\n",
" <th>epoch</th>\n",
" <th>train_loss</th>\n",
" <th>valid_loss</th>\n",
" <th>accuracy</th>\n",
" <th>time</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>0</td>\n",
" <td>0.228632</td>\n",
" <td>0.196591</td>\n",
" <td>0.928947</td>\n",
" <td>00:06</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {
"tags": []
},
"output_type": "display_data"
}
],
"source": [
"learn.freeze_to(-2)\n",
"learn.fit_one_cycle(1, slice(1e-2/(2.6**4),1e-2), moms=(0.8,0.7))"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "6_yMw6DsS_t1"
},
"source": [
"Better! But looks like we can do more."
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 80
},
"colab_type": "code",
"collapsed": false,
"id": "zQ4AaOVDbVxT",
"outputId": "fa009202-13c5-47fe-ac56-39a391f04a71"
},
"outputs": [
{
"data": {
"text/html": [
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: left;\">\n",
" <th>epoch</th>\n",
" <th>train_loss</th>\n",
" <th>valid_loss</th>\n",
" <th>accuracy</th>\n",
" <th>time</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>0</td>\n",
" <td>0.197604</td>\n",
" <td>0.189697</td>\n",
" <td>0.931579</td>\n",
" <td>00:10</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {
"tags": []
},
"output_type": "display_data"
}
],
"source": [
"learn.freeze_to(-3)\n",
"learn.fit_one_cycle(1, slice(5e-3/(2.6**4),5e-3), moms=(0.8,0.7))"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "x-uDGwk3THqE"
},
"source": [
"Can we do even better?"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 111
},
"colab_type": "code",
"collapsed": false,
"id": "4o6ydWNhbVxX",
"outputId": "798c8d0d-ae1a-4f39-d3e6-580a1c6b54ac"
},
"outputs": [
{
"data": {
"text/html": [
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: left;\">\n",
" <th>epoch</th>\n",
" <th>train_loss</th>\n",
" <th>valid_loss</th>\n",
" <th>accuracy</th>\n",
" <th>time</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>0</td>\n",
" <td>0.156188</td>\n",
" <td>0.191579</td>\n",
" <td>0.934211</td>\n",
" <td>00:12</td>\n",
" </tr>\n",
" <tr>\n",
" <td>1</td>\n",
" <td>0.141545</td>\n",
" <td>0.194849</td>\n",
" <td>0.932895</td>\n",
" <td>00:14</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {
"tags": []
},
"output_type": "display_data"
}
],
"source": [
"learn.unfreeze()\n",
"learn.fit_one_cycle(2, slice(1e-3/(2.6**4),1e-3), moms=(0.8,0.7))"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "J-TSQ7iDTdIG"
},
"source": [
"I'll take 93% accuracy! Let's give it an example ...."
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"colab_type": "code",
"collapsed": false,
"id": "mBAXEa2MbVxa",
"outputId": "4163f4ee-f9e0-4d93-b5a2-c47e38a78205"
},
"outputs": [
{
"data": {
"text/plain": [
"(Category True, tensor(1), tensor([0.3140, 0.6860]))"
]
},
"execution_count": 35,
"metadata": {
"tags": []
},
"output_type": "execute_result"
}
],
"source": [
"learn.predict(\"Four states have two universities represented in the top 20 highest-paid executives of public colleges. Texas has SIX\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "8u1ptJu1UmT9"
},
"source": [
"`True` means checkable! Let's save our work."
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"collapsed": true,
"id": "jykRlEjKU8jS"
},
"outputs": [],
"source": [
"# optional save, about 300 MB\n",
"learn.save('pretty_good_model')"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "XSOgwF1ybVyh"
},
"source": [
"## Preparing for Using Render\n",
"\n",
"We could stop here and use this model to guess thousands of saved, unchecked tweets. But I wanted to put this in the wild -- watching for new tweets and sending a Slack message when it spotted a fact-checkable tweet. For that, I hosted the predictor on a service called [Render](https://render.com).\n",
"\n",
"My Render code, [which is in this repository](https://github.com/jkeefe/nlp-classifier-fastai-render), needs access to the model and all of its details. So I exported it here, and saved it to a public spot on the internet. \n",
"\n",
"The next line (which is optional) will save everything we need for predictions to a ~90MB file to your Google Drive."
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"collapsed": true,
"id": "xxUtm6fMbVxZ"
},
"outputs": [],
"source": [
"## optional save as `export.pkl` - about 90 MB\n",
"learn.export()"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "57uA-44kVh_T"
},
"source": [
"For more about deploying a predictor on Render, see our [blog post about building the checkable-tweets project](https://qz.ai/?p=89)."
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"collapsed": true,
"id": "YsUk3Ypdw2FX"
},
"outputs": [],
"source": []
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"collapsed_sections": [],
"name": "quartz-fastai-checkable-tweets.ipynb",
"provenance": [],
"version": "0.3.2"
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
You can’t perform that action at this time.