- embeddings.js: word2vec in Javascript
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 gym | |
import logging | |
import sys | |
import numpy as np | |
from gym import wrappers | |
import torch | |
import torchvision | |
import torch.nn as nn | |
import torch.nn.functional as F |
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 gym | |
import logging | |
import sys | |
import numpy as np | |
from gym import wrappers | |
import torch | |
import torchvision | |
import torch.nn as nn | |
import torch.nn.functional as F |
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 gym | |
import logging | |
import sys | |
import numpy as np | |
from gym import wrappers | |
import torch | |
import torchvision | |
import torch.nn as nn | |
import torch.nn.functional as F |
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
''' | |
Linear Regression From First Principles | |
Author: Gaurav Menghani (gaurav.menghani@gmail.com) | |
''' | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def linear_sum(X, W, b): | |
return X.dot(W) + 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
#include <iostream> | |
using namespace std; | |
struct Node { | |
int val; | |
Node *next; | |
}; | |
void print(Node* n) { |
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 urllib | |
import simplejson as json | |
def get_followers_url(handle): | |
return 'https://api.twitter.com/1/followers/ids.json?cursor=-1&screen_name=' + handle | |
def get_followers(handle): | |
return json.load(urllib.urlopen(get_followers_url(handle)))['ids'] | |
def get_friends_url(handle): |
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
struct Slope { | |
int n, d; | |
Slope(int nn, int dd) { | |
int g = gcd(abs(nn), abs(dd)); | |
// cout << "gcd of " << nn << ", " << dd << " is: " << g << endl; | |
n = (g > 0 ? nn/g : nn); | |
d = (g > 0 ? dd/g : dd); | |
} | |
}; | |
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
#pragma once | |
#include <iostream> | |
#include <cassert> | |
#include <set> | |
#include <map> | |
#include <vector> | |
#include <algorithm> | |
#include <utility> | |
#include <cstdio> |
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
#include <iostream> | |
#include <cassert> | |
#include <set> | |
#include <map> | |
#include <vector> | |
#include <algorithm> | |
#include <utility> | |
#include <cstdio> | |
#include <limits> | |
#include <bitset> |