OpenCV n fold_cross_validation - eiichiromomma/CVMLAB GitHub Wiki

(OpenCV) n-fold Cross Validation

OpenCV 機械学習で交差確認(n-fold Cross Validation)を行なう。C++の継承の復習ついでに作ってみたら便利だったので公開。

CrossVal class

概要

CrossValが基底となり、継承によりRandom TreesとSupport Vector MachineとNeural Networkについて交差確認が行なえるように作った。

他の機械学習についても仮想関数をオーバーライドすれば実装可能(な筈)。

大した事は行なっていないのでソースを読めば分かると思う。

前提

  • Classificationのみ対象として作成
  • Regressionについては各クラスのprintとCrossVal::classifier()の結果の評価方法に手を加える必要がある
  • responsesは0から始まる
  • 途中で面倒になってきたので実装は汚ない
  • スペルミスや文法間違いは御愛嬌

使い方

共通事項

  • 特徴量、responsesについては通常の機械学習と同様に作成
  • CvTermCriteriaおよび各分類器のクラスを作成しておく
  • 最後の引数はfold数ではなく、1回のfoldに使うサンプル数
  • 結果はtestについての正誤テーブルと全体の正答率を表示

流れ

  1. CvTermCriteria作成
  2. 分類器作成
  3. 該当するCrossValの派生クラス作成
  4. classfier()呼び出し

Random Treesの場合

コンストラクタは

CrossValRTrees(CvRTreesへのポインタ, データへのポインタ, responsesへのポインタ, CvTermCriteria, CvRTParams, foldに使うサンプル数)

となり下のような使い方となる。

CvTermCriteria ctc = cvTermCriteria(CV_TERMCRIT_ITER,30,0.01);
CvRTrees* rt = new CvRTrees();
CrossValRTrees* cvrt = new CrossValRTrees(rt, data, responses, ctc,CvRTParams(15, 2, 0, false, data->cols, 0, false, 8, ctc.max_iter, ctc.epsilon, ctc.type),2000);
cvrt->classifier();

この場合、20,000件のdataに対して2,000個ごとのfoldとなり10-foldとなる。(以下同様)

MLP (Neural Network)の場合

コンストラクタは

CrossValMLP(CvANN_MLPへのポインタ, データへのポインタ, responsesへのポインタ, layer_sizes, CvANN_MLP_TrainParams, ニューロンの関数, foldに使うサンプル数)

となり下のような使い方となる。

CvTermCriteria ctc = cvTermCriteria(CV_TERMCRIT_ITER,300,0.1);
CvANN_MLP* m = new CvANN_MLP();
int layer_sz[] = { data->cols, 50, class_count };
CvMat layer_sizes = cvMat( 1, (int)(sizeof(layer_sz)/sizeof(layer_sz[0])), CV_32S, layer_sz );
CvANN_MLP_TrainParams tr_params = CvANN_MLP_TrainParams(ctc,CvANN_MLP_TrainParams::RPROP,0.3);
CrossValMLP* cvmlp = new CrossValMLP(m,data,responses,&layer_sizes,tr_params,CvANN_MLP::SIGMOID_SYM,4000);
  cvmlp->classifier();

Support Vector Machineの場合

コンストラクタは

CrossValSvm(CvSVMへのポインタ, データへのポインタ, responsesへのポインタ, CvSVMParams, foldに使うサンプル数)

となり下のような使い方となる。

CvTermCriteria ctc = cvTermCriteria(CV_TERMCRIT_ITER,100,0.001);
CvSVM* s = new CvSVM();
CrossValSvm* cvsvm = new CrossValSvm(s,data, responses, 
  CvSVMParams(CvSVM::NU_SVC, CvSVM::RBF, 0.0, 0.1, 0.0, 0.0, 0.2, 0.0,NULL,ctc),4000);
cvsvm->classifier();

サンプル

sampleで配布されているletter_recog.cppへ適用。 letter_recog.cpp、myCrossVal.cpp、myCrossVal.h、letter-recognition.dataを同一フォルダに置き、Windowsの場合はdata以外をプロジェクトに加えてビルド。

Linux等の場合はMakefileでそれぞれコンパイルさせてリンクさせる。(動作未確認)

試行錯誤する方法としてSTLのlistを使ってみた。これも実装は汚ない。

配布ファイル

以下各結果

Random Treesの場合 その1

