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 java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
/** | |
OUTPUT: | |
+ Sum of 10000 double numbers | |
For the 1st shuffling, sum = 4999499.9999999935 | |
For the 2nd shuffling, sum = 4999499.999999965 | |
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
""" | |
Code to replicate Ron Kohavi's cross-validation experiment on the Iris data set. | |
""" | |
from sklearn import datasets, svm | |
from sklearn.cross_validation import cross_val_score, KFold, LeavePOut | |
import matplotlib.pyplot as plt | |
output_file = "cross-validation-experiment-iris.png" | |
iris = datasets.load_iris() |
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
from theano import tensor as T, function | |
x = T.dscalar('x') | |
y = x ** 2 | |
dy = T.grad(cost=y, wrt=x) # Preparing symbolic gradient | |
df = function(inputs=[x], outputs=dy) | |
print(df(4)) # Output: 8 |
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
# Implementation of a simple MLP network with one hidden layer. Tested on the iris data set. | |
# Requires: numpy, sklearn, theano | |
# NOTE: In order to make the code simple, we rewrite x * W_1 + b_1 = x' * W_1' | |
# where x' = [x | 1] and W_1' is the matrix W_1 appended with a new row with elements b_1's. | |
# Similarly, for h * W_2 + b_2 | |
import theano | |
from theano import tensor as T | |
import numpy as np | |
from sklearn import datasets |
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
""" | |
Vanilla Char-RNN using TensorFlow by Vinh Khuc (@knvinh). | |
Adapted from Karpathy's min-char-rnn.py | |
https://gist.github.com/karpathy/d4dee566867f8291f086 | |
Requires tensorflow>=1.0 | |
BSD License | |
""" | |
import random | |
import numpy as np | |
import tensorflow as tf |
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
# Implementation of a simple MLP network with one hidden layer. Tested on the iris data set. | |
# Requires: numpy, sklearn>=0.18.1, tensorflow>=1.0 | |
# NOTE: In order to make the code simple, we rewrite x * W_1 + b_1 = x' * W_1' | |
# where x' = [x | 1] and W_1' is the matrix W_1 appended with a new row with elements b_1's. | |
# Similarly, for h * W_2 + b_2 | |
import tensorflow as tf | |
import numpy as np | |
from sklearn import datasets | |
from sklearn.model_selection import train_test_split |
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
Question | Label | |
---|---|---|
How did serfdom develop in and then leave Russia ? | DESC:manner | |
What films featured the character Popeye Doyle ? | ENTY:cremat | |
How can I find a list of celebrities ' real names ? | DESC:manner | |
What fowl grabs the spotlight after the Chinese Year of the Monkey ? | ENTY:animal | |
What is the full form of .com ? | ABBR:exp | |
What contemptible scoundrel stole the cork from my lunch ? | HUM:ind | |
What team did baseball 's St. Louis Browns become ? | HUM:gr | |
What is the oldest profession ? | HUM:title | |
What are liver enzymes ? | DESC:def |
We can't make this file beautiful and searchable because it's too large.
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
0.0061718537 -0.0024363345 0.058415722 -0.019220708 -0.051817734 -0.042351343 -0.020908065 0.005183715 -0.013680814 -0.04262279 0.009524972 -0.02140069 0.023697063 0.043885317 0.034181613 -0.0083187 -0.06722789 0.013031735 0.007751275 -0.08180988 0.04614297 -0.06278132 -0.025033472 -0.043717187 -0.020316828 0.050261766 0.060791086 0.05705632 -0.012153195 0.03464042 -0.08152679 -0.058986522 0.0035639652 0.024647668 -0.059734866 0.015541221 -0.0065737423 0.020316336 -0.0148979565 -0.026047753 0.028355088 -0.026079465 -0.002358603 -0.0067062867 -0.009114266 0.0010216745 0.026439784 0.07460034 0.044666305 0.037209775 0.074898235 0.021767966 -0.052332643 -0.022787187 0.044321213 0.009379231 -0.026886253 0.034125276 -0.06483722 -0.01966572 -0.040497903 -0.0055085467 0.0017649964 0.021614494 -0.009420735 0.05497118 0.010820785 -0.01948987 -0.012267729 -0.010204952 -0.08628109 -0.083253555 -0.004771075 -0.021505628 0.083285354 0.026299926 0.057961594 0.02451058 0.023163367 0.018347874 -0.04912325 -0.03191776 -0.03019 |
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
{ | |
"embeddings": [ | |
{ | |
"tensorName": "QC Question Embeddings Using TF Sentence Embedding Encoder Large 3", | |
"tensorShape": [ | |
5451, | |
300 | |
], | |
"tensorPath": "https://gist.githubusercontent.com/vinhkhuc/3806dc8ef988d3c10ecfa6310de1943f/raw/738c1d07563612df2662a0aedc931a89cb64458b/qc-question-embeddings.tsv", | |
"metadataPath": "https://gist.githubusercontent.com/vinhkhuc/1f9fc9ad322c152ebe607e9bb5d7da55/raw/1518504769d8989f017caa171313991ae43f7e75/qc-embed-metadata.tsv" |
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
https://projector.tensorflow.org/?config=https://gist.githubusercontent.com/vinhkhuc/5ca429d4c38900d9eb24a8c245593c75/raw/2f9fe9fb9ae824d030ff7dd6eb941e6dfef6544a/qc-question-embeddings-projector-config.json |
OlderNewer