Skip to content

Instantly share code, notes, and snippets.

View suriyadeepan's full-sized avatar
❤️
Rediscovering the joy of solving problems and building applications

Suriyadeepan Ramamoorthy suriyadeepan

❤️
Rediscovering the joy of solving problems and building applications
View GitHub Profile
@suriyadeepan
suriyadeepan / autobrowse.py
Last active July 28, 2020 07:07
Autonomous surfer for chrome
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
browser=webdriver.Chrome()
#first tab
browser.execute_script("window.open('about:blank', 'tab1');")
browser.switch_to_window("tab1")
{'b': {'args': (),
'fn': Normal(loc: 0.0, scale: 1.0),
'name': 'b',
'type': 'sample',
'value': tensor(-1.1897, grad_fn=<AddBackward0>)},
'b_loc': {'args': (tensor(0.), Real()),
'fn': <function param.<locals>.fn at 0x127388950>,
'name': 'b_loc',
'type': 'param',
'value': tensor(0., requires_grad=True)},
@suriyadeepan
suriyadeepan / ipython3_mac_install.sh
Last active May 7, 2019 14:12 — forked from rossov/ipython3_mavericks.sh
Install ipython3 on Mac OS X Mavericks
# Install ipython3 on Mac OS
# check if brew exists
brew
# install brew if necessary
# follow instructions in
# https://brew.sh/
# Update brew
brew update
def factorial(n):
if n == 0:
return 1
return factorial(n - 1) * n
def factorial_cps(k, n):
if n == 0:
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python

Document Title

First sentence of document.

To create a line blank add a
and you will receive a line break!

underscore creates italics asterisks for bold

@suriyadeepan
suriyadeepan / 87_python_questions.txt
Last active October 15, 2018 05:26
90 Python Questions
[0]
Question:
With a given tuple (1,2,3,4,5,6,7,8,9,10), write a program to print the first half values in one line and the last half values in one line.
Hints:
Use [n1:n2] notation to get a slice from a tuple.
[1]
@suriyadeepan
suriyadeepan / logistic_regression.py
Created May 13, 2018 08:40
Multi-label classification
import tensorflow as tf
import numpy as np
class LogisticRegressor(object):
def __init__(self, num_attrs, num_labels, threshold=0.8, lr=0.01):
self.attrs = tf.placeholder(tf.float32, [None, num_attrs], name='attrs')
self.labels= tf.placeholder(tf.int32, [None, num_labels], name='labels')
@suriyadeepan
suriyadeepan / net.py
Last active May 8, 2018 16:14
Sentiment Classification on Movie Reviews
import tensorflow as tf
import numpy as np
DropoutWrapper = tf.nn.rnn_cell.DropoutWrapper
class SentimentNetwork(object):
def __init__(self, hdim=25, wdim=25, pdim=25, vocab_size=2000, pos_vocab_size=30,
@suriyadeepan
suriyadeepan / char_embed.py
Created April 7, 2018 05:29
Character Embedding with 1D convolutions
def apply_filter(x, filter_size, emb_dim, max_word_len):
"""
Run convolution operation on x with "filter_size"d filter
Args:
x : sequence to which conv should be applied
filter_size : size of filter
emb_dim : embedding dimensions
max_word_len : maximum length of a word
Returns:
Output of 1D convolution