Training classifier: 1
Cross Validation: classifier 1
test1/10: Trees :23
Recognition Rate: train= 97.4%, test= 92.8%
Training classifier: 2
Cross Validation: classifier 2
test2/10: Trees :24
Recognition Rate: train= 97.4%, test= 92.3%
Training classifier: 3
Cross Validation: classifier 3
test3/10: Trees :19
Recognition Rate: train= 97.2%, test= 92.5%
Training classifier: 4
Cross Validation: classifier 4
test4/10: Trees :24
Recognition Rate: train= 97.2%, test= 93.4%
Training classifier: 5
Cross Validation: classifier 5
test5/10: Trees :22
Recognition Rate: train= 97.5%, test= 92.6%
Training classifier: 6
Cross Validation: classifier 6
test6/10: Trees :23
Recognition Rate: train= 97.5%, test= 93.2%
Training classifier: 7
Cross Validation: classifier 7
test7/10: Trees :20
Recognition Rate: train= 97.5%, test= 92.3%
Training classifier: 8
Cross Validation: classifier 8
test8/10: Trees :24
Recognition Rate: train= 97.3%, test= 92.0%
Training classifier: 9
Cross Validation: classifier 9
test9/10: Trees :25
Recognition Rate: train= 96.8%, test= 92.5%
Training classifier: 10
Cross Validation: classifier 10
test10/10: Trees :22
Recognition Rate: train= 97.4%, test= 92.0%
=======================Random Trees==========================
2000/20000CV,max_iter=30,epsilon=0.010000,max_depth=15,min_sample_count=2,max_categories=16,nactive_
vars=8,max_tree_count=30,forest_accuracy=0.010000,termcrit_type=1,
Number of Contents:789,766,736,805,768,775,773,734,755,747,739,761,792,783,753,803,783,758,748,796,813,764,752,787,786,734,
 767    1    2    2    1    0    1    1    0    0    1    1    0    1    1    0    0    1    3    0   0    0    0    1    5    0
   0  726    0    3    3    1    4    3    0    0    2    0    0    0    0    0    1   14    3    1   1    0    0    3    1    0
   0    0  683    0   16    1   16    1    0    0    2    2    0    0    7    0    4    1    0    0   1    0    1    1    0    0
   0    9    0  759    1    0    1   16    0    1    1    0    0    4    4    0    3    4    1    0   0    0    0    1    0    0
   0    3    4    0  722    3   13    0    0    0    2    2    0    0    0    0    4    0    5    0   0    0    0    6    0    4
   0   18    1    4    3  718    2    2    1    0    1    0    1    1    0    9    0    0    2    6   0    0    1    1    4    0
   1   14    4   10    9    5  696    4    0    2    0    0    2    0    3    1    7    3    5    0   2    0    1    4    0    0
   1   37    1   25    1    2    9  582    0    0   19    0    0    0   10    4    0   30    2    1   4    1    0    1    3    1
   0   13    0    4    2    7    1    0  689   10    0    1    0    0    1    5    1    1    5    2   0    0    0    9    0    4
   2    8    0    7    3    2    0    4   13  663    3    2    0    2    4    1    3    0   11    1   0    0    0   14    1    3
   1    3    0    5    4    0    4   25    0    0  657    0    1    0    0    0    0   23    2    0   3    0    0   11    0    0
   0    6    1    0   11    1   12    3    0    0    3  703    0    0    0    0    5    7    4    0   0    0    0    5    0    0
   4    6    0    0    2    0    6    1    0    0    2    0  763    4    0    0    1    0    0    0   0    0    3    0    0    0
   1    8    0   10    0    0    1    9    0    0    0    1    6  722   11    0    0    7    0    0   3    3    1    0    0    0
   0   16    2   19    0    0    4    2    0    1    0    0    0    0  678    3   13    6    1    0   4    1    0    3    0    0
   0   10    0    4    3   30    7    2    1    0    0    1    0    1    2  736    1    1    0    1   0    0    0    1    2    0
   0   11    0    3    1    0    4    1    1    0    0    1    0    0   22    1  727    4    2    0   0    0    2    0    2    1
   0   27    0    7    0    1    1    0    0    0    9    1    1    3    1    0    0  706    0    0   0    0    0    1    0    0
   1   26    0    2    7    7    4    4    0    1    0    1    0    0    0    0    5    4  679    0   0    0    0    3    0    4
   1    3    2    3    3    6    7    1    0    0    5    1    0    0    0    0    0    5    7  743   0    1    0    2    5    1
   2    6    0    2    0    0    3    7    0    1    0    0    6    9    8    0    0    0    1    0 766    2    0    0    0    0
   0   29    0    0    1    1    2    0    0    0    0    0    1    1    3    1    1    3    0    0   1  711    5    0    4    0
   0    1    0    0    0    0    1    3    0    0    0    0    7    1    3    0    1    1    0    0   3    0  731    0    0    0
   0   12    0    3    7    3    0    6    2    0    9    1    0    0    1    0    0    3    1    0   0    0    0  739    0    0
   0    1    0    4    0    0    0    0    0    0    0    0    3    1    1    1    1    0    1    6   2    6    0    1  758    0
   0    3    0    8    9    1    1    0    1    1    0    1    0    0    0    0    8    2    8    1   0    0    0    1    0  689
