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
import subprocess, datetime, time | |
welcome = "Hello Siva, welcome" | |
s = '-s 140' | |
g = '-g 0.8' | |
f = '-vf3' | |
a = '-a 150' | |
day = datetime.date.today().strftime('%A') | |
month = datetime.date.today().strftime('%B') | |
date = datetime.date.today().strftime('%d') |
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
''' | |
Grabbing current tweets using python's tweepy module | |
''' | |
from tweepy import Stream | |
from tweepy import OAuthHandler | |
from tweepy.streaming import StreamListener | |
import logging | |
# get the twitter keys from https://dev.twitter.com/ | |
ckey = *** |
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
#!/bin/sh | |
SAVEIFS=$IFS | |
IFS=$(echo -en "\n\b") | |
SRC_PATH=path/to/source/folder | |
DST_PATH=path/to/destination/folder | |
for src_dir in $(ls $SRC_PATH) | |
do | |
for src_file in $(ls $SRC_PATH/$src_dir) | |
do | |
src_fpath=$SRC_PATH/$src_dir/$src_file |
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
import pandas as pd | |
import matplotlib.pyplot as plt | |
from sklearn.datasets import load_digits | |
from sklearn.model_selection import train_test_split | |
%matplotlib inline | |
dig = load_digits() | |
plt.gray() | |
plt.matshow(dig.images[25]) |
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
import pandas as pd | |
from keras.layers import Dense | |
from keras.models import Sequential | |
from keras.optimizers import RMSprop, Adadelta, Adam | |
from sklearn.datasets import load_digits | |
from sklearn.model_selection import train_test_split | |
dig = load_digits() | |
onehot_target = pd.get_dummies(dig.target) | |
x_train, x_val, y_train, y_val = train_test_split(dig.data, onehot_target, test_size=0.1, random_state=20) |
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
import pandas as pd | |
import numpy as np | |
from sklearn.datasets import load_digits | |
from sklearn.model_selection import train_test_split | |
dig = load_digits() | |
onehot_target = pd.get_dummies(dig.target) | |
x_train, x_val, y_train, y_val = train_test_split(dig.data, onehot_target, test_size=0.1, random_state=20) | |
def sigmoid(s): |
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 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 string | |
puncts = string.punctuation.replace('.','') | |
punct = str.maketrans('','', puncts) | |
data = open('story.txt','r').read() | |
# data pre-processing only for alphabet strings | |
def clean(xx): | |
return ' '.join(x for x in xx.split() if not x.isnumeric()) |
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
import collections | |
import pandas as pd | |
import numpy as np | |
sents = [s for s in cdata.split()] | |
vocab = sorted(collections.Counter(sents)) | |
vocab2idx = {v:idx for idx,v in enumerate(vocab)} | |
idx2vocab = {idx:v for idx,v in enumerate(vocab)} |
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
class Discriminator(nn.Module): | |
def __init__(self): | |
super().__init__() | |
ip_emb = 784 | |
emb1 = 256 | |
emb2 = 128 | |
out_emb = 1 | |
self.layer1 = nn.Sequential( |
OlderNewer