Warning: fopen(/data/htdocs/ibot/wpibot//wp-content/plugins/latex/cache/tex_4a8a08f09d37b73795649038408b5f33.gif): failed to open stream: Permission denied in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
123
Warning: fputs() expects parameter 1 to be resource, bool given in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
124
Warning: fclose() expects parameter 1 to be resource, bool given in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
126
Warning: getimagesize(/data/htdocs/ibot/wpibot//wp-content/plugins/latex/cache/tex_4a8a08f09d37b73795649038408b5f33.gif): failed to open stream: No such file or directory in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
129
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
47
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
49
Warning: fopen(/data/htdocs/ibot/wpibot//wp-content/plugins/latex/cache/tex_9dd4e461268c8034f5c8564e155c67a6.gif): failed to open stream: Permission denied in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
123
Warning: fputs() expects parameter 1 to be resource, bool given in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
124
Warning: fclose() expects parameter 1 to be resource, bool given in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
126
Warning: getimagesize(/data/htdocs/ibot/wpibot//wp-content/plugins/latex/cache/tex_9dd4e461268c8034f5c8564e155c67a6.gif): failed to open stream: No such file or directory in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
129
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
47
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
49
Warning: fopen(/data/htdocs/ibot/wpibot//wp-content/plugins/latex/cache/tex_07e9818e2e436232f49e2703b287ce35.gif): failed to open stream: Permission denied in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
123
Warning: fputs() expects parameter 1 to be resource, bool given in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
124
Warning: fclose() expects parameter 1 to be resource, bool given in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
126
Warning: getimagesize(/data/htdocs/ibot/wpibot//wp-content/plugins/latex/cache/tex_07e9818e2e436232f49e2703b287ce35.gif): failed to open stream: No such file or directory in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
129
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
47
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
49
Warning: fopen(/data/htdocs/ibot/wpibot//wp-content/plugins/latex/cache/tex_57a09c65e4fbee92189f9458f1146004.gif): failed to open stream: Permission denied in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
123
Warning: fputs() expects parameter 1 to be resource, bool given in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
124
Warning: fclose() expects parameter 1 to be resource, bool given in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
126
Warning: getimagesize(/data/htdocs/ibot/wpibot//wp-content/plugins/latex/cache/tex_57a09c65e4fbee92189f9458f1146004.gif): failed to open stream: No such file or directory in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
129
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
47
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
49
Warning: fopen(/data/htdocs/ibot/wpibot//wp-content/plugins/latex/cache/tex_c19f6b6a7bae1fd5b14f578c6edc3454.gif): failed to open stream: Permission denied in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
123
Warning: fputs() expects parameter 1 to be resource, bool given in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
124
Warning: fclose() expects parameter 1 to be resource, bool given in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
126
Warning: getimagesize(/data/htdocs/ibot/wpibot//wp-content/plugins/latex/cache/tex_c19f6b6a7bae1fd5b14f578c6edc3454.gif): failed to open stream: No such file or directory in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
129
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
47
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
49
Warning: fopen(/data/htdocs/ibot/wpibot//wp-content/plugins/latex/cache/tex_9dd4e461268c8034f5c8564e155c67a6.gif): failed to open stream: Permission denied in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
123
Warning: fputs() expects parameter 1 to be resource, bool given in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
124
Warning: fclose() expects parameter 1 to be resource, bool given in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
126
Warning: getimagesize(/data/htdocs/ibot/wpibot//wp-content/plugins/latex/cache/tex_9dd4e461268c8034f5c8564e155c67a6.gif): failed to open stream: No such file or directory in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
129
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
47
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
49
Warning: fopen(/data/htdocs/ibot/wpibot//wp-content/plugins/latex/cache/tex_025b3f94d79319f2067156076bf05243.gif): failed to open stream: Permission denied in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
123
Warning: fputs() expects parameter 1 to be resource, bool given in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
124
Warning: fclose() expects parameter 1 to be resource, bool given in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
126
Warning: getimagesize(/data/htdocs/ibot/wpibot//wp-content/plugins/latex/cache/tex_025b3f94d79319f2067156076bf05243.gif): failed to open stream: No such file or directory in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
129
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
47
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in
/data/htdocs/ibot/wpibot/wp-content/plugins/latex/latex.php on line
49
Naive Bayes Classifierでは、MNISTの正解率が84%にとどまったと言うことで、多変量ベルヌーイ分布の共分散を考慮したモデルで試みようとしたが、プログラミングの制約が大きくうまくいっていない。
そこで、こちらのサイトで紹介されている、ピクセル間の相関を多変量正規分布の相関で表現したモデルに注目した。プログラムも提示されているので、自分でもやってみたところ、MNISTの手書き文字認識で、なんと94%の正解率に到達した。ディープラーニングのパフォーマンスに肉薄している。計算では、このプログラム用のMNISTデータが見当たらなかったので、プログラムに合うようにフォーマットを整えたことくらいで、あとは普通に動いた。
理論的には、ある文字ラベルのもとで、ピクセルベクトルが生じる確率が、次のような多変量正規分布で表されるという前提になっている。
ベイズ定理から、
となる。は、ラベルに依存せず共通なので、結局右辺の分母の値を標本(事前学習データ)から求めて、左辺、すなわち、ピクセルベクトルが与えられた元での、出現確率が最大となる数字ラベルを求めれば良いわけである。実際の計算では、順序は変わらないので、右辺の対数をとったもので比較している。
ぱっと見、上の多変量正規分布の計算は、共分散行列の逆数を求めるというのが深刻な壁のように感じるが、プログラムでは、pythonの科学計算ライブラリで簡単に処理してしまっている。驚いた。何しろこのサイトの、pythonで書かれたプログラムは、ライブラリを巧妙に使っていて、超短く、効率的で、何しろ早い。
MNISTデータは、訓練用60000個あるが、プログラムでは、教育用に5000個、テスト用に5000個使っているだけである。それで、94%の正解率なのだが、これを例えば30000個を教育用に使っても、成果率は94%から上昇しない。つまり、5000個で、文字の特徴を捉えてしまっているのだ。悪く言えば、そこまでの分類器でしかないと言うこともできるが、それにしても94%という正解率、および、その使いやすさは、とてつもなく優れているというべきだ。
このサイトのプログラマーさんのすごさもある。あまりにプログラムが短い、すなわち、全く無駄がない。それによって、改めて、pythonというプログラミングの優秀さを感じた。私は大体、JavaとC++をメインにしているのだが、これからはpythonを本格的に使っていきたい。
ツールとしては、これ以上のものは望めない。自然言語の方に戻ろう。