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
| import time | |
| import pickle | |
| import multiprocessing as mp | |
| from multiprocessing import Manager | |
| def my_worker(result): | |
| name = mp.current_process().name | |
| print(name, 'Starting') | |
| result.append(name+' Starting') | |
| time.sleep(1) |
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
| class Classifier(nn.Module): | |
| def __init__(self): | |
| super(Classifier, self).__init__() | |
| self.NeurlNet = nn.Sequential( | |
| nn.Linear(50, 40), | |
| nn.ReLU(), | |
| nn.Linear(40, 30), | |
| nn.ReLU(), | |
| nn.Linear(30, 1) | |
| ) |
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
| cv = CountVectorizer() | |
| X_train = cv.fit_transform(d_train.content_cleansing) | |
| X_test = cv.transform(d_test.content_cleansing) |
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 cleansing(text): | |
| word_list = word_tokenize(text) | |
| word_list = [word for word in word_list if len(word) > 2 and word.isalnum()] | |
| word_list = [word for word in word_list if string.punctuation not in word] | |
| text = ' '.join(word_list) | |
| return text |
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
| data_path = 'data' | |
| files = glob.glob(data_path + '/*') | |
| train = pickle.load(open(files[1], 'rb')) | |
| test = pickle.load(open(files[0], 'rb')) | |
| d_train = pd.DataFrame(data={'content': train[0], 'label': train[1]}) | |
| d_test = pd.DataFrame(data={'content': test[0], 'label': test[1]}) |
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
| import pandas as pd | |
| import numpy as np | |
| import glob | |
| import re | |
| import pickle | |
| import seaborn as sns | |
| import string | |
| from nltk.tokenize import word_tokenize |
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
| for x in test train; do | |
| echo $x | |
| done |
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
| if [ $1 -le 10 ]; then | |
| echo "less than" | |
| echo "$0" | |
| else | |
| echo "Too large $1" | |
| fi |
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
| ## Arithmetic Operators | |
| ## Addition | |
| $x + $y | |
| ## Subtraction | |
| $x - $y | |
| ## Multiplication | |
| $x * $y |
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
| city="Jakarta" | |
| echo $city |