Skip to content

Instantly share code, notes, and snippets.

View yusong-shen's full-sized avatar

yusong-shen

View GitHub Profile
@yusong-shen
yusong-shen / rbm.py
Created November 2, 2015 20:13
Some fairly clean (and fast) code for Restricted Boltzmann machines.
"""
Code for training RBMs with contrastive divergence. Tries to be as
quick and memory-efficient as possible while utilizing only pure Python
and NumPy.
"""
# Copyright (c) 2009, David Warde-Farley
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@yusong-shen
yusong-shen / pmf-and-modified-bpmf-pymc.py
Created November 28, 2015 01:17 — forked from macks22/pmf-and-modified-bpmf-pymc.py
Probabilistic Matrix Factorization (PMF) + Modified Bayesian BMF
"""
Implementations of:
Probabilistic Matrix Factorization (PMF) [1],
Bayesian PMF (BPMF) [2],
Modified BPFM (mBPMF)
using `pymc3`. mBPMF is, to my knowledge, my own creation. It is an attempt
to circumvent the limitations of `pymc3` w/regards to the Wishart distribution:
@yusong-shen
yusong-shen / gist:03a41c9b0fac27afa5c1
Created November 29, 2015 04:58 — forked from huowa222/gist:9640856
recommendation opensource list
原文地址:http://in.sdo.com/?p=1707
收集和整理了目前互联网上能找到的开源推荐系统,并附上了个人的一些简单点评(未必全面准确),这个列表是目前为止比较全面的了,希望对大家了解掌握推荐系统有帮助(文/陈运文)
SVDFeature
由上海交大的同学开发,采用C++语言,代码质量很高。去年我们参加KDD竞赛时用过,很好很方便,而且出自咱们国人之手,所以置顶推荐!
项目地址:
http://svdfeature.apexlab.org/wiki/Main_Page
SVDFeature包含一个很灵活的Matrix Factorization推荐框架,能方便的实现SVD、SVD++等方法, 是单模型推荐算法中精度最高的一种。SVDFeature代码精炼,可以用相对较少的内存实现较大规模的单机版矩阵分解运算。
另外含有Logistic regression的model,可以很方便的用来进行ensemble运算
@yusong-shen
yusong-shen / parse_leetcode_tags.js
Created September 25, 2016 17:27
Javascript script running on browser to get all the problems inside one company
var table = document.getElementsByTagName('tbody');
var q_table = table[0];
// DOM Node List
var all_data = q_table.getElementsByTagName('tr');
var data_list = []
@yusong-shen
yusong-shen / tags_distribution.js
Created September 25, 2016 18:38
Get the leetcode tags distribution from data_list json
var map = {}
data_list.forEach( item => {
item['code_tags'].forEach( tag => {
if (tag in map) {
map[tag] += 1;
} else {
map[tag] = 1;
}
})
@yusong-shen
yusong-shen / BathroomStalls.java
Last active April 9, 2017 20:26
Google Code Jam 2017 Qualification Rounds Solution
import java.io.*;
import java.util.*;
public class BathroomStalls {
public BathroomStalls() {
// TODO Auto-generated constructor stub
}
// O(k * n * logn)