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
aaa | |
aarp | |
abb | |
abbott | |
abogado | |
ac | |
academy | |
accenture | |
accountant | |
accountants |
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
### Locating UI elements ### | |
# By ID | |
<div id="coolestWidgetEvah">...</div> | |
element = driver.find_element_by_id("coolestWidgetEvah") | |
or | |
from selenium.webdriver.common.by import By | |
element = driver.find_element(by=By.ID, value="coolestWidgetEvah") | |
# By class name: |
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
#!/usr/bin/env bash | |
# Reference : https://gist.github.com/ziadoz/3e8ab7e944d02fe872c3454d17af31a5#file-install-sh | |
# Versions (Update SELENIUM_STANDALONE_VERSION to the version of your choice) | |
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` | |
SELENIUM_STANDALONE_VERSION=3.13.0 | |
SELENIUM_SUBDIR=$(echo "$SELENIUM_STANDALONE_VERSION" | cut -d"." -f-2) | |
# Remove existing downloads and binaries so we can start from scratch. | |
sudo apt-get remove google-chrome-stable |
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 numpy as np | |
import tensorflow as tf | |
import matplotlib.pyplot as plt | |
def generate_dataset(): | |
x_batch = np.linspace(0, 2, 100) | |
y_batch = 1.5 * x_batch + np.random.randn(*x_batch.shape) * 0.2 + 0.5 | |
return x_batch, y_batch |
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
def linear_regression(): | |
x = tf.placeholder(tf.float32, shape=(None, ), name='x') | |
y = tf.placeholder(tf.float32, shape=(None, ), name='y') | |
with tf.variable_scope('lreg') as scope: | |
w = tf.Variable(np.random.normal(), name='W') | |
b = tf.Variable(np.random.normal(), name='b') | |
y_pred = tf.add(tf.multiply(w, x), b) |
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
def run(): | |
x_batch, y_batch = generate_dataset() | |
x, y, y_pred, loss = linear_regression() | |
optimizer = tf.train.GradientDescentOptimizer(0.1) | |
train_op = optimizer.minimize(loss) | |
with tf.Session() as session: | |
session.run(tf.global_variables_initializer()) | |
feed_dict = {x: x_batch, y: y_batch} |
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 numpy as np | |
import tensorflow as tf | |
import matplotlib.pyplot as plt | |
def generate_dataset(): | |
x_batch = np.linspace(0, 2, 100) | |
y_batch = 1.5 * x_batch + np.random.randn(*x_batch.shape) * 0.2 + 0.5 | |
return x_batch, y_batch | |
def linear_regression(): |
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
a = tf.constant([10, 20]) | |
b = tf.constant([1.0, 2.0]) | |
# 'fetches' can be a singleton | |
v = session.run(a) | |
# v is the numpy array [10, 20] | |
# 'fetches' can be a list. | |
v = session.run([a, b]) | |
# v is a Python list with 2 numpy arrays: the 1-D array [10, 20] and the | |
# 1-D array [1.0, 2.0] | |
# 'fetches' can be arbitrary lists, tuples, namedtuple, dicts: |
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
settings = { | |
'window_size': 2 # context window +- center word | |
'n': 10, # dimensions of word embeddings, also refer to size of hidden layer | |
'epochs': 50, # number of training epochs | |
'learning_rate': 0.01 # learning rate | |
} |
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
text = "natural language processing and machine learning is fun and exciting" | |
# Note the .lower() as upper and lowercase does not matter in our implementation | |
# [['natural', 'language', 'processing', 'and', 'machine', 'learning', 'is', 'fun', 'and', 'exciting']] | |
corpus = [[word.lower() for word in text.split()]] |
OlderNewer