Skip to content

Instantly share code, notes, and snippets.


naoyashiga naoyashiga

View GitHub Profile
naoyashiga /
Last active Apr 28, 2017
K = 3
# ソートはされていない上位k件のインデックス
unsorted_max_indices = np.argpartition(-my_array, K)[:K]
# 上位k件の値
y = my_array[unsorted_max_indices]
# -*- coding: utf-8 -*-
# Inspired
# [TensorFlow-Examples/ at master · aymericdamien/TensorFlow-Examples](
import tensorflow as tf
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data", one_hot=True)
naoyashiga /
Created Jan 22, 2017
import cv2
from os import path
import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline
cascades_dir = path.normpath(path.join(cv2.__file__, '..', '..', '..', '..', 'share', 'OpenCV', 'haarcascades'))
cascade_f = cv2.CascadeClassifier(path.join(cascades_dir, 'haarcascade_frontalface_alt2.xml'))
def faceDetect(filePath):
naoyashiga / index.js
Created Jan 1, 2017
Facebook Messenger Bot, aws lambdaでおうむ返しbot
View index.js
const request = require('request');
var options = {
hostname: "",
path: "/v2.6/me/messages?access_token=" + PAGE_ACCESS_TOKEN,
method: 'POST',
headers: {
'Content-Type': 'application/json'
naoyashiga / writeIkku.rb
Last active Dec 27, 2016
View writeIkku.rb
require "ikku"
reviewer =
sourceTextFileName = '../data/wiki.txt'
outputTextFileName = 'math.txt'
outputTextFile =,'w')
begin do |file|
file.each_line do |line|
naoyashiga /
Last active Oct 4, 2016
Spurious Correlations指標翻訳まとめ


指標A 指標B correlation 捕捉
Hot Dog Eating Contentの優勝者のホットドッグ消費量 NY timesベストセラーリストででフィクション作品が1位になった数 91.5
チーズの消費量 ベッドのシーツのもつれ事故 94.7
マーガリンの消費量 メイン州の離婚率 98.9
チキンの消費量 紙とボード製品の消費量 99.6
マクドナルドの顧客満足度 食道を詰まらせる死亡事故件数 85.6
茶の消費量 芝刈り機の誤操作での死亡人数 93
牛肉の消費量 落雷での死亡数 87
View kiji.html
<!DOCTYPE html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="ja"><![endif]-->
<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8" lang="ja"><![endif]-->
<!--[if IE 8]><html class="no-js lt-ie9" lang="ja"><![endif]-->
<!--[if gt IE 8]><!--><html class="no-js" lang="ja"><!--<![endif]-->
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
import numpy
import matplotlib.pyplot as plt
import chainer
from chainer import cuda
import chainer.functions as F
import chainer.links as L
from chainer import optimizers
from chainer import cuda, Function, gradient_check, Variable, optimizers, serializers, utils
from chainer import Link, Chain, ChainList
naoyashiga /
Last active May 2, 2016
# -*- coding: utf-8 -*-
import numpy
import matplotlib.pyplot as plt
def predict(w, x):
output =, x)
if output >= 0:
naoyashiga / index.html
Created Mar 20, 2016
p5.js sound test
View index.html
* {
margin: 0;
padding: 0;
<script src=""></script>
<script src=""></script>
You can’t perform that action at this time.