Instantly share code, notes, and snippets.

Yuto Yamaguchi yamaguchiyuto

View GitHub Profile
@yamaguchiyuto
yamaguchiyuto / btree.hs
Last active Jan 7, 2018
Haskell B-tree implementation
View btree.hs
data Tree a = Nil Int | Leaf Int [a] | Node Int [a] [Tree a] deriving Show
find :: (Ord a, Eq a) => Tree a -> a -> Bool
find (Nil _) _ = False
find (Leaf _ []) _ = False
find (Leaf m (k:ks)) x
| x == k = True
| x < k = False
| x > k = find (Leaf m ks) x
find (Node _ [] (t:ts)) x = find t x
@yamaguchiyuto
yamaguchiyuto / probabilistic_matrix_factorization.ipynb
Last active Sep 25, 2017
Probabilistic matrix factorization using Edward
View probabilistic_matrix_factorization.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View atm_experiment.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yamaguchiyuto
yamaguchiyuto / atm.py
Created Mar 23, 2017
Author Topic Model
View atm.py
import random
import copy
import numpy as np
from scipy.sparse import lil_matrix
class ATM:
def __init__(self, K, alpha, beta, max_iter, verbose=0):
self.K=K
self.alpha = alpha
self.beta = beta
View nctm_experiment.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yamaguchiyuto
yamaguchiyuto / nctm.py
Created Mar 22, 2017
Noisy Correspondence Topic Model
View nctm.py
import random
import numpy as np
from scipy.sparse import lil_matrix
class NCTM:
def __init__(self, K, alpha, beta, gamma, eta, max_iter, verbose=0):
self.K=K
self.alpha = alpha
self.beta = beta
self.gamma = gamma
View ctm_experiment.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yamaguchiyuto
yamaguchiyuto / ctm.py
Created Mar 21, 2017
Correspondence Topic Model
View ctm.py
import random
import numpy as np
from scipy.sparse import lil_matrix
class CTM:
def __init__(self, K, alpha, beta, gamma, max_iter, verbose=0):
self.K=K
self.alpha = alpha
self.beta = beta
self.gamma = gamma
View jtm_experiment.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yamaguchiyuto
yamaguchiyuto / jtm.py
Last active Mar 6, 2018
Joint Topic Models
View jtm.py
import random
import numpy as np
from scipy.sparse import lil_matrix
class JTM:
def __init__(self, K, alpha, beta, max_iter, verbose=0):
self.K=K
self.alpha = alpha
self.beta = beta
self.max_iter = max_iter