Skip to content

Instantly share code, notes, and snippets.

View takuti's full-sized avatar
🏃‍♂️
𓈒 𓂂𓏸𓋪‪

Takuya Kitazawa takuti

🏃‍♂️
𓈒 𓂂𓏸𓋪‪
View GitHub Profile

First of all, make sure that your Treasure Data cluster is HDP2, not CDH4. Matrix Factorization is only supported in the up-to-date HDP2 cluster. HDP2 is allocated for users who signed Treasure Data after Feb 2015. CDH4 is allcoated for the others.

NOTE: please ask our customer support to use HDP2 if you get an error.

Data preparation

Download ml-20m.zip and unzip it.

@ganmacs
ganmacs / gist:a1c81c37fa023516d23e
Last active August 29, 2015 14:23
cloud create lxc an git repository
#!/bin/bash
# const
USAGE="[USAGE]
$ ./setup <username> <reponame> <ip>
[Requirement]
exec by root
[Example]
@huyng
huyng / .numpy-site.cfg
Last active March 14, 2017 19:36
Place the following in your home directory at ~/.numpy-site.cfg in order to install numpy with openblas support
# Place the following in your home directory at ~/.numpy-site.cfg
# in order to install numpy with openblas support
[openblas]
libraries = openblas
library_dirs = /usr/local/opt/openblas/lib
include_dirs = /usr/local/opt/openblas/include
@myui
myui / auc.py
Last active June 8, 2018 08:08
def auc(num_positives, num_negatives, predicted):
l_sorted = sorted(range(len(predicted)),key=lambda i: predicted[i],
reverse=True)
fp_cur = 0.0
tp_cur = 0.0
fp_prev = 0.0
tp_prev = 0.0
fp_sum = 0.0
auc_tmp = 0.0
last_score = float("nan")
@martindemello
martindemello / chain-of-responsibility.rb
Created February 20, 2015 21:30
chain of responsibility example in ruby
class PurchaseApprover
# Implements the chain of responsibility pattern. Does not know anything
# about the approval process, merely whether the current handler can approve
# the request, or must pass it to a successor.
attr_reader :successor
def initialize successor
@successor = successor
end
@mblondel
mblondel / matrix_sketch.py
Last active February 13, 2019 09:26
Frequent directions algorithm for matrix sketching.
# (C) Mathieu Blondel, November 2013
# License: BSD 3 clause
import numpy as np
from scipy.linalg import svd
def frequent_directions(A, ell, verbose=False):
"""
Return the sketch of matrix A.
@takungsk
takungsk / tmux_cheat_cheet.markdown
Last active April 7, 2019 18:21
tmuxのcheat sheet(日本語)

tmux cheat sheet

コマンド

新しく開始:

tmux

セッションに名前を付けて開始:

tmux new -s myname

アタッチ:

tmux a # (or at, or attach)

再アタッチ:

tumx a -d

@faulker
faulker / update_json.sql
Created October 27, 2016 18:40
Example of how to update a Postgresql JSON field using jsonb_set
update tests_summary_data set data = (jsonb_set(to_jsonb(data), '{misc,gap,pa}', '-1', false))::json where data->'misc'->'gap'->>'pa' = '0';
@voluntas
voluntas / trello.rst
Last active August 20, 2020 14:55
Trello のススメ
@osdf
osdf / gist:5133737
Created March 11, 2013 11:55
Playing with basic MCMC.
"""
Some python code for
Markov Chain Monte Carlo and Gibs sampling
by Bruce Walsh
"""
import numpy as np
import numpy.linalg as npla