Last active
August 4, 2020 21:13
-
-
Save VibhuJawa/f894c8e717bfca56ef9d05ee11572b60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"(4827372, 22)" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"df = join_df('tweets/')\n", | |
"tweets = Series(df['text'])\n", | |
"df.shape " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"CPU times: user 2.84 s, sys: 736 ms, total: 3.58 s\n", | |
"Wall time: 3.81 s\n" | |
] | |
} | |
], | |
"source": [ | |
"vec = cumlHashingVectorizer(stop_words='english')\n", | |
"%time X = vec.fit_transform(tweets)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"CPU times: user 1min 17s, sys: 902 ms, total: 1min 18s\n", | |
"Wall time: 1min 18s\n" | |
] | |
} | |
], | |
"source": [ | |
"tweets_pd = tweets.to_pandas()\n", | |
"vec = skHashingVectorizer(stop_words='english')\n", | |
"%time X = vec.fit_transform(tweets_pd)" | |
] | |
} | |
], | |
"metadata": { | |
"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.7.7" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment