📄 sample1.m
字号:
function Sample1(index)
if nargin < 1, index = 1; end;
clear global preprocess;
switch index
case 1,
% Classify DataExample1.txt with shot information('-sh 1')
% Shuffle the data before classfication ('-sf 1')
% 3 folder Cross Validation
% Linear Kernel Support Vector Machine
test_classify(strcat('classify -t DataExample1.txt -sf 1 -sh 1', ...
' -- cross_validate -t 3 -- LibSVM -Kernel 0 -CostFactor 3'));
case 2,
% Classify DataExample1.txt with shot information('-sh 1')
% Shuffle the data before classfication ('-sf 1')
% Reduce the number of dimension to 15
% 3 folder Cross Validation
% 3 Nearest Negihbor
test_classify(strcat('classify -t DataExample1.txt -sf 1 -sh 1 -svd 15', ...
' -- cross_validate -t 3 -- kNN_classify -k 3'));
case 3,
% Classify DataExample2.txt with shot information('-sh 1')
% Do not shuffle the data
% Use first 100 data as training, the rest as testing
% Apply a multi-class classification wrapper
% RBF Kernel SVM_LIGHT Support Vector Machine
test_classify(strcat('classify -t DataExample2.txt -sf 0 -sh 1', ...
' -- train_test_validate -t 100 -- train_test_multiple_class -- SVM_LIGHT -Kernel 2 -KernelParam 0.01 -CostFactor 3'));
case 4,
% Train with DataExample2.train.txt, Test with DataExample2.test.txt
% Do not shuffle the data
% Use Weka provided C4.5 Decision Trees
% AdaBoostM1 Wrapper
% No Multi-class Wrapper for Weka
test_classify(strcat('classify -t DataExample2.train.txt -sf 0 -sh 1', ...
' -- test_file_validate -t DataExample2.test.txt -- MCAdaBoostM1 -- WekaClassify -NoWrapper -- trees.J48'));
case 5,
% Classify DataExample2.txt with shot information('-sh 1')
% Do not shuffle the data
% Rewrite the output file
% Use first 100 data as training, the rest as testing
% Apply a stacking classification wrapper, first learn three classifiers based on features (1..120), (121..150) and (154..225), then do majority voting on top
% Improved Iterative Scaling with 50 iterations
test_classify(strcat('classify -t DataExample2.txt -sf 0 -sh 1 -of w', ...
' -- train_test_validate -t 100 -- MCWithMultiFSet -Voting -Separator 1,120,121,150,154,225 -- IIS_classify -Iter 50'));
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -