Skip to content

Instantly share code, notes, and snippets.

View chezou's full-sized avatar

Aki Ariga chezou

View GitHub Profile
@chezou
chezou / as_msgpack_stream.R
Last active October 26, 2019 13:05
Convert R data frame to msgpack stream
devtools::install_github("crowding/msgpack-r")
library(msgpack)
x <- data.frame(a=1:3, b=4:6)
conn <- gzfile("test.msgpack.gz", open="w+b")
apply(x, 1, function(x) {writeMsg(c(x, time=as.integer(Sys.time())), conn)})
flush(conn)
close(conn)
@chezou
chezou / rand.dig
Created May 8, 2019 04:17
Parallel example with py> operator
+t1_1:
py>: rand.rand_params
docker:
image: 'digdag/digdag-python:3.6.8-stretch'
n_iter: 5
+t1_2:
echo>: ${param_list}
+t1_3:
@chezou
chezou / calc_multiclass_precision_recall.sql
Last active March 15, 2019 06:26
Calculate multiclass micro/macro precision and recall in SQL
with agg as (
select
p.label, p.probability, t.survived
from
prediction_rf p
join
test t on (p.rowid = t.rowid)
order by
probability desc
),
@chezou
chezou / R_env.frozen.yml
Last active January 31, 2019 00:18
Conda environment for R parcel
name: R_env
channels:
- conda-forge
- defaults
dependencies:
- arrow-cpp=0.12.0=py37h0e61e49_0
- attrs=18.2.0=py_0
- backcall=0.1.0=py_0
- binutils_impl_linux-64=2.31.1=h6176602_1
- binutils_linux-64=2.31.1=h6176602_3
@chezou
chezou / backspace_stats_2.ipynb
Created January 28, 2019 15:36
backspace_stats_2.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chezou
chezou / backspace_stats.ipynb
Last active December 22, 2018 15:46
backspace.fm のtitleとshow noteのword cloudによる可視化
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chezou
chezou / natto-test.rb
Created November 25, 2018 15:15
mecab windows 64bit
ENV["MECAB_PATH"]='C:\\mecab\\libmecab.dll'
require 'natto'
nm = Natto::MeCab.new
puts nm.parse('俺の名前は星野豊だ!!そこんとこヨロシク!')