Skip to content

Instantly share code, notes, and snippets.

View ayemos's full-sized avatar
🔪
{neutral}

Yuichiro Someya ayemos

🔪
{neutral}
View GitHub Profile
'''
input >
---61----
2--7-8---
-9-4--65-
8-----3-7
97123-5--
-2386-941
318942765
|- let twice = fun f -> fun x -> f (f x) in twice twice (fun x -> x * x) 2 evalto 65536 by E-Let {
|- fun f -> fun x -> f (f x) evalto ()[fun f -> fun x -> f (f x)] by E-Fun {};
twice = ()[fun f -> fun x -> f (f x)] |- twice twice (fun x -> x * x) 2 evalto 65536 by E-App {
twice = ()[fun f -> fun x -> f (f x)] |- twice twice (fun x -> x * x) evalto
(f = (f = (twice = ()[fun f -> fun x -> f (f x)])[fun x -> x * x])[fun x -> f (f x)])[fun x -> f (f x)] by E-App {
twice = ()[fun f -> fun x -> f (f x)] |- twice twice evalto (f = ()[fun f -> fun x -> f (f x)])[fun x -> f (f x)] by E-App {
twice = ()[fun f -> fun x -> f (f x)] |- twice evalto ()[fun f -> fun x -> f (f x)] by E-Var1 {};
twice = ()[fun f -> fun x -> f (f x)] |- twice evalto ()[fun f -> fun x -> f (f x)] by E-Var1 {};
f = ()[fun f -> fun x -> f (f x)] |- fun x -> f (f x) evalto (f = ()[fun f -> fun x -> f (f x)])[fun x -> f (f x)] by E-Fun {}
@ayemos
ayemos / cookpad
Last active August 29, 2015 14:24
#include <math.h> // cook
#define e(b,is,u) i##is##t/* pad */
#define c(o,ok,pa,d)ok##a##pa##n(/* 2016 */
#define coo(k,pa,d,is,user,first)pu##pa##k##ar
c(o,m,i,c)s){e(ter,n,al)p='@'; int b,e,d,j,l,k,r,y,h;
for(j=e=k=y=l=9;h<y;d+=e ){e(a,n,thony)jackson=1;
b+=e+e*.19901121;coo(ch, t,e,e,t,h)(p+((e( ve,n,t
))p+l<<2+0+ 11- '-'-'-'-'-' ==-55? k:l));coo(ch,
t,y<b?d>4 ?3:11:5,t,b<1?3 :2,e++1)
@ayemos
ayemos / analyze.rb
Created February 9, 2016 10:28
Count hinshi-s
# Usage: ruby analyze.rb CSV_FILE
require 'csv'
require 'awesome_print'
VERB_KEYS = [/[^助感]動詞/, /^動詞/]
AUX_VERB_KEYS = [/助動詞/]
CONJUNCTION_KEYS = [/接続詞/]
NOUN_KEYS = [/名詞/]
ADJECTIVAL_VERB_KEYS = [/形容動詞/, /形状詞/]
@ayemos
ayemos / file0.txt
Created April 7, 2017 03:07
lammaで始める等身大のAWS Lambda ref: http://qiita.com/ayemos/items/acc212261dc6f39cb1cf
$ gem install lamma
$ lamma init my_function --runtime=python2.7
Looks like you didn't specified role arn for the function.
Do you want me to create default IAM role and configure it (my_function-lamma-role)? (y/n) y
I, [2017-04-06T22:28:53.952278 #5027] INFO -- : Creating role my_function-lamma-role
I, [2017-04-06T22:28:54.863304 #5027] INFO -- : Checking attached role policies for my_function-lamma-role
I, [2017-04-06T22:28:55.243400 #5027] INFO -- : Could not find AWSLambdaBasicExecutionRole policy. Attatching.
I, [2017-04-06T22:28:55.243449 #5027] INFO -- : Attaching minimal policy (AWSLambdaBasicExecutionRole) to my_function-lamma-role
I, [2017-04-06T22:28:55.466092 #5027] INFO -- : Done
create /workspace/my_function/lambda_function.py

Keybase proof

I hereby claim:

  • I am ayemos on github.
  • I am ayemos (https://keybase.io/ayemos) on keybase.
  • I have a public key ASBvOOq1zApER3sL2jIcj_iTdalvgkqTZfRFmS1LrgWYRAo

To claim this, I am signing this object:

from keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
@ayemos
ayemos / list_classes.py
Last active July 10, 2017 05:39
module以下にあってbase_classを継承しているクラスを列挙
import inspect
import importlib
def list_classes(module, base_class):
return _list_classes(module, base_class, set())
def _list_classes(module, base_class, result):
for maybe_class in [member[1] for member in inspect.getmembers(module)]:

コラム - chainer.Linkクラスとchainer.ChainクラスによるCompositeパターン

ニューラルネットワークの中には、〜またはさらにその集まりで構成されるような大変複雑な物があります。(例: Google のInception-v4モデル https://research.google.com/pubs/pub45169.html) Chainerでは、GoFのデザインパターンの一つであるCompositeパターンを利用して、このような複雑なニューラルネットワークも柔軟に表現できるようになっています。

chainer.Linkは「入力に対して出力を出す」という共通のインターフェースを提供しており、そのサブクラスであるchainer.Chainも同様です。例えば、Linkオブジェクト l1, l2 と Chainオブジェクト c1 があった時に、 

l1(l2(c1)

のように出力を次のオブジェクトの入力として数珠つなぎにしていくことが出来ます。

mkdir ignore_tmp;cd ignore_tmp;mkdir -p data/deep{,_dont_check_in};touch data/deep{,_dont_check_in}/foo;touch data/deep/.gitkeep;echo '/data/**\n!/data/deep/\n!/data/deep_dont_check_in/\n!/data/*/.gitkeep' > .gitignore