This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//HANSEIとはprobabilistic programmingを行うためのtaglessなインタプリタのこと。 | |
//確率モデルをプログラムの形で書くとパラメータの推論を自動で行なってくれる。 | |
//oleg氏の論文だとreify/reflectを使ったdirect styleのモナドで記述されている。 | |
//http://okmij.org/ftp/kakuritu | |
//要はこちらのスライドで紹介されているものをmonadやHOASを使って内部DSLとして実装したもの。 | |
//http://www.slideshare.net/tsubosaka/infernetlda | |
//こちらの方の記事も参考になる。 | |
//http://d.hatena.ne.jp/rst76/20100706/1278430517 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//こちらのプログラムを移植してみた。解説も詳しくて勉強になる。 | |
//http://d.hatena.ne.jp/aidiary/20100613/1276389337 | |
object NaiveBayes { | |
type Category = String | |
type Word = String | |
case class Data(category: Category, words: List[Word]) | |
def train(data: List[Data]) = new NBClassifier(data) |
OlderNewer