2013年6月30日日曜日

LIBLINEARをubuntuで試してみた

ここからLIBLINEARのライブラリを取得し、展開する


terminalを起動し、展開したフォルダーに移動しmakeを行う

./train heart_scale で辞書を作成

......*
optimization finished, #iter = 69
Objective value = -121.097755
nSV = 195

./predict heart_scale heart_scale.model res

で作成した辞書に元のデータで試してみる
Accuracy = 84.4444% (228/270)


デフォルト設定だと今ひとつの精度である

./train でHelpが表示される

Usage: train [options] training_set_file [model_file]
options:
-s type : set type of solver (default 1)
  for multi-class classification
0 -- L2-regularized logistic regression (primal)
1 -- L2-regularized L2-loss support vector classification (dual)
2 -- L2-regularized L2-loss support vector classification (primal)
3 -- L2-regularized L1-loss support vector classification (dual)
4 -- support vector classification by Crammer and Singer
5 -- L1-regularized L2-loss support vector classification
6 -- L1-regularized logistic regression
7 -- L2-regularized logistic regression (dual)
  for regression
11 -- L2-regularized L2-loss support vector regression (primal)
12 -- L2-regularized L2-loss support vector regression (dual)
13 -- L2-regularized L1-loss support vector regression (dual)
-c cost : set the parameter C (default 1)
-p epsilon : set the epsilon in loss function of SVR (default 0.1)
-e epsilon : set tolerance of termination criterion
-s 0 and 2
|f'(w)|_2 <= eps*min(pos,neg)/l*|f'(w0)|_2,
where f is the primal function and pos/neg are # of
positive/negative data (default 0.01)
-s 11
|f'(w)|_2 <= eps*|f'(w0)|_2 (default 0.001)
-s 1, 3, 4, and 7
Dual maximal violation <= eps; similar to libsvm (default 0.1)
-s 5 and 6
|f'(w)|_1 <= eps*min(pos,neg)/l*|f'(w0)|_1,
where f is the primal function (default 0.01)
-s 12 and 13
|f'(alpha)|_1 <= eps |f'(alpha0)|,
where f is the dual function (default 0.1)
-B bias : if bias >= 0, instance x becomes [x; bias]; if < 0, no bias term added (default -1)
-wi weight: weights adjust the parameter C of different classes (see README for details)
-v n: n-fold cross validation mode
-q : quiet mode (no outputs)

2013年6月18日火曜日

raspberry pi にリモート接続

ssh pi@192.168.1.?

でリモートログイン


ファイル転送用にFileZillaをインストール

サイトマネージャを使用してraspberry 接続用の設定を作成
プロトコルにSFPTを選択する

raspberry piにつなげたキーボードの設定がおかしいので設定が間違っているようだ

raspberry piの設定

最新版をここから取得
http://www.raspberrypi.org/downloads

zipを展開して、空の4GのSDカードを準備

sudo dd bs=4M if=2013-05-25-wheezy-raspbian.img of=/dev/sdb

でSDカードにイメージの書き込み

2013年6月11日火曜日

ubuntuでのOpenCVのファイルをコンパイルしてみた

g++ -o $1.out $1 -I/usr/local/include/opencv2 -I/usr/local/include/opencv -L/usr/local/lib -lopencv_highgui -lopencv_core

を記したシェルスクリプトを作成し、コマンドラインで

./open.sh hoge.cpp

とすると hoge.cpp.outファイルが作成される

開発環境が今ひとつなので、Windowsでソースを作っておき、動作しているソースをコンパイルしたほうが簡単そうである。

いずれ大きなものをコンパイルするには、makeの書き方を覚えないといけない