Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
#!/bin/bash | |
set -eu | |
wget -nc https://github.com/rapidsai/notebooks-extended/raw/master/utils/env-check.py | |
echo "Checking for GPU type:" | |
python env-check.py | |
if [ ! -f Miniconda3-4.5.4-Linux-x86_64.sh ]; then | |
echo "Removing conflicting packages, will replace with RAPIDS compatible versions" |
This file contains hidden or 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
normalized_count_array = count_dary/np.sum(count_dary,axis=1)[:,None] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
## chunksize = 1.9 M, 10% of dataset | |
small_df = df.head(1_900_000).copy() | |
%time ouptput_df = preprocess_text_df(small_df,filter_regex=filters_regex) |
This file contains hidden or 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
## chunksize = 950K, 5% of dataset | |
small_df = df.head(950_000).copy(deep=True) | |
%time ouptput_df = preprocess_text_df(small_df,filter_regex=filters_regex) |
This file contains hidden or 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
## chunksize = 190k M, 1% of dataset | |
small_df = df.head(190_000).copy(deep=True) | |
%time ouptput_df = preprocess_text_df(small_df,filter_regex=filters_regex) | |
This file contains hidden or 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
author_id = author_name_ls.index('Charles Dickens') | |
for index in output_indices_umap[author_id]: | |
print(author_name_ls[int(index)]) |
This file contains hidden or 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
def preprocess_text(input_strs ,filter_regex,stop_words = nltk.corpus.stopwords.words('english')): | |
""" | |
* filter punctuation | |
* to_lower | |
* remove stop words (from nltk corpus) (taking the most time) | |
* remove multiple space with one | |
* remove leading and trailing spaces | |
""" | |
This file contains hidden or 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
author_id = author_name_ls.index('Charles Dickens') | |
for index in output_indices_umap[author_id]: | |
print(author_name_ls[int(index)]) | |