みやさか

真澄の蔵だけど、柔らかくて甘みを感じる。

1256823882

アルコール度数12度ということもあってかすいすい吞める。

酒屋さんに燗つけても美味しいのとリクエストしたら薦められたので最初は燗つけてたんだけど、冷やのほうが美味くなってきてそのまま飲んでた。

あと、来週いわせさんの酒の会にいくことにした。楽しみ

Only a question can point the way forward.

モデルっていうのは仮説をドリブンして、本質に近づくために存在するのであって、正解率をあげるための単なる機械という認識は困るし、仮説ドリブンとか言うといて、その仮説がモチベーションをあげるための単なる虚言で、検証しないことを前提なのも困る。

Hello? / Jostein Gaarder

言葉の定義が揃ってないだけなのかもしれないけど(とか言っておこう)

Properties of useful model

いきなりThe Art of Modelingという章から入って、いいことたくさん書いてある。

ProductName Pharmacokinetic-Pharmacodynamic Modeling and Simulation
Peter Bonate
Springer / ¥ 8,475 ()
在庫あり。

有用なモデルの特性とは

  • Ability characterize the observed data and to include the most important features of the data
  • Makes accurate and precise predictions
  • Increases understanding of the system
  • The model is actually used
  • The model is completed on time
  • Logically consistent, plausible
  • Validated by empirical observations
  • Robust to small changes in the data
  • Appropriate level of precision and detail
  • As simple as possible
  • Judged on what it is intended to do
  • Has flexibility
  • Is effective as a communication tool
  • Serves many different purpose
  • May allow for extrapolation outside the data range

LeadOptimizationのプロジェクトにおいては

  • Ability characterize the observed data and to include the most important features of the data
  • Is effective as a communication tool

の二つが特に重要なんだろうなぁと思う。自分でモデリングできるのであれば、前者だけを重要視するかもしれない。

三文ゴシップ / 椎名林檎

落ち着いた?それとも薄まった?

ProductName 三文ゴシップ
椎名林檎
EMIミュージックジャパン / ¥ 3,059 (2009-06-24)
在庫あり。

危うさというか、アグレッシブというか攻撃的というか斜に構えてるっていうか、そういう鋭さ的なものはあんまないかも。

まぁそんな感じ。嫌いではないけどね。

Pythonで多層パーセプトロン

Machine Learning 3章

ProductName Machine Learning: An Algorithmic Perspective (Chapman & Hall/Crc Machine Learning & Patrtern Recognition)
Stephen Marsland
Chapman & Hall / ¥ 6,459 ()
通常1~3週間以内に発送

要するにbackwars phaseを実装すればいいんでしょ?的な。実際書いてみると逆に誤差を伝播している感がある。

# Code from Chapter 3 of Machine Learning: An Algorithmic Perspective
# by Stephen Marsland (http://seat.massey.ac.nz/personal/s.r.marsland/MLBook.html)

# You are free to use, change, or redistribute the code in any way you wish for
# non-commercial purposes, but please maintain the name of the original author.
# This code comes with no warranty of any kind.

# Stephen Marsland, 2008
# modifiled by kzfm 2009

from numpy import *

inputs = array([[0,0],[0,1],[1,0],[1,1]])
targets = array([[0],[1],[1],[0]])

ndata,nin   = shape(inputs)
nout        = shape(targets)[1]
nhidden     = 2
beta        = 1
momentum    = 0.9
eta         = 0.25
niterations = 10001

weights1 = (random.rand(nin+1,nhidden)-0.5) * 2/sqrt(nin)
weights2 = (random.rand(nhidden+1,nout)-0.5) * 2/sqrt(nhidden)

# train
inputs = concatenate((inputs,-ones((ndata,1))),axis=1)
change = range(ndata)

updatew1 = zeros((shape(weights1)))
updatew2 = zeros((shape(weights2)))

for n in range(niterations):

    hidden = concatenate((1.0/(1.0+exp(-beta * dot(inputs,weights1))), -ones((shape(inputs)[0],1))),axis=1)
    outputs = 1.0 / (1.0+exp(-beta * dot(hidden,weights2)))
    error = 0.5 * sum((targets-outputs)**2)

    if (mod(n,1000)==0): print "Iteration: ",n, " Error: ",error    

    deltao = (targets-outputs) * outputs * (1.0-outputs)            
    deltah = hidden * (1.0-hidden) * (dot(deltao,transpose(weights2)))

    updatew1 = eta*(dot(transpose(inputs),deltah[:,:-1])) + momentum*updatew1
    updatew2 = eta*(dot(transpose(hidden),deltao)) + momentum*updatew2

    weights1 += updatew1
    weights2 += updatew2

    random.shuffle(change)
    inputs = inputs[change,:]
    targets = targets[change,:]

ちなみに、創薬系でのニューラルネットは論文とかは多いけど、実務ではあんまり使われないと思う(特にケミストよりになればなるほど)。というのは、実務においてはゴールするためにはこういうロジックで合成すればよろしいみたいな指針を提示しないといけないが、ニューラルネットでつくったモデルだとそういう解釈がしづらい。

なんか物がたくさんあって、フィルタリングしたいという要求には答えられるけど、何をどういう指針に従って創るかみたいな、創造(製造)律速な問題には使いにくい。

じゃぁ神経系は創造的ではないのかというと、それはまた違うんじゃないかなぁと思ったりもする。モデル化があれなのかなぁとも思うのだけど、、、、

macbook届いた

新型はまるっこくなって、多少薄くなってた。

1256642149

skypeとfirefoxとpicasaだけ入れとけばいいのでU隊長(カジュアルユーザー)のための設定は楽。

1256642142

早速youtubeのピングーをせがむ娘。

追記

iPhoto使うからpicasaはいらんと言われた。

「入門git」を読んだ

入門subversionが読みやすかったので。GitHubを快適に使うために読んでみた。

ProductName 入門git
Travis Swicegood
オーム社 / 2520円 ( 2009-08-12 )


  • ステージの話がわかりやすかった
  • git blame便利そう

手っ取り早く使いたいだけだったら、分かりやすくてよい(薄いし) もう少し使ってみて色々覚えてきたら入門Gitも読んでみよう。

ProductName 入門Git
濱野 純(Junio C Hamano)
秀和システム / 2310円 ( 2009-09-19 )


Pythonでパーセプトロン

Machine Learningを読んでいる

ProductName Machine Learning: An Algorithmic Perspective (Chapman & Hall/Crc Machine Learning & Patrtern Recognition)
Stephen Marsland
Chapman & Hall / ¥ 6,459 ()
通常1~3週間以内に発送

numpyでパーセプトロンでORを訓練してみた(なにげにパーセプトロンとかニューラルネットワークの実装は初めてだったりする)。

from numpy import *
inputs = array([[0,0],[0,1],[1,0],[1,1]])
targets = array([[0],[1],[1],[1]])

nIterations = 6
eta = 0.25
nData = shape(inputs)[0]
nIn = shape(inputs)[1]
nOut  = shape(targets)[1]
weights = random.rand(nIn+1,nOut)

inputs = concatenate((inputs,-ones((nData,1))),axis=1)

for i in range(nIterations):
    outputs = where(dot(inputs,weights)>0,1,0)
    weights += eta*dot(transpose(inputs),targets-outputs)
    print "Iter: %d" % i
    print weights

print "Final outputs are:"
print where(dot(inputs,weights)>0,1,0) 

この本は、アルゴリズムに関して説明するのがメインの本らしいので、コードの解説はあんまなくて、詳しくはサンプルコード読めということらしいが、もう少し読んでみないとわからん。

「使える経済学の考え方」

これは名著。

  • 序章 幸福や平等や自由をどう考えたらいいか
  • 第1章 幸福をどう考えるかーーピグーの理論
  • 第2章 公平をどう考えるかーーハルサーニの定理
  • 第3章 自由をどう考えるかーーセンの理論
  • 第4章 平等をどう考えるかーーギルボアの理論
  • 第5章 正義をどう考えるかーーロールズの理論
  • 第6章 市場社会の安定をどう考えるかーーケインズの貨幣理論
  • 終章 何が、幸福や平等や自由を阻むのかーー社会統合と階級の固着性

第4章,第6章、終章が特に面白かった。ショケ期待値とか、リーマン積分とか。

参考

「Cとアセンブリ言語で学ぶ計算機プログラミングの基礎概念」読了

25章以降はちょっと読み物風味でアセンブリの話とかあんま出てこないのが残念。それ以前の内容から、なんとなくはイメージできるのでいいけど。

  • 第25章 動的メモリ割当て
  • 第26章 非局所的ジャンプ
  • 第27章 マルチスレッド
  • 第28章 スレッド同期
  • 第29章 例外
  • 第30章 割込み
  • 第31章 非ブロッキング並行データ構造