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
var i; | |
var MAX = 100000; | |
/* === Versions === | |
* NODE: v0.6.12 | |
* CHROME: 23.0.1271.64 | |
*/ | |
/* === Hash === | |
* NODE: 12ms | |
* CHROME: 187.885ms |
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
# pushState friendly! | |
# The setup: | |
# * website name is `site.com` | |
# * the API for your running on localhost:3000 | |
# * the root for API calls is at `/api`, and you have authentication routes with root `/auth` (both go to localhost:3000) | |
# * javascript app is located at `/path/to/javascript/app` | |
# Assuming you have your server for API calls at localhost port 3000 | |
upstream api_sitecom { | |
server localhost:3000; |
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 os | |
import numpy as np | |
def generate_data(n, p, seed): | |
np.random.seed(seed) | |
beta = np.random.normal(size=p, scale=2.0) | |
X = np.random.normal(size=(n,p)) | |
y = np.dot(X, beta) |
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
package rbm | |
import ( | |
"fmt" | |
"math" | |
"math/rand" | |
) | |
func uniform(r *rand.Rand) float64 { | |
if r == nil { |
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 | |
l2 = lambda x: np.sqrt(np.sum(np.square(x))) | |
def lasso_admm(X, y, lambduh, rho=1.0, tol=1e-10, maxiter=1000): | |
i = 0 | |
n, p = X.shape | |
inv = np.linalg.inv(X.T.dot(X) + rho * np.eye(p)) | |
xy = X.T.dot(y) |
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
x <- c(0.27, 0.58, 1.02, 2.02, 3.62, 5.08, 7.07, 9.00, 12.15, 24.17) | |
y <- c(4.40, 6.90, 8.20, 7.80, 7.50, 6.20, 5.30, 4.90, 3.70, 1.05) | |
# function | |
f <- function(beta, x) { | |
D <- 4.53 | |
V <- beta[1] | |
k.a <- beta[2] | |
k.e <- beta[3] | |
D * k.a / (V * (k.a - k.e)) * (exp(-k.e * x) - exp(-k.a * x)) |