Learn practical skills, build real-world projects, and advance your career
#my imports
import numpy as np
import unicodedata
import nltk
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from nltk.tokenize import sent_tokenize
import string
from nltk import pos_tag
import pandas as pd
from nltk import pos_tag
from sklearn.feature_extraction.text import TfidfVectorizer
pd.set_option('display.max_colwidth', -1)
from sklearn.feature_selection import chi2
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.naive_bayes import MultinomialNB
from sklearn.metrics import accuracy_score, confusion_matrix
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_classification
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.metrics import f1_score
from sklearn.metrics import recall_score
import matplotlib.pyplot as plt
from sklearn.metrics import precision_score
nltk.download('punkt')
nltk.download('stopwords')
nltk.download('averaged_perceptron_tagger')
import random
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:13: FutureWarning: Passing a negative integer is deprecated in version 1.0 and will not be supported in future version. Instead, use None to not limit the column width. del sys.path[0]
[nltk_data] Downloading package punkt to /root/nltk_data... [nltk_data] Unzipping tokenizers/punkt.zip. [nltk_data] Downloading package stopwords to /root/nltk_data... [nltk_data] Unzipping corpora/stopwords.zip. [nltk_data] Downloading package averaged_perceptron_tagger to [nltk_data] /root/nltk_data... [nltk_data] Unzipping taggers/averaged_perceptron_tagger.zip.
from google.colab import drive
drive.mount('/content/drive')
Mounted at /content/drive

GPT-2

high_pizza_link = "/content/n_high_pizza_positive.txt"
GPT-Install
%tensorflow_version 1.x
!pip install -q gpt-2-simple
import gpt_2_simple as gpt2
from datetime import datetime
from google.colab import files

gpt2.download_gpt2(model_name="355M")

gpt2.mount_gdrive()
Fetching checkpoint: 1.05Mit [00:00, 395Mit/s] Fetching encoder.json: 1.05Mit [00:00, 130Mit/s] Fetching hparams.json: 1.05Mit [00:00, 591Mit/s] Fetching model.ckpt.data-00000-of-00001: 1.42Git [00:05, 250Mit/s] Fetching model.ckpt.index: 1.05Mit [00:00, 330Mit/s] Fetching model.ckpt.meta: 1.05Mit [00:00, 128Mit/s] Fetching vocab.bpe: 1.05Mit [00:00, 197Mit/s]
Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount("/content/drive", force_remount=True).