Skip to content

Instantly share code, notes, and snippets.

View mokemokechicken's full-sized avatar

Ken Morishita mokemokechicken

View GitHub Profile
// https://github.com/numpy/numpy/blob/master/numpy/random/mtrand/distributions.c
// https://github.com/numpy/numpy/blob/master/numpy/random/mtrand/randomkit.c
function DistributionSampling(seed) {
// xorshift: https://sbfl.net/blog/2017/06/01/javascript-reproducible-random/
var state = {
x: 123456789,
y: 362436069,
z: 521288629,
w: seed || 88675123,
@mokemokechicken
mokemokechicken / scatter_with_colors_and_legends.py
Created June 21, 2018 08:19
scatter with colors and legends
p_list = np.argmax(api.predict(dataset.x), axis=1)
color_master = sns.color_palette()
colors = [color_master[ptn] for ptn in p_list]
names = api.predict_names()
g = sns.JointGrid("x", "y", data=zz)
g = g.plot_joint(plt.scatter, c=colors, label=p_list)
g = g.plot_marginals(sns.distplot, kde=True)
bb = g.ax_joint.viewLim
@mokemokechicken
mokemokechicken / find_files_including_null_bytes.sh
Created March 2, 2018 07:09
find_files_including_null_bytes
sudo find /usr /lib /etc -type f -size +100 \( -exec grep -q -P "[^\0]" {} \; -o -print \) | head
"""
問:
あなたは
1. この質問に「いいえ」と正しく答えるか
2. この質問に「はい」と間違って答えるか
3. 教師に1万円を支払うか
のいずれかですか?
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mokemokechicken
mokemokechicken / keras_mnist_vat.py
Last active October 21, 2020 07:37
Virtual Adversarial Training for MNIST with Keras
# coding: utf8
"""
* VAT: https://arxiv.org/abs/1507.00677
# 参考にしたCode
Original: https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py
VAT: https://github.com/musyoku/vat/blob/master/vat.py
results example
---------------
away_score away_team date home_score home_team score visitors
1 名古屋 02/27(土) 0 磐田 0-1 14333
1 川崎F 02/27(土) 0 広島 0-1 18120
1 福岡 02/27(土) 2 鳥栖 2-1 19762
2 浦和 02/27(土) 1 1-2 13416
2 新潟 02/27(土) 1 湘南 1-2 14058
2 甲府 02/27(土) 0 神戸 0-2 23862
1 仙台 02/27(土) 0 横浜FM 0-1 24898
1 大宮 02/27(土) 0 FC東京 0-1 25776
1 鹿島 02/28(日) 0 G大阪 0-1 32463
@mokemokechicken
mokemokechicken / for_bayesian_opt_article.ipynb
Created September 2, 2016 03:21
bayesian optimization sample
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mokemokechicken
mokemokechicken / Dockerfile
Created February 23, 2016 09:50
Dockerfile about jupyter + tensorflow
From jupyter/datascience-notebook
RUN curl -k -L -O https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp34-none-linux_x86_64.whl && \
mv tensorflow-0.7.1-cp34-none-linux_x86_64.whl tensorflow-0.7.1-cp35-none-linux_x86_64.whl
RUN pip install tensorflow-0.7.1-cp35-none-linux_x86_64.whl
RUN /bin/bash -c "source activate /opt/conda/envs/python2/ && pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl"
@mokemokechicken
mokemokechicken / Dockerfile-jupyter-tensorflow
Created February 23, 2016 09:49
Dockerfile about Jupyter with tensorflow
From jupyter/datascience-notebook
RUN curl -k -L -O https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp34-none-linux_x86_64.whl && \
mv tensorflow-0.7.1-cp34-none-linux_x86_64.whl tensorflow-0.7.1-cp35-none-linux_x86_64.whl
RUN pip install tensorflow-0.7.1-cp35-none-linux_x86_64.whl
RUN /bin/bash -c "source activate /opt/conda/envs/python2/ && pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl"