{{ message }}

Instantly share code, notes, and snippets.

# suzu suzusuzu

Created Dec 13, 2020
Navigable Small World(NSW)
View nsw.jl
 using Random using LinearAlgebra using DataStructures using Base mutable struct Node data friend::Set{Node} end
Created Jul 9, 2020
non null filter implementation in typescript
View non_null_filter.ts
 const arr = [...Array(100).keys()]; const arr1 = arr.map(x => x*x % 2 == 0 ? x*x : null).filter((x): x is number => x !== null); // arr1: number[] const arr2 = arr.flatMap(x => x*x % 2 == 0 ? [x*x] : []) // arr2: number[]
Created Dec 12, 2019
stateless2stateful.ipynb
View stateless2stateful.ipynb
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Created Nov 29, 2019
web scraping julia script from https://paperswithcode.com/sota/image-classification-on-imagenet
View df_imagenet.jl
 using Cascadia using Gumbo using HTTP using JSON using DataFrames using Dates using Plots # scraping r = HTTP.request("GET", "https://paperswithcode.com/sota/image-classification-on-imagenet")
Last active Nov 21, 2019
An Implementation of Divergence Estimation for Multidimensional Densities Via k-Nearest-Neighbor Distance(https://www.princeton.edu/~kulkarni/Papers/Journals/j068_2009_WangKulVer_TransIT.pdf)
View knn_universal_divergence_estimator.py
 import numpy as np import matplotlib.pyplot as plt from sklearn.neighbors import NearestNeighbors def kl_d_norm(mu1, sigma1, mu2, sigma2): d = np.log(sigma2/sigma1) d += (sigma1**2 + (mu1 - mu2)**2) / (2 * sigma2**2) d -= 1/2 return d
Last active Nov 14, 2019
Horseshoe distribution sampling
View horseshoe_distribution.ipynb
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Last active Nov 11, 2019
An implementation of Gaussian Mean Shift Procedure(3d)
View 3d_gaussian_mean_shift.py
 import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation from mpl_toolkits.mplot3d import Axes3D def kde(data, sigma): def f(x): l = x.shape[0] res = np.zeros(l) for i in range(l):
Last active Nov 11, 2019
An implementation of Gaussian Mean Shift Procedure
View gaussian_mean_shift.py
 import numpy as np import matplotlib.pyplot as plt from scipy.stats import gaussian_kde import matplotlib.animation as animation def gaussian_kernel(x, sigma): return 1 / (np.sqrt(2*np.pi)*sigma) * np.exp(-(x**2)/(2*(sigma**2))) def x_update(x, xi, sigma): return np.sum(gaussian_kernel(xi - x, sigma) * x) / np.sum(gaussian_kernel(xi - x, sigma))
Last active Nov 12, 2019
An implementation of CMA-ES (https://arxiv.org/abs/1604.00772)
View purecmaes.py
 import numpy as np def rosenbrock(x): end = x.shape[0] a = 100.0 b = 1.0 return np.sum(a * np.power((x[1:] - np.power(x[:end-1], 2)), 2) + np.power((x[:end-1] - b), 2)) def cmaes(dim, f): # User defined parameters
Last active Nov 4, 2019
Higher Order SVD(HOSVD)
View higher_order_svd.ipynb