- Knowledge Bases (KBs) are effective tools for Question Answering (QA) but are often too restrictive (due to fixed schema) and too sparse (due to limitations of Information Extraction (IE) systems).
- The paper proposes Key-Value Memory Networks, a neural network architecture based on Memory Networks that can leverage both KBs and raw data for QA.
- The paper also introduces MOVIEQA, a new QA dataset that can be answered by a perfect KB, by Wikipedia pages and by an imperfect KB obtained using IE techniques thereby allowing a comparison between systems using any of the three sources.
- Link to the paper.
import numpy as np | |
from numpy.linalg import norm, solve | |
from scipy.spatial.distance import cdist | |
from sklearn.neighbors import kneighbors_graph | |
def phi(l, mu): | |
return (mu * (np.sqrt(l) - 1)**2) | |
Pick a 2n-element periodic sequence of complex numbers. This is isomorphic to a polynomial p in | |
C[x] / (x^2n - 1) | |
(x^2n = 1 = x^0, which encodes the 2n-periodicity). | |
Computing the 2n-element DFT of the original sequence is just evaluating p at the roots of unity | |
(\omega_{2n}^0, \omega_{2n}^1, ..., \omega_{2n}^{2n+1}). | |
Now, (x^2n - 1) = (x^n - 1) (x^n + 1). This implies that the given p mod (x^2n - 1) is uniquely | |
determined by the remainders p mod (x^n - 1) and p mod (x^n + 1) [via CRT]. That is, there is | |
an isomorphism between C[x] / (x^2n - 1) and (C[x] / (x^n - 1)) x (C[x] / (x^n + 1)). |
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """ | |
import numpy as np | |
import cPickle as pickle | |
import gym | |
# hyperparameters | |
H = 200 # number of hidden layer neurons | |
batch_size = 10 # every how many episodes to do a param update? | |
learning_rate = 1e-4 | |
gamma = 0.99 # discount factor for reward |
# setup python virtualenv and install nodeenv | |
virtualenv .python | |
. .python/bin/activate | |
pip install nodeenv | |
# setup nodeenv with the node of your choice, and upgrade npm to latest | |
nodeenv --node=0.10.37 --prebuilt .node | |
. .node/bin/activate | |
npm install -g npm |
var collision = {}; | |
// aabb: <THREE.Box3> | |
// Plane: <THREE.Plane> | |
collision.isIntersectionAABBPlane = function ( aabb, Plane ) { | |
var center = new THREE.Vector3().addVectors( aabb.max, aabb.min ).multiplyScalar( 0.5 ), | |
extents = new THREE.Vector3().subVectors( aabb.max, center ); |
Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative
float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);
Programming is about communication. It's communication between a human and a computer, but it's also communication between humans and other humans, and between humans and their own future selves. To program, you have to fully elucidate your ideas and record them so that both computers and humans can understand you.
Languages facilitate this kind of communication. Programming languages have to be designed with the computer in mind, but they should also be designed to accommodate humans.
Of course, using comments and out-of-code documentation, you can and should communicate to humans independently from your code. But the program code also needs to be its own documentation, both because actual code and its documentation frequently disagree and because sometimes program code is itself the most elegant way to express an idea.
Languages themselves are software, and they're made up of specificiations and implementations. Ideally, the specifications d
#!/usr/bin/ruby | |
# Create display override file to force Mac OS X to use RGB mode for Display | |
# see http://embdev.net/topic/284710 | |
require 'base64' | |
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |