Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

Import Libraries
In [130]:

import tweepy
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from textblob import TextBlob
from tweepy import API
from tweepy import Cursor
from tweepy import OAuthHandler
import json
import datetime
import re
import seaborn as sns
import nltk
import warnings
warnings.filterwarnings('always') # "error", "ignore", "always", "default", "module" or "o

Store API Keys


In [131]:

df = pd.read_csv('API_SET1.csv')

In [132]:

TwitterApiKey=df["Twitter_Api_Key"][0]
TwitterApiSecret=df["Twitter_Api_Secret_Key"][0]
TwitterApiAccessToken=df["Twitter_Api_access_token"][0]
TwitterApiSecretToken=df["Twitter_Api_secret_access_token"][0]

In [133]:

auth=tweepy.OAuthHandler(TwitterApiKey,TwitterApiSecret)
auth.set_access_token(TwitterApiAccessToken,TwitterApiSecretToken)
twitterApi=tweepy.API(auth,wait_on_rate_limit=True)

C:\Users\aadit\anaconda3\lib\site-packages\tweepy\auth.py:120: DeprecationWa
rning: OAuthHandler is deprecated; use OAuth1UserHandler instead.

warnings.warn(

Selection of Twitter Account


In [134]:

twitterAccount = "@CobraTateKING"

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 1/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [135]:

tweets=tweepy.Cursor(twitterApi.user_timeline,
screen_name=twitterAccount,
count=None,
since_id=None,
max_id=None,trim_user=True,exclude_replies=True,contributor_details=Fal
include_entities=False).items(50);

Converted Tweets into DataFrame


In [136]:

df=pd.DataFrame(data=[tweet.text for tweet in tweets],columns=["Tweets"])

Unexpected parameter: contributor_details

Unexpected parameter: include_entities

Unexpected parameter: contributor_details

Unexpected parameter: include_entities

Unexpected parameter: contributor_details

Unexpected parameter: include_entities

Unexpected parameter: contributor_details

Unexpected parameter: include_entities

In [137]:

df.head(10)

Out[137]:

Tweets

0 Life’s simple. You make choices and you don’t ...

1 Life is Beautiful outside the Matrix.\n\nhttps...

2 Brotherhood is our most precious possession. h...

3 As soon as you are granted life,\n\nYou are gu...

4 Rules are for the Poor. https://t.co/Ln50iVJL7Z

5 Put yourself on as many grids as possible. htt...

6 Seeds of doubt grow into forests of inaction. ...

7 RT @Talismanthetate: Best idea. https://t.co/O...

8 A man without a vision for his future always r...

9 I only know how to win. \n\nI’ve never tried l...

Text Cleaning

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 2/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [138]:

def cleanupTweet(txt):
txt = re.sub(r'@[A-Za-z0-9_]+','',txt)
txt = re.sub(r'#','',txt)
txt = re.sub(r'RT :','',txt)
txt = re.sub(r'https?:\/\/[A-Za-z0-9\.\/]+','',txt)
return txt

In [139]:

df.head(10)

Out[139]:

Tweets

0 Life’s simple. You make choices and you don’t ...

1 Life is Beautiful outside the Matrix.\n\nhttps...

2 Brotherhood is our most precious possession. h...

3 As soon as you are granted life,\n\nYou are gu...

4 Rules are for the Poor. https://t.co/Ln50iVJL7Z

5 Put yourself on as many grids as possible. htt...

6 Seeds of doubt grow into forests of inaction. ...

7 RT @Talismanthetate: Best idea. https://t.co/O...

8 A man without a vision for his future always r...

9 I only know how to win. \n\nI’ve never tried l...

In [140]:

df['Tweet'] = df['Tweets'].apply(cleanupTweet)

In [141]:

df.head()

Out[141]:

Tweets Tweet

0 Life’s simple. You make choices and you don’t ... Life’s simple. You make choices and you don’t ...

1 Life is Beautiful outside the Matrix.\n\nhttps... Life is Beautiful outside the Matrix.\n\n

2 Brotherhood is our most precious possession. h... Brotherhood is our most precious possession.

3 As soon as you are granted life,\n\nYou are gu... As soon as you are granted life,\n\nYou are gu...

4 Rules are for the Poor. https://t.co/Ln50iVJL7Z Rules are for the Poor.

Text Subjectivity

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 3/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [142]:

def getTextSubjectivity(txt):
return TextBlob(txt).sentiment.subjectivity

Text Polarity
In [143]:

def getTextPolarity(txt):
return TextBlob(txt).sentiment.polarity

Cleaned Tweets
In [144]:

df['Subjectivity'] = df['Tweets'].apply(getTextSubjectivity)

In [145]:

df['Polarity'] = df['Tweets'].apply(getTextPolarity)

In [146]:

df.head()

Out[146]:

Tweets Tweet Subjectivity Polarity

Life’s simple. You make choices and Life’s simple. You make choices and
0 0.178571 0.000
you don’t ... you don’t ...

Life is Beautiful outside the Life is Beautiful outside the


1 0.525000 0.425
Matrix.\n\nhttps... Matrix.\n\n

Brotherhood is our most precious Brotherhood is our most precious


2 0.750000 0.500
possession. h... possession.

As soon as you are granted life,\n\nYou As soon as you are granted


3 0.000000 0.000
are gu... life,\n\nYou are gu...

Rules are for the Poor.


4 Rules are for the Poor. 0.600000 -0.400
https://t.co/Ln50iVJL7Z

Sentiment Intensity Analyzer


In [147]:

from nltk.sentiment.vader import SentimentIntensityAnalyzer


sid = SentimentIntensityAnalyzer()

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 4/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [148]:

df['Polarity'] = df['Tweet'].apply(lambda Tweet: sid.polarity_scores(Tweet))


df.head()

Out[148]:

Tweets Tweet Subjectivity Polarity

Life’s simple. You make Life’s simple. You make {'neg': 0.0, 'neu': 1.0,
0 0.178571
choices and you don’t ... choices and you don’t ... 'pos': 0.0, 'compound...

Life is Beautiful outside the Life is Beautiful outside the {'neg': 0.0, 'neu': 0.562,
1 0.525000
Matrix.\n\nhttps... Matrix.\n\n 'pos': 0.438, 'comp...

Brotherhood is our most Brotherhood is our most {'neg': 0.0, 'neu': 0.556,
2 0.750000
precious possession. h... precious possession. 'pos': 0.444, 'comp...

{'neg': 0.144, 'neu':


As soon as you are granted As soon as you are granted
3 0.000000 0.704, 'pos': 0.152,
life,\n\nYou are gu... life,\n\nYou are gu...
'co...

{'neg': 0.437, 'neu':


Rules are for the Poor.
4 Rules are for the Poor. 0.600000 0.563, 'pos': 0.0,
https://t.co/Ln50iVJL7Z
'comp...

In [149]:

df['Compound'] = df['Polarity'].apply(lambda score_dict: score_dict['compound'])


df.head()

Out[149]:

Tweets Tweet Subjectivity Polarity Compound

{'neg': 0.0, 'neu':


Life’s simple. You make Life’s simple. You make
0 0.178571 1.0, 'pos': 0.0, 0.0000
choices and you don’t ... choices and you don’t ...
'compound...

{'neg': 0.0, 'neu':


Life is Beautiful outside the Life is Beautiful outside
1 0.525000 0.562, 'pos': 0.438, 0.5994
Matrix.\n\nhttps... the Matrix.\n\n
'comp...

{'neg': 0.0, 'neu':


Brotherhood is our most Brotherhood is our most
2 0.750000 0.556, 'pos': 0.444, 0.6115
precious possession. h... precious possession.
'comp...

As soon as you are As soon as you are {'neg': 0.144, 'neu':


3 granted life,\n\nYou are granted life,\n\nYou are 0.000000 0.704, 'pos': 0.152, -0.2023
gu... gu... 'co...

{'neg': 0.437, 'neu':


Rules are for the Poor.
4 Rules are for the Poor. 0.600000 0.563, 'pos': 0.0, -0.4767
https://t.co/Ln50iVJL7Z
'comp...

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 5/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [150]:

df['comp_score'] = df['Compound'].apply(lambda c: 'pos' if c>=0 else 'neg')


df.head()

Out[150]:

Tweets Tweet Subjectivity Polarity Compound comp_score

Life’s simple. {'neg': 0.0,


Life’s simple. You make
You make 'neu': 1.0,
0 choices and you don’t 0.178571 0.0000 pos
choices and you 'pos': 0.0,
...
don’t ... 'compound...

{'neg': 0.0,
Life is Beautiful
Life is Beautiful outside 'neu': 0.562,
1 outside the 0.525000 0.5994 pos
the Matrix.\n\nhttps... 'pos': 0.438,
Matrix.\n\n
'comp...

Brotherhood is {'neg': 0.0,


Brotherhood is our
our most 'neu': 0.556,
2 most precious 0.750000 0.6115 pos
precious 'pos': 0.444,
possession. h...
possession. 'comp...

As soon as you {'neg': 0.144,


As soon as you are
are granted 'neu': 0.704,
3 granted life,\n\nYou are 0.000000 -0.2023 neg
life,\n\nYou are 'pos': 0.152,
gu...
gu... 'co...

{'neg': 0.437,
Rules are for the Poor. Rules are for the 'neu': 0.563,
4 0.600000 -0.4767 neg
https://t.co/Ln50iVJL7Z Poor. 'pos': 0.0,
'comp...

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 6/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [151]:

df['neg_score'] = df['Polarity'].apply(lambda score_dict: score_dict['neg'])


df.head()

Out[151]:

Tweets Tweet Subjectivity Polarity Compound comp_score neg_sc

Life’s
{'neg': 0.0,
Life’s simple. You simple. You
'neu': 1.0,
0 make choices and you make 0.178571 0.0000 pos 0
'pos': 0.0,
don’t ... choices and
'compound...
you don’t ...

Life is {'neg': 0.0,


Life is Beautiful
Beautiful 'neu': 0.562,
1 outside the 0.525000 0.5994 pos 0
outside the 'pos': 0.438,
Matrix.\n\nhttps...
Matrix.\n\n 'comp...

Brotherhood {'neg': 0.0,


Brotherhood is our
is our most 'neu': 0.556,
2 most precious 0.750000 0.6115 pos 0
precious 'pos': 0.444,
possession. h...
possession. 'comp...

As soon as
{'neg': 0.144,
As soon as you are you are
'neu': 0.704,
3 granted life,\n\nYou granted 0.000000 -0.2023 neg 0
'pos': 0.152,
are gu... life,\n\nYou
'co...
are gu...

{'neg': 0.437,
Rules are for the Poor. Rules are 'neu': 0.563,
4 0.600000 -0.4767 neg 0
https://t.co/Ln50iVJL7Z for the Poor. 'pos': 0.0,
'comp...

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 7/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [152]:

df['pos_score'] = df['Polarity'].apply(lambda score_dict: score_dict['pos'])


df.head()

Out[152]:

Tweets Tweet Subjectivity Polarity Compound comp_score neg_sc

Life’s
{'neg': 0.0,
Life’s simple. You simple. You
'neu': 1.0,
0 make choices and you make 0.178571 0.0000 pos 0
'pos': 0.0,
don’t ... choices and
'compound...
you don’t ...

Life is {'neg': 0.0,


Life is Beautiful
Beautiful 'neu': 0.562,
1 outside the 0.525000 0.5994 pos 0
outside the 'pos': 0.438,
Matrix.\n\nhttps...
Matrix.\n\n 'comp...

Brotherhood {'neg': 0.0,


Brotherhood is our
is our most 'neu': 0.556,
2 most precious 0.750000 0.6115 pos 0
precious 'pos': 0.444,
possession. h...
possession. 'comp...

As soon as
{'neg': 0.144,
As soon as you are you are
'neu': 0.704,
3 granted life,\n\nYou granted 0.000000 -0.2023 neg 0
'pos': 0.152,
are gu... life,\n\nYou
'co...
are gu...

{'neg': 0.437,
Rules are for the Poor. Rules are 'neu': 0.563,
4 0.600000 -0.4767 neg 0
https://t.co/Ln50iVJL7Z for the Poor. 'pos': 0.0,
'comp...

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 8/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [153]:

df['neu_score'] = df['Polarity'].apply(lambda score_dict: score_dict['neu'])


df.head()

Out[153]:

Tweets Tweet Subjectivity Polarity Compound comp_score neg_sc

Life’s
{'neg': 0.0,
Life’s simple. You simple. You
'neu': 1.0,
0 make choices and you make 0.178571 0.0000 pos 0
'pos': 0.0,
don’t ... choices and
'compound...
you don’t ...

Life is {'neg': 0.0,


Life is Beautiful
Beautiful 'neu': 0.562,
1 outside the 0.525000 0.5994 pos 0
outside the 'pos': 0.438,
Matrix.\n\nhttps...
Matrix.\n\n 'comp...

Brotherhood {'neg': 0.0,


Brotherhood is our
is our most 'neu': 0.556,
2 most precious 0.750000 0.6115 pos 0
precious 'pos': 0.444,
possession. h...
possession. 'comp...

As soon as
{'neg': 0.144,
As soon as you are you are
'neu': 0.704,
3 granted life,\n\nYou granted 0.000000 -0.2023 neg 0
'pos': 0.152,
are gu... life,\n\nYou
'co...
are gu...

{'neg': 0.437,
Rules are for the Poor. Rules are 'neu': 0.563,
4 0.600000 -0.4767 neg 0
https://t.co/Ln50iVJL7Z for the Poor. 'pos': 0.0,
'comp...

In [154]:

df.isnull().sum()

Out[154]:

Tweets 0

Tweet 0

Subjectivity 0

Polarity 0

Compound 0

comp_score 0

neg_score 0

pos_score 0

neu_score 0

dtype: int64

Correlation

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 9/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [155]:

sns.set(rc={'figure.figsize':(10,7)})
sns.heatmap(df.corr(),annot=True,cmap='cubehelix')

Out[155]:

<AxesSubplot:>

In [156]:

df.corr()

Out[156]:

Subjectivity Compound neg_score pos_score neu_score

Subjectivity 1.000000 0.233755 0.061993 0.342418 -0.375491

Compound 0.233755 1.000000 -0.713335 0.740878 -0.212714

neg_score 0.061993 -0.713335 1.000000 -0.321067 -0.397334

pos_score 0.342418 0.740878 -0.321067 1.000000 -0.741516

neu_score -0.375491 -0.212714 -0.397334 -0.741516 1.000000

Visualization
localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 10/20
10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

Compound score
In [157]:

sns.set(rc={'figure.figsize':(10,7)})
sns.set_style('whitegrid')
sns.countplot(x='comp_score',data=df,palette='viridis')

Out[157]:

<AxesSubplot:xlabel='comp_score', ylabel='count'>

Compound value
In [158]:

sns.set(rc={'figure.figsize':(20,10)})
sns.set_style('whitegrid')
sns.countplot(x='Compound',data=df,palette='viridis')

Out[158]:

<AxesSubplot:xlabel='Compound', ylabel='count'>

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 11/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

Negative score
In [159]:

sns.set(rc={'figure.figsize':(12,7)})
sns.set_style('whitegrid')
sns.countplot(x='neg_score',data=df,palette='viridis')

Out[159]:

<AxesSubplot:xlabel='neg_score', ylabel='count'>

Positive score
In [160]:

sns.set(rc={'figure.figsize':(15,8)})
sns.set_style('whitegrid')
sns.countplot(x='pos_score',data=df,palette='viridis')

Out[160]:

<AxesSubplot:xlabel='pos_score', ylabel='count'>

Neutral score
localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 12/20
10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [161]:

sns.set(rc={'figure.figsize':(25,10)})
sns.set_style('whitegrid')
sns.countplot(x='neu_score',data=df,palette='viridis')

Out[161]:

<AxesSubplot:xlabel='neu_score', ylabel='count'>

Subjectivity score
In [162]:

sns.set(rc={'figure.figsize':(50,18)})
sns.set_style('whitegrid')
sns.countplot(x='Subjectivity',data=df,palette='Paired')

Out[162]:

<AxesSubplot:xlabel='Subjectivity', ylabel='count'>

Negative score and Compound score

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 13/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [163]:

sns.set(rc={'figure.figsize':(14,7)})
sns.set_style('whitegrid')
sns.countplot(x='neg_score',hue='comp_score',data=df,palette='Paired_r')

Out[163]:

<AxesSubplot:xlabel='neg_score', ylabel='count'>

Positive score and Compound score

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 14/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [164]:

sns.set(rc={'figure.figsize':(20,10)})
sns.set_style('whitegrid')
sns.countplot(x='pos_score',hue='comp_score',data=df,palette='Paired')

Out[164]:

<AxesSubplot:xlabel='pos_score', ylabel='count'>

Neutral score and Compound score


In [165]:

sns.set(rc={'figure.figsize':(30,15)})
sns.set_style('whitegrid')
sns.countplot(x='neu_score',hue='comp_score',data=df,palette='Paired_r')

Out[165]:

<AxesSubplot:xlabel='neu_score', ylabel='count'>

Subjectivity score and Compound score

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 15/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [166]:

sns.set(rc={'figure.figsize':(50,20)})
sns.set_style('whitegrid')
sns.countplot(x='Subjectivity',hue='comp_score',data=df,palette='Paired')

Out[166]:

<AxesSubplot:xlabel='Subjectivity', ylabel='count'>

Positive score and Negative score


In [167]:

sns.set(rc={'figure.figsize':(14,7)})
sns.set_style('whitegrid')
sns.lineplot( x='pos_score',
y='neg_score',
data=df,color='blue')

Out[167]:

<AxesSubplot:xlabel='pos_score', ylabel='neg_score'>

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 16/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [168]:

df.head()

Out[168]:

Tweets Tweet Subjectivity Polarity Compound comp_score neg_sc

Life’s
{'neg': 0.0,
Life’s simple. You simple. You
'neu': 1.0,
0 make choices and you make 0.178571 0.0000 pos 0
'pos': 0.0,
don’t ... choices and
'compound...
you don’t ...

Life is {'neg': 0.0,


Life is Beautiful
Beautiful 'neu': 0.562,
1 outside the 0.525000 0.5994 pos 0
outside the 'pos': 0.438,
Matrix.\n\nhttps...
Matrix.\n\n 'comp...

Brotherhood {'neg': 0.0,


Brotherhood is our
is our most 'neu': 0.556,
2 most precious 0.750000 0.6115 pos 0
precious 'pos': 0.444,
possession. h...
possession. 'comp...

As soon as
{'neg': 0.144,
As soon as you are you are
'neu': 0.704,
3 granted life,\n\nYou granted 0.000000 -0.2023 neg 0
'pos': 0.152,
are gu... life,\n\nYou
'co...
are gu...

{'neg': 0.437,
Rules are for the Poor. Rules are 'neu': 0.563,
4 0.600000 -0.4767 neg 0
https://t.co/Ln50iVJL7Z for the Poor. 'pos': 0.0,
'comp...

Machine Learning
In [169]:

X = df['Tweet']
y = df['comp_score']

In [170]:

from sklearn.model_selection import train_test_split

In [171]:

X_train,X_test,y_train,y_test = train_test_split(X,y,test_size=0.30,random_state=100)

CountVectorizer

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 17/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [172]:

from sklearn.feature_extraction.text import CountVectorizer


count_vect = CountVectorizer()
X_train_counts = count_vect.fit_transform(X_train)
X_train_counts

Out[172]:

<35x230 sparse matrix of type '<class 'numpy.int64'>'

with 373 stored elements in Compressed Sparse Row format>

(Documents,Features)
In [173]:

X_train_counts.shape

Out[173]:

(35, 230)

In [174]:

count_vect.get_feature_names()

Out[174]:

['about',

'act',

'activities',

'activity',

'aft',

'air',

'also',

'always',

'am',

'amazed',

'an',

'and',

'andrew',

'anything',

'are',

'as',

'at',

'average',

Transform Counts to Frequencies with Tf-IDF

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 18/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [175]:

from sklearn.feature_extraction.text import TfidfTransformer


tfidf_transformer = TfidfTransformer()
X_train_tfidf = tfidf_transformer.fit_transform(X_train_counts)
X_train_tfidf.shape

Out[175]:

(35, 230)

Tf-IDF Vectorizer
In [176]:

from sklearn.feature_extraction.text import TfidfVectorizer


vectorizer = TfidfVectorizer()
X_train_tfidf = vectorizer.fit_transform(X_train)
X_train_tfidf.shape

Out[176]:

(35, 230)

Training a Classifier
In [177]:

from sklearn.svm import LinearSVC


clf = LinearSVC()
clf.fit(X_train_tfidf,y_train)

Out[177]:

LinearSVC()

Pipeline
In [178]:

from sklearn.pipeline import Pipeline


text_clf = Pipeline([('tdidf',TfidfVectorizer()),('clf',LinearSVC()),])
text_clf.fit(X_train,y_train)

Out[178]:

Pipeline(steps=[('tdidf', TfidfVectorizer()), ('clf', LinearSVC())])

Results

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 19/20


10/18/22, 7:00 AM Andrew Tate Twitter Account NLP - Jupyter Notebook

In [179]:

predictions = text_clf.predict(X_test)

In [180]:

from sklearn import metrics

In [181]:

print(metrics.confusion_matrix(y_test,predictions))

[[0 6]

[0 9]]

Accuracy 75%
In [182]:

metrics.f1_score(y_test, predictions, average='weighted', labels=np.unique(predictions))

Out[182]:

0.7499999999999999

In [183]:

print(metrics.classification_report(y_test,predictions,zero_division=1))

precision recall f1-score support

neg 1.00 0.00 0.00 6

pos 0.60 1.00 0.75 9

accuracy 0.60 15

macro avg 0.80 0.50 0.37 15

weighted avg 0.76 0.60 0.45 15

In [ ]:

localhost:8888/notebooks/Andrew Tate Twitter Account NLP.ipynb 20/20

You might also like