Instantly share code, notes, and snippets.

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
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.
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.
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.
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.
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