Total Recognition rate: train = 97.3%, test = 92.6%

Random Treesの場合 その2

Training classifier: 1
Cross Validation: classifier 1
test1/10: Trees :17
Recognition Rate: train= 97.5%, test= 92.4%
Training classifier: 2
Cross Validation: classifier 2
test2/10: Trees :23
Recognition Rate: train= 97.2%, test= 91.3%
Training classifier: 3
Cross Validation: classifier 3
test3/10: Trees :21
Recognition Rate: train= 97.1%, test= 92.0%
Training classifier: 4
Cross Validation: classifier 4
test4/10: Trees :21
Recognition Rate: train= 97.6%, test= 92.3%
Training classifier: 5
Cross Validation: classifier 5
test5/10: Trees :26
Recognition Rate: train= 97.1%, test= 93.0%
Training classifier: 6
Cross Validation: classifier 6
test6/10: Trees :24
Recognition Rate: train= 97.5%, test= 91.8%
Training classifier: 7
Cross Validation: classifier 7
test7/10: Trees :26
Recognition Rate: train= 97.0%, test= 92.4%
Training classifier: 8
Cross Validation: classifier 8
test8/10: Trees :21
Recognition Rate: train= 97.1%, test= 91.7%
Training classifier: 9
Cross Validation: classifier 9
test9/10: Trees :27
Recognition Rate: train= 97.3%, test= 92.1%
Training classifier: 10
Cross Validation: classifier 10
test10/10: Trees :19
Recognition Rate: train= 97.3%, test= 93.6%
=======================Random Trees==========================
2000/20000CV,max_iter=30,epsilon=0.010000,max_depth=15,min_sample_count=3,max_categories=16,nactive_
vars=8,max_tree_count=30,forest_accuracy=0.010000,termcrit_type=1,
Number of Contents:789,766,736,805,768,775,773,734,755,747,739,761,792,783,753,803,783,758,748,796,813,764,752,787,786,734,
 766    3    2    2    1    0    1    0    0    0    3    2    0    0    0    0    0    1    1    0   0    0    0    3    4    0
   0  723    0    1    3    1    4    3    0    0    0    0    0    0    2    2    0   19    4    0   0    2    0    2    0    0
   0    0  685    0   12    2   16    0    0    0    1    3    0    0    9    1    2    1    1    0   3    0    0    0    0    0
   0   15    0  745    1    0    1   12    2    0    1    0    0    4    7    2    1   12    0    0   0    0    0    1    0    1
   0    1    7    0  705    2   18    0    0    0    3    4    0    0    0    0    4    3    6    1   1    0    0    8    0    5
   0   21    0    6    5  708    0    2    1    1    0    0    0    1    0   16    0    1    4    6   0    0    1    1    1    0
   1   13    2   11    4    0  709    4    0    2    2    0    1    0    4    1    4    7    0    0   0    1    1    6    0    0
   1   26    1   28    3    0    8  582    0    0   23    0    1    0   12    4    2   36    2    0   2    0    0    2    1    0
   0   17    1    6    2   11    0    0  688    6    0    1    0    0    0    2    5    2    2    1   0    0    0    9    0    2
   0   14    0    2    4    7    0    6   10  674    1    0    0    0    1    0    3    4    8    0   1    0    0   10    1    1
   0    2    1    5    2    1    5   21    0    0  652    0    2    1    0    0    0   32    1    0   2    0    0   12    0    0
   0    7    2    0    9    1   11    1    0    0    2  702    0    0    2    2    2    7    3    0   0    0    0    9    0    1
   1    9    0    0    1    1    2    1    0    0    2    0  758    5    2    1    0    3    0    0   0    0    5    0    1    0
   1    5    0   14    0    1    0   10    0    0    0    0    7  717    6    0    0   15    0    0   1    3    1    2    0    0
   0   17    2   22    1    0    1    2    0    0    0    0    1    1  669    2   11   13    2    0   4    0    0    5    0    0
   0   10    0    2    8   30    3    3    0    1    1    0    0    0    2  733    0    2    0    1   0    1    3    1    2    0
   1    9    0    7    2    0    7    0    1    0    0    1    0    0   21    2  723    4    1    0   1    1    0    0    0    2
   0   31    0    6    1    0    1    3    0    0    9    0    1    3    0    1    0  698    1    0   0    1    0    2    0    0
   1   22    0    1   11    5    4    5    0    2    0    2    0    0    1    1    2    4  672    1   0    0    0    6    1    7
   0    3    6    2    1    7    3    1    0    0    8    1    0    0    1    0    1    1    4  752   0    1    0    0    4    0
   0    2    2    2    0    0    1    8    0    0    2    0   10    6   12    0    2    0    0    0 765    0    1    0    0    0
   1   24    1    1    0    1    2    2    0    0    0    0    1    0    3    4    0    3    0    0   2  708    5    0    6    0
   0    3    0    0    0    0    1    1    0    0    0    0    4    0    7    1    1    1    0    0   4    1  727    0    1    0
   0    7    0    5    9    2    0    3    0    1    7    1    0    0    1    0    0    0    1    0   0    0    0  750    0    0
   0    4    2    2    0    0    1    1    0    0    0    0    0    0    0    1    3    0    2    8   3    6    4    1  748    0
   1    1    0    4    8    0    0    0    0    6    0    1    0    0    0    0    9    3    7    1   0    0    0    1    0  692

Total Recognition rate: train = 97.3%, test = 92.3%

Support Vector Machineの場合 その1

Training classifier: 1
Cross Validation: classifier 1
test1/10: 9359 SupportVectors,Recognition Rate: train= 99.6%, test= 97.4%
Training classifier: 2
Cross Validation: classifier 2
test2/10: 9336 SupportVectors,Recognition Rate: train= 99.7%, test= 97.0%
Training classifier: 3
Cross Validation: classifier 3
test3/10: 9312 SupportVectors,Recognition Rate: train= 99.7%, test= 97.0%
Training classifier: 4
Cross Validation: classifier 4
test4/10: 9310 SupportVectors,Recognition Rate: train= 99.7%, test= 97.4%
Training classifier: 5
Cross Validation: classifier 5
test5/10: 9352 SupportVectors,Recognition Rate: train= 99.7%, test= 97.5%
Training classifier: 6
Cross Validation: classifier 6
test6/10: 9383 SupportVectors,Recognition Rate: train= 99.7%, test= 97.7%
Training classifier: 7
Cross Validation: classifier 7
test7/10: 9315 SupportVectors,Recognition Rate: train= 99.7%, test= 97.0%
Training classifier: 8
Cross Validation: classifier 8
test8/10: 9370 SupportVectors,Recognition Rate: train= 99.6%, test= 97.4%
Training classifier: 9
Cross Validation: classifier 9
test9/10: 9332 SupportVectors,Recognition Rate: train= 99.7%, test= 97.2%
Training classifier: 10
Cross Validation: classifier 10
test10/10: 9344 SupportVectors,Recognition Rate: train= 99.7%, test= 96.7%
=================Supoprt Vector Machine=======================
NU_SVC,RBF,2000/20000CV,max_iter=300,epsilon=0.001000,gamma=0.100000,nu=0.200000,
Number of Contents:789,766,736,805,768,775,773,734,755,747,739,761,792,783,753,803,783,758,748,796,813,764,752,787,786,734,
 784    0    2    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0   0    0    0    0    3    0
   0  745    0    3    2    0    0    3    0    0    0    0    1    0    0    0    0    5    1    0   1    4    0    1    0    0
   0    0  712    0    7    0    3    1    0    0    0    1    2    0    7    0    0    0    0    1   0    1    1    0    0    0
   1    1    0  782    0    0    0    9    0    0    0    0    2    5    5    0    0    0    0    0   0    0    0    0    0    0
   0    3    1    0  748    1    4    0    0    0    0    3    0    0    0    1    2    0    0    0   0    0    0    0    0    5
   0    1    0    1    2  747    0    1    0    2    0    0    0    0    0   13    0    0    0    6   0    1    0    1    0    0
   0    1    3   10    6    0  747    0    0    0    0    0    1    0    1    0    0    0    1    0   0    1    2    0    0    0
   0    3    1   19    1    0    6  679    0    1   10    0    1    0    1    0    0   10    0    0   2    0    0    0    0    0
   0    0    1    0    0    3    0    0  719   29    0    0    0    1    0    1    0    0    0    0   0    0    0    1    0    0
   0    0    0    2    0    1    0    2   21  716    0    0    0    2    1    0    1    0    0    0   1    0    0    0    0    0
   0    0    0    2    0    0    0   10    0    0  705    0    0    0    0    0    0   13    0    0   1    0    0    8    0    0
   0    1    0    0    4    0    2    3    0    1    0  745    1    0    0    0    0    2    0    0   0    0    0    2    0    0
   0    5    0    0    0    0    2    0    0    0    0    0  782    0    0    0    0    0    0    0   1    1    1    0    0    0
   0    1    0    4    0    0    0    3    0    0    0    0    5  758    6    0    0    5    0    0   0    1    0    0    0    0
   0    1    4    8    0    0    0    0    0    0    0    0    4    0  729    0    3    0    0    0   1    0    3    0    0    0
   0    2    0    0    1   17    0    1    0    0    0    1    0    0    0  774    4    0    0    0   0    0    1    0    2    0
   1    0    0    1    0    0    0    0    0    0    0    0    3    0    5    3  769    1    0    0   0    0    0    0    0    0
   0   14    0    0    0    0    0    5    0    0    8    0    0    5    0    0    2  724    0    0   0    0    0    0    0    0
   0    1    0    1    1    1    0    0    0    0    0    0    0    0    0    0    0    1  743    0   0    0    0    0    0    0
   0    1    2    4    0    0    0    1    0    0    0    0    0    0    0    1    0    1    0  779   0    1    0    1    5    0
   1    0    0    0    0    0    0    3    0    0    0    0    3    0    0    0    0    0    0    0 805    1    0    0    0    0
   0   17    0    0    0    2    1    0    0    0    0    0    2    1    0    2    0    0    0    0   0  737    1    0    1    0
   0    0    0    0    0    0    1    0    0    0    0    0    5    0    1    0    0    0    0    0   1    0  744    0    0    0
   0    0    0    3    3    0    0    0    0    0    4    0    1    0    2    0    1    1    0    1   0    0    0  770    1    0
   0    1    0    0    0    0    0    0    0    0    0    0    1    0    0    0    0    0    0    1   1    0    1    1  780    0
   0    0    0    0    1    0    0    0    0    0    0    0    4    0    0    0    7    0    0    0   0    0    0    0    0  722

Total Recognition rate: train = 99.7%, test = 97.2%

Support Vector Machineの場合 その2

Training classifier: 1
Cross Validation: classifier 1
test1/10: 9320 SupportVectors,Recognition Rate: train= 97.3%, test= 74.6%
Training classifier: 2
Cross Validation: classifier 2
test2/10: 9280 SupportVectors,Recognition Rate: train= 98.7%, test= 75.8%
Training classifier: 3
Cross Validation: classifier 3
test3/10: 9332 SupportVectors,Recognition Rate: train= 97.8%, test= 73.0%
Training classifier: 4
Cross Validation: classifier 4
test4/10: 9253 SupportVectors,Recognition Rate: train= 98.3%, test= 77.3%
Training classifier: 5
Cross Validation: classifier 5
test5/10: 9299 SupportVectors,Recognition Rate: train= 96.3%, test= 73.0%
Training classifier: 6
Cross Validation: classifier 6
test6/10: 9327 SupportVectors,Recognition Rate: train= 98.9%, test= 77.4%
Training classifier: 7
Cross Validation: classifier 7
test7/10: 9356 SupportVectors,Recognition Rate: train= 99.7%, test= 78.5%
Training classifier: 8
Cross Validation: classifier 8
test8/10: 9308 SupportVectors,Recognition Rate: train= 99.4%, test= 77.6%
Training classifier: 9
Cross Validation: classifier 9
test9/10: 9352 SupportVectors,Recognition Rate: train= 98.8%, test= 78.0%
Training classifier: 10
Cross Validation: classifier 10
test10/10: 9303 SupportVectors,Recognition Rate: train= 98.4%, test= 75.4%
=================Supoprt Vector Machine=======================
C_SVC,RBF,2000/20000CV,max_iter=300,epsilon=0.001000,gamma=3.000000,C=1000.000000,
Number of Contents:789,766,736,805,768,775,773,734,755,747,739,761,792,783,753,803,783,758,748,796,813,764,752,787,786,734,
 661    0    0    0    0    0    0    0    0    0   43    0   27    0    0   58    0    0    0    0   0    0    0    0    0    0
   0  599    0    1    1    0    0    1    0    1   34    0   51    0    0   57    0    9    1    0   0   10    0    1    0    0
   0    0  596    0    1    0    1    0    0    0   40    0   42    0    0   55    0    0    0    1   0    0    0    0    0    0
   0    1    0  646    0    0    0    8    0    0   41    0   38    2    2   64    0    2    0    0   0    0    0    0    1    0
   0    1    4    0  589    0    6    1    0    0   61    3   42    0    0   59    0    0    0    0   0    0    0    1    0    1
   0    0    0    0    0  591    0    0    0    1   41    0   42    0    0   95    0    0    1    3   0    0    0    0    1    0
   0    1    3    2    4    0  581    0    0    0   56    0   55    0    0   68    2    0    0    0   0    0    1    0    0    0
   0    6    0   13    2    0    3  468    0    1   82    0   56    5    2   90    0    5    0    0   1    0    0    0    0    0
   0    0    0    0    0    1    0    0  569   28   42    0   55    0    0   60    0    0    0    0   0    0    0    0    0    0
   0    0    0    0    0    0    0    1    2  596   34    0   45    1    0   68    0    0    0    0   0    0    0    0    0    0
   0    1    0    0    4    0    0   13    0    0  626    0   38    0    0   46    0    5    0    0   0    0    0    6    0    0
   0    0    0    0    3    0    0    0    0    2   53  593   53    0    0   57    0    0    0    0   0    0    0    0    0    0
   0    1    0    0    0    0    0    0    0    0   40    0  701    0    0   48    0    0    0    0   0    2    0    0    0    0
   0    0    0    4    0    0    0    1    0    0   38    0   66  610    1   58    0    4    0    0   0    1    0    0    0    0
   0    0    2    9    0    0    0    2    0    0   55    0   71    6  524   72   10    0    0    0   2    0    0    0    0    0
   0    0    0    0    0   22    0    0    0    0  131    0  133    0    0  515    2    0    0    0   0    0    0    0    0    0
   0    0    1    0    0    0    2    0    0    0   85    0   33    0    8  121  532    0    0    0   0    0    0    0    0    1
   0    5    0    2    0    0    0    5    0    0   52    1   45    4    0   81    0  562    1    0   0    0    0    0    0    0
   0    1    0    0    1    0    0    0    0    0   39    0   47    0    0   62    0    0  598    0   0    0    0    0    0    0
   0    0    3    0    0    7    0    0    0    0   54    0   27    0    0   52    0    0    0  643   0    1    0    1    8    0
   0    0    0    0    0    0    0    2    0    0   32    0   44    1    0   58    0    0    0    0 675    0    0    0    1    0
   0    5    0    0    0    0    0    0    0    0   51    0   58    1    0   80    0    0    0    0   0  566    1    0    2    0
   0    0    0    0    0    0    0    0    0    0   48    0   54    0    0   65    0    0    0    0   0    0  585    0    0    0
   0    0    0    0    5    0    0    1    0    0   96    0   44    0    0   94    0    0    0    0   0    0    0  547    0    0
   0    0    0    0    0    0    0    0    0    0   37    0   99    0    0  127    0    0    0   17   1    6    0    0  499    0
   0    0    0    0    4    0    0    0    0    0   58    0   54    0    0   73    0    0    1    0   0    0    0    0    0  544

Neural Networkの場合 その1

Training classifier: 1
Cross Validation: classifier 1
test1/5: 3 Layers,Recognition Rate: train= 85.2%, test= 83.0%
Training classifier: 2
Cross Validation: classifier 2
test2/5: 3 Layers,Recognition Rate: train= 83.1%, test= 81.2%
Training classifier: 3
Cross Validation: classifier 3
test3/5: 3 Layers,Recognition Rate: train= 85.9%, test= 84.2%
Training classifier: 4
Cross Validation: classifier 4
test4/5: 3 Layers,Recognition Rate: train= 85.8%, test= 84.9%
Training classifier: 5
Cross Validation: classifier 5
test5/5: 3 Layers,Recognition Rate: train= 86.9%, test= 86.1%
Layer = {16, 50, 26, }
Number of Contents:789,766,736,805,768,775,773,734,755,747,739,761,792,783,753,803,783,758,748,796,813,764,752,787,786,734,
 721    1    0    1    0    4    3    2    0    6    8    4    6    4    1    1    0    3    2    0  12    3    1    3    2    1
   2  692    0    8    9    2    4    8    0    1    4    0    0    0    0    0    0   18    8    1   3    0    0    6    0    0
   1    3  591    1   34    1   19   10    0    0   28    2    0    1   14    0    5    3    2    0  15    0    0    4    2    0
   0   14    0  726    1    2    3    7    1    0    5    2    2    6   11    1    0    7    4    1   7    0    0    5    0    0
   0    5    5    1  668    5   23    0    1    0   10    1    0    0    0    0    7    0   19    1   0    0    0   14    0    8
   0   14    0    6   11  659    1    0    7    7    0    0    0    1    1   20    0    5   19   11   0    2    2    6    2    1
   2   22   18    5   28    7  544    2    0    0   16    1    3    2   34    8   34   15   11    0   9    0    0   10    1    1
  26   15    0   35   13   23   11  290    0    7   73    7    3   36   52   15    8   52    8    1  26    6    1   21    5    0
   0    7    0   13    1   15    1    0  665    8    1    0    0    0    2    6    1    2   22    0   0    0    0    9    0    2
   3    4    0    2    4   30    0    3   12  635    0    0    0    2    7    0    2    3   15    0   3    0    0   18    1    3
   4    5    4    4   12    1    2    8    0    0  631    0    2    3    3    0    0   23    5    0   1    0    0   31    0    0
   1   10    0    0   20    2   18    4    0    0    3  656    0    1    0    0    3    9   10    0   5    0    0   16    2    1
  68   13    0    4    1    0    2    3    0    0    2    0  668    9    5    0    0    5    2    0   3    0    7    0    0    0
  27    5    0   19    0   13    0   37    0    0    1    0    5  606   23    1    0   14    1    3  13    6    8    1    0    0
   4    0    4   14    0    0    9    3    0    3    1    0    2    3  650    4   14   15    4    0   8    0   13    2    0    0
   1   10    0    5    1   26   13    1    2    1    2    0    0    0    7  711    8    1    3    0   0    1    1    0    9    0
  11   12    0    7   14    0   16    0    5    0    7    5    0    0   20    0  646    8   14    0   1    0    2    1    0   14
   7   36    0   13    4    7    7    5    0    0   21    2    3   10    1    1    3  625    6    0   5    0    0    2    0    0
   3   25    5    6   26   20    5    0   15    7    3    3    0    1    3    1    7   11  542    6   2    1    0   23    5   28
   0   14    0    6   19    3    8   10    0    0    5    1    0    0    2    2    4    5    8  673   8    4    0    9    7    8
   2    8    1    2    0    0    1    6    0    2    3    0   12    4    9    0    0    2    0    0 759    1    1    0    0    0
   0   20    0    3    3    4   11    1    0    0    2    0    0    1    8    2    0    3    2    1   2  680   11    0   10    0
   8   15    0    1    2    1    3    2    0    0    1    0    5    5   17    0    4    6    0    1   8    3  669    1    0    0
   0    6    0    8   14    2    0    0    0    1   13    0    0    0    5    1    0    2    3    2   1    0    0  722    6    1
   2    4    0    2    0    4    3    5    0    1    1    0    0    1    3   11   11    0    4    8   7   11    2    3  698    5
   4    0    0    5   12    4    1    0    2    3    0   10    0    0    1    0    3    4   27    2   1    0    0    7    1  647

Total Recognition rate: train = 85.4%, test = 83.9%

Neural Networkの場合 その2

Training classifier: 1
Cross Validation: classifier 1
test1/5: 4 Layers,Recognition Rate: train= 85.8%, test= 84.6%
Training classifier: 2
Cross Validation: classifier 2
test2/5: 4 Layers,Recognition Rate: train= 88.1%, test= 86.3%
Training classifier: 3
Cross Validation: classifier 3
test3/5: 4 Layers,Recognition Rate: train= 86.5%, test= 84.6%
Training classifier: 4
Cross Validation: classifier 4
test4/5: 4 Layers,Recognition Rate: train= 87.4%, test= 84.9%
Training classifier: 5
Cross Validation: classifier 5
test5/5: 4 Layers,Recognition Rate: train= 86.8%, test= 84.2%
Layer = {16, 25, 25, 26, }
Number of Contents:789,766,736,805,768,775,773,734,755,747,739,761,792,783,753,803,783,758,748,796,813,764,752,787,786,734,
 704    3    0    5    0    4    0    2    0    3    7    2    2    3    3    1    3   10    8    0   9    3    3    5    5    4
   0  658    0   15    2    1    3    2    0    0    5    3    0    0    6    1    3   44   12    0   0    1    0    8    1    1
   3    0  592    0   26    4   25   13    0    2   21    3    3    3   11    0    9    2    2    1  11    1    1    3    0    0
   2    9    1  723    1    3    0   13    0    0    1    0    3    6    8    2    1   16    7    0   6    0    0    1    1    1
   0    7    9    0  646   10   25    2    1    1    9    9    1    0    0    0   11    6    7    0   1    0    0   13    0   10
   0   13    5    4   20  633    3    7    2    3    0    1    1    3    0   24    0    4   22   12   0    4    2    5    6    1
   3    7   16    7    8    4  579    7    2    3   15    6    1    1   20    6   20   17   16    0   5   12    1   11    1    5
   3   17    5   29    1    8    7  523    0    1   29    5    2   15   16    4    8   34    0    1   6    7    0    6    6    1
   1    3    3   10    6   14    0    0  657    6    0    3    0    0    2    6    0    0   17    1   0    0    0   16    4    6
   6    1    0   10    4   18    0    4   10  599    2    3    0    2    3    6    2    6   20    2   4    0    0   23    3   19
   2    5    1    7    9    2    5   19    0    2  603    1    2    8    1    0    0   37    1    2   1    4    2   24    1    0
   0    6    4    1   24    1   15    5    1    1    8  650    0    0    0    0    2    7   10    1   7    0    0   15    2    1
   1   14    0    0    0    0    8    3    0    0    0    3  727   20    2    0    0    7    0    0   4    0    3    0    0    0
   5    6    1   12    0    1    1   16    0    1    2    0    7  685   16    5    0   14    0    0   1    2    6    1    1    0
   2    3    3   23    0    0    6    7    0    2    4    1    2   12  621    3   21   16    5    0   2    6   13    1    0    0
   1    9    0    2    3   35    7    1    2    0    4    1    1    0    3  708    6    6    3    1   0    1    1    0    8    0
   3   15    1    4    8    0   10    0    2    0    2    4    1    1   31    0  652    3   16    0   3    5    2    3    4   13
   5   37    0   12    2    0    6   21    0    0   15    2    1    6    3    0    2  634    0    0   1    1    0    8    2    0
   3   39    1    8   14   13    4    0    4    4    0    2    0    0    6    0    5    5  599    3   2    1    0    9    5   21
   0    7    1    4   14    7    6   12    0    0    7    9    0    0    3    2    8    5   17  653   3    4    0   16    8   10
   1    4    4    0    0    1    3   15    0    0    2    2   11    5    7    1    6    4    0    0 736    2    6    3    0    0
   0   20    0    0    0    0    4    4    0    1    0    0    2    3    2    5    2    7    1    0   0  690   12    1   10    0
   2    8    0    0    0    0    4    5    0    1    0    0    8   17    8    0    0    8    0    0   7    7  677    0    0    0
   0    6    1    8   16    3    2    5    0    1   11    1    0    0    1    0    2    3   18    4   1    0    0  692    7    5
   1    4    1    5    0    8    0    3    0    0    0    6    2    2    1   12    9    2    5   12   6   13    1    4  687    2
   4    3    0    6   16    1    0    1    0    1    0    2    0    0    0    0    5    2   33    1   0    0    0    7    2  650

Total Recognition rate: train = 86.9%, test = 84.9%