14012010 music
よい
このくらい寒い夜にはいい感じのチル
14012010 music
初広見公園。古墳とか屋敷とかがある。あと、籠があって担げるようになっている。ゼンマイ侍好きの子どもたちはやたら喜んでいた。

併設されている公園。

さんざん行ってみたいと言ってたU隊長だが「これだったら、中央公園でいいわ」とぼそっとつぶやいたのは聞き逃さなかった。(離れた場所に遊び場あったけど)遊具的には大渕公園のが楽しいんじゃないか。きわだ路で蕎麦食えるし。
公園で遊んだら、そのまま降りて行って、吉原のsofariiでランチ。
つけナポに、五穀米ごはんを投入してスープを食べきるという技が最高でした。旨いですマジ。おすすめ。

U隊長の食べてたスープランチとガトーショコラ。

尚、つけナポの属性はつけ麺なので、僕の中ではラーメン的な扱いです。
それにしてもつけナポの公式サイトはあんまやるきないのかな(blog更新してないし)。やっつけナポリタンか?
14012010 Haskell
実際にやってみると位置を記録すんのに手間取ったり(pythonはenumarateがあるので楽)とか、リストモナドの使い方をちゃんと理解してなかったりとかで、終わらん。
import List
maze = ["**************************",
"*S* * *",
"* * * * ************* *",
"* * * ************ *",
"* * *",
"************** ***********",
"* *",
"** ***********************",
"* * G *",
"* * *********** * *",
"* * ******* * *",
"* * *",
"**************************"]
type Pos = (Int,Int)
type Path = [Pos]
findPos :: [String] -> Char -> Pos
findPos maze c =
let y = findY maze c 0
x = findX (maze!!y) c 0
in (x,y)
where
findY :: [String] -> Char -> Int -> Int
findY [] _ _ = error (c : " not found\n")
findY (x:xs) c n | c `elem` x = n
| otherwise = findY xs c (n+1)
findX :: String -> Char -> Int -> Int
findX (x:xs) c n | x == c = n
| otherwise = findX xs c (n+1)
start = findPos maze 'S'
goal = findPos maze 'G'
canMove :: [String] -> Pos -> Bool
canMove maze (x,y) | maze !! y !! x == '*' = False
| otherwise = True
enableSteps :: [String] -> [Pos] -> [Pos]
enableSteps maze path@((x,y):_) = filter (canMove maze) [(x-1,y),(x+1,y),(x,y-1),(x,y+1)]
getAllPaths :: [String] -> Pos -> [Path]
getAllPaths maze start = [[start]] >>= toward
where
toward :: Path -> [Path]
toward path
| not.null $ moves = map (:path) moves >>= toward
| otherwise = [path]
where
moves = enableSteps maze path
結局、リストモナドをどうつなげていったらいいのかというところでつまづいている。あと[String]っていう型じゃなくてMazeとかいう型にしといた方がよかったかも。
年末からイノベーションに関する本をいろいろ読んでいたのだけどその流れでたどり着いた。これは名著でしょう。年明け早々いい本にあえてラッキーだ。
創薬ではある種の論理に基づいて、化合物の探索、合成を行う事になるわけだが、それはいわゆる定量的構造活性相関解析(QSAR)、定量的物性構造相関解析(QSPR)さらには動態特性(QSPkR)というような構造(やその特性)と変換したいパラメータの関連性からある程度論理的に探索対象を決定していくのが主流だ。ただし、このようなやり方では、ある意味推測が容易な答えしか出さないことが多いし、正しい答えの出るであろう予測の範囲もごく限られてしまうことが多い。予測範囲以外のものをアウトライヤーと呼び、予測の範囲外としてしまうが、実際にはそういう化合物の答えが知りたかったりするので常に苦労する。
我々は帰納的な推論から出発して、その枠を限りなく広げていきたいのだが、それはなかなか難しいし、実際問題として帰納の枠のなかでは無理ではないかと考えている。局所的な予測モデルを束ねてより大きい問題に対応すればよいのではないかという考え方もあるのだけど、それは結局、問題を小さくしておいてわかることの中だけで理解するということなのであまり上手くいかない。さらに、新規性の高い化合物にジャンプする(いわゆるホッピング)というものはQSARのような帰納的な推論方法からでは成し遂げることは非常に難しい。(ファーマコフォア探索は前提条件決め打ちだからなぁ、、)
いろいろ考えるに、結局創薬においては、それぞれのプロジェクトで(尤もらしい)仮説を構築できる力というものが一番重要なのだろうと考えているのだけど、本書はそういった仮説構築の論理というものに対して、帰納や演繹との対比をしながら明確に述べているので、QSARの論理的な限界はどこら辺なのかとか、より良い仮説を出すためにはどういう思考サイクルをまわせばいいかとかのヒントが満載だ。
さて、本書では科学的方法には帰納法の他に仮説の提案が必要であり、仮説の提案なしには帰納法を正しく用いることは出来ないと述べていて、その通りだと思う。しかし一方で、仮説は検討中の問題の現象についてもっともらしい、もっとも理にかなった説明を与えるものでなくてはならないとあるように、確度の高い仮説を構築するためには、高い分析能力や論理力、数多くの解析方法やマイニング方法への知識があってはじめて仮説提案力が高まるのだろうなと思うのだ。
21章は短い
Real World Haskell―実戦で学ぶ関数型言語プログラミングHDBC-2.1.0だと下のようなエラーがずらずらでるのでgitで入れる。
Database/HDBC/SqlValue.hs:585:9:
Duplicate instance declarations:
instance Typeable Day
-- Defined at Database/HDBC/SqlValue.hs:585:9-20
instance Typeable Day
-- Defined in time-1.1.4:Data.Time.Calendar.Days
使ってみる
Prelude> :m Database.HDBC Database.HDBC.Sqlite3
Prelude Database.HDBC Database.HDBC.Sqlite3> conn <- connectSqlite3 "drkcore.db"
Prelude Database.HDBC Database.HDBC.Sqlite3> getTables conn
["entries","entry_tags","roles","tags","user_roles","users"]
Prelude Database.HDBC Database.HDBC.Sqlite3> \
quickQuery' conn "select title from entries where pubdate > '2010-01-01'" []
[[SqlByteString "\229\155\155\229\173\163\230\161\156\227\129\174\232\138\ ...
これをutf8で出力したいのでWIKIも読んどく。
13012010 Python
A*で解いてみた。距離はマンハッタン使った。
maze = ["**************************",
"*S* * *",
"* * * * ************* *",
"* * * ************ *",
"* * *",
"************** ***********",
"* *",
"** ***********************",
"* * G *",
"* * *********** * *",
"* * ******* * *",
"* * *",
"**************************"]
start = ()
goal = ()
max = len(maze) + len(maze[0])
for (h,line) in enumerate(maze):
for (w,word) in enumerate(line):
if word == 'S': start = (h,w)
elif word == 'G': goal = (h,w)
checked = [start]
sol = [start]
def add_route(r):
(h,w) = r[-1]
cand = [c for c in [(h+1,w),(h-1,w),(h,w+1),(h,w-1)] if c not in checked and not_wall(c)]
if len(cand) == 0:
return r[:-1]
else:
sol = (); cost = max
for c in cand:
c_cost = calc_cost(c)
if c_cost < cost:
cost = c_cost
sol = c
r.append(sol)
checked.append(sol)
return r
def not_wall(p): (h,w) = p; return maze[h][w] != '*'
def calc_cost(p): return (abs(goal[0]-p[0]) + abs(goal[1]-p[1]))
def check_goal(sol): return sol[-1] != goal
def draw_sol(sol):
solved_maze = ''
for (h,line) in enumerate(maze):
for (w,word) in enumerate(line):
if (h,w) in sol[1:-1]:
solved_maze += '$'
else:
solved_maze += word
solved_maze += '\n'
return solved_maze
while check_goal(sol): sol = add_route(sol)
print draw_sol(sol)
実行結果
$ python maze_aster.py
**************************
*S* * $$$ *
*$* *$$*$ ************* *
*$* $$* $ ************ *
*$$$$* $$$$$$$ *
**************$***********
* $$$$$$$$$$$$$ *
**$***********************
* $$$$$*$$$$$$$$$$$$$$G *
* * $$$ *********** * *
* * ******* * *
* * *
**************************
13012010 Python
この問題。
maze = ["**************************",
"*S* * *",
"* * * * ************* *",
"* * * ************ *",
"* * *",
"************** ***********",
"* *",
"** ***********************",
"* * G *",
"* * *********** * *",
"* * ******* * *",
"* * *",
"**************************"]
solution = []
start = ()
goal = ()
max = (len(maze)-2) * (len(maze[0])-2)
for (h,line) in enumerate(maze):
for (w,word) in enumerate(line):
if word == 'S': start = (h,w)
elif word == 'G': goal = (h,w)
checked = [start]
def add_route(sols):
newroute = []
for sol in sols:
(h,w) = sol[-1]
if ((h+1,w) not in checked) and maze[h+1][w] != '*':
nr = list(sol)
nr.append((h+1,w))
checked.append((h+1,w))
newroute.append(nr)
if ((h-1,w) not in checked) and maze[h-1][w] != '*':
nr = list(sol)
nr.append((h-1,w))
checked.append((h-1,w))
newroute.append(nr)
if ((h,w+1) not in checked) and maze[h][w+1] != '*':
nr = list(sol)
nr.append((h,w+1))
checked.append((h,w+1))
newroute.append(nr)
if ((h,w-1) not in checked) and maze[h][w-1] != '*':
nr = list(sol)
nr.append((h,w-1))
checked.append((h,w-1))
newroute.append(nr)
return newroute
def check_goal(sols):
for sol in sols:
if sol[-1] == goal:
print draw_sol(sol)
exit
def draw_sol(sol):
solved_maze = ''
for (h,line) in enumerate(maze):
for (w,word) in enumerate(line):
if (h,w) in sol[1:-1]:
solved_maze += '$'
else:
solved_maze += word
solved_maze += '\n'
return solved_maze
sols = [[start]]
for i in range(max):
sols = add_route(sols)
check_goal(sols)
ちょっと長い
$ python maze.py
**************************
*S* *$$$$ *
*$* *$ *$ ************* *
*$*$$$* $ ************ *
*$$$ * $$$$$$$ *
**************$***********
* $$$$$$$$$$$$$ *
**$***********************
* $$$ *$$$$$$$$$$$$$$G *
* *$$$$$ *********** * *
* * ******* * *
* * *
**************************
ダイクストラ法とA*アルゴリズムの違いをあとで読む
13012010 Haskell
20.5はパイプ
Real World Haskell―実戦で学ぶ関数型言語プログラミング理解はあやしいがとりあえず写経して動くとこまで。
*RunProcessSimple> runIO $ "ls /Users/kzfm/haskell" -|- "grep '.hs~'" -|- "tr a-z A-Z"
BARCODE.HS~
LOGGER.HS~
PNM.HS~
PARSE.HS~
RANDOM.HS~
RUNPROCESSSIMPLE.HS~
12012010 life
散文的なのでサラッと読んだというか眺めたというか。
アイデアスポッティングとは、『探索+関連づけ』のことである。
12012010 chemoinformatics DMPK
新しい本が出るらしい。
Evaluation of Drug Candidates for Preclinical Development: Pharmacokinetics, Metabolism, Pharmaceutics, and Toxicology (Wiley Series in Drug Discovery and Development)Evaluation of Drug Candidates for Preclinical Development serves as an introductory reference for those new to the pharmaceutical industry and drug discovery in particular. It is especially well suited for scientists and management teams in small- to mid-sized pharmaceutical companies, as well as academic researchers and graduate students concerned with the practical aspects related to the evaluation of drug developability.