Total instances: 150783 E.g.
# PAPER AUTHOR NO_OF_OCCURENCENS
[((u'08D53976', u'4288B19F'), 2),
((u'04659D00', u'3E8E4B9F'), 2),
((u'0770BD71', u'41DFB1F8'), 2),
#List unique values in a DataFrame column | |
pd.unique(df.column_name.ravel()) | |
#Convert Series datatype to numeric, getting rid of any non-numeric values | |
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True) | |
#Grab DataFrame rows where column has certain values | |
valuelist = ['value1', 'value2', 'value3'] | |
df = df[df.column.isin(value_list)] |
import numpy as np | |
import tensorflow as tf | |
# Define the data | |
X = np.random.randn(100, 2).astype(np.float32) | |
W_true = np.array([[2, 1]]).T.astype(np.float32) | |
y_true = X.dot(W_true) + 1.5 | |
print X.shape, W_true.shape, y_true.shape, W_true | |
tf.python.framework.ops.reset_default_graph() # REST THE GRAPH |
# Solve sock problem in python using solution provided by http://www.sumsar.net/blog/2014/10/tiny-data-and-the-socks-of-karl-broman/ | |
## Youtube video by the author explaining the problem: https://www.youtube.com/watch?v=nKCT-Cdk0xY | |
import numpy as np | |
import pandas as pd | |
n_socks = 18 | |
n_picks = 11 | |
n_pairs = 7 | |
n_odd = n_socks - 2*n_pairs |
Data collected from Google Big Query:
SELECT id, title, story_score, publish_year, title_rank, FORMAT_UTC_USEC(time_ts) as publish_time
FROM
(
SELECT title, max(score) as story_score, Year(time_ts) as publish_year, time_ts, id, RANK() OVER(PARTITION BY publish_year ORDER BY story_score DESC) as title_rank
FROM [fh-bigquery:hackernews.stories] WHERE title IS NOT NULL and time_ts is not NULL
GROUP BY publish_year, title, time_ts, id
# "Colorizing B/W Movies with Neural Nets", | |
# Network/Code Created by Ryan Dahl, hacked by samim.io to work with movies | |
# BACKGROUND: http://tinyclouds.org/colorize/ | |
# DEMO: https://www.youtube.com/watch?v=_MJU8VK2PI4 | |
# USAGE: | |
# 1. Download TensorFlow model from: http://tinyclouds.org/colorize/ | |
# 2. Use FFMPEG or such to extract frames from video. | |
# 3. Make sure your images are 224x224 pixels dimension. You can use imagemagicks "mogrify", here some useful commands: | |
# mogrify -resize 224x224 *.jpg | |
# mogrify -gravity center -background black -extent 224x224 *.jpg |
import numpy as np | |
trans_mat = np.array([[0.6, 0.4], [0.4, 0.6]]) # Define transition matrix | |
init_state = np.array([200, 0]) # Define initial state | |
n_iters = 10 # Define number of iterations | |
next_state = init_state | |
for i in xrange(n_iters): | |
next_state = next_state.dot(trans_mat) | |
print next_state |
('----- diversity:', 0.2) | |
----- Generating with seed: " cane | |
the train's wh" | |
cane | |
the train's wh bcattat saobnahhsaaelmemm t ealaeeteueuiirrrrethu uriibiboboo tat stttalalllaer tmettummm p ooor rthhuie rrres aa | |
('----- diversity:', 0.5) | |
----- Generating with seed: " cane | |
the train's wh" | |
cane |