📄 svm_params_window_commands.m
字号:
function svm_params_window_commands(param)
h = findobj('Tag','Main');
h1 = findobj(h,'Tag', 'txtAlgorithmParameters');
SVM_vect = str2num(get(h1,'String'));
switch param,
case 'Kernel_options'
hLabel = findobj(gcbf, 'Tag', 'KernelLabel');
hBox = findobj(gcbf, 'Tag', 'KernelParameter');
all_kernel = get(hLabel,'String');
kernel = char(all_kernel(get(hLabel,'Value')));
switch kernel,
case 'Linear'
SVM_vect(7) = 0;
set(hBox,'String','');
case 'Polynomial'
SVM_vect(7) = 1;
set(hBox,'String',num2str(SVM_vect([8,10,11])));
case 'Radial'
SVM_vect(7) = 2;
temp = 1/sqrt(2*SVM_vect(9));
set(hBox,'String',num2str(temp));
case 'Sigmoid'
SVM_vect(7) = 3;
set(hBox,'String',num2str(SVM_vect([10,11])));
case 'User Defined'
SVM_vect(7) = 4;
set(hBox,'String',num2str(SVM_vect(12)));
end
case 'Kernel_options_change'
hLabel = findobj(gcbf, 'Tag', 'KernelLabel');
hBox = findobj(gcbf, 'Tag', 'KernelParameter');
all_kernel = get(hLabel,'String');
kernel = char(all_kernel(get(hLabel,'Value')));
switch kernel,
case 'Polynomial'
SVM_vect([8,10,11]) = str2num(get(hBox,'String'));
case 'Radial'
temp = 1 / (2 * str2num(get(hBox,'String'))^2);
SVM_vect(9) = temp ;
case 'Sigmoid'
SVM_vect([10,11]) = str2num(get(hBox,'String'));
case 'User Defined'
SVM_vect(12) = str2num(get(hBox,'String'));
end
case 'Learning_options'
hLabel = findobj(gcbf, 'Tag', 'LearningLabel');
hBox = findobj(gcbf, 'Tag', 'LearningParameter');
all_learning = get(hLabel,'String');
learning = char(all_learning(get(hLabel,'Value')));
switch learning,
case 'Trade-off between training error and margin '
set(hBox,'String',num2str(SVM_vect(2)));
case 'Cost-factor'
set(hBox,'String',num2str(SVM_vect(3)));
case 'Use biased hyperplane [0,1]'
set(hBox,'String',num2str(SVM_vect(4)));
case 'Remove inconsistent training examples [0,1]'
set(hBox,'String',num2str(SVM_vect(5)));
end
case 'Learning_options_change'
hLabel = findobj(gcbf, 'Tag', 'LearningLabel');
hBox = findobj(gcbf, 'Tag', 'LearningParameter');
all_learning = get(hLabel,'String');
learning = char(all_learning(get(hLabel,'Value')));
switch learning,
case 'Trade-off between training error and margin '
SVM_vect(2) = str2num(get(hBox,'String'));
case 'Cost-factor'
SVM_vect(3) = str2num(get(hBox,'String'));
case 'Use biased hyperplane [0,1]'
tmp = str2num(get(hBox,'String'));
if (tmp == 0) | (tmp == 1)
SVM_vect(4) = tmp;
else
error('Value Out of Range');
end
case 'Remove inconsistent training examples [0,1]'
tmp = str2num(get(hBox,'String'));
if (tmp == 0) | (tmp == 1)
SVM_vect(5) = tmp;
else
error('Value Out of Range');
end
end
case 'General_options'
hLabel = findobj(gcbf, 'Tag', 'GeneralLabel');
hBox = findobj(gcbf, 'Tag', 'GeneralParameter');
all_general = get(hLabel,'String');
general = char(all_general(get(hLabel,'Value')));
switch general,
case 'Verbosity Level'
set(hBox,'String',num2str(SVM_vect(1)));
case 'Rate of unlabeled examples'
set(hBox,'String',num2str(SVM_vect(6)));
case 'Maximum size of QP-subproblems [2..400]'
set(hBox,'String',num2str(SVM_vect(13)));
case 'Size of cache for kernel evaluations in MB [5...]'
set(hBox,'String',num2str(SVM_vect(14)));
case 'Error for termination criterion'
set(hBox,'String',num2str(SVM_vect(15)));
case 'Number of iterations [5..]'
set(hBox,'String',num2str(SVM_vect(16)));
case 'Do final optimality check [0,1]'
set(hBox,'String',num2str(SVM_vect(17)));
otherwise
error('Program does not support this option');
end
case 'General_options_change'
hLabel = findobj(gcbf, 'Tag', 'GeneralLabel');
hBox = findobj(gcbf, 'Tag', 'GeneralParameter');
all_general = get(hLabel,'String');
general = char(all_general(get(hLabel,'Value')));
switch general,
case 'Verbosity Level'
tmp = str2num(get(hBox,'String'));
if (tmp >= 0) & (tmp <= 3)
SVM_vect(1) = tmp;
else
error('Value Out of Range');
end
case 'Rate of unlabeled examples'
tmp = str2num(get(hBox,'String'));
if (tmp >= 0) & (tmp <= 1)
SVM_vect(6) = tmp;
else
error('Value Out of Range');
end
case 'Maximum size of QP-subproblems [2..400]'
tmp = str2num(get(hBox,'String'));
if (tmp >= 2) & (tmp <= 400)
SVM_vect(13) = tmp;
else
error('Value Out of Range');
end
case 'Size of cache for kernel evaluations in MB [5...]'
tmp = str2num(get(hBox,'String'));
if tmp >= 5
SVM_vect(14) = tmp;
else
error('Value Out of Range');
end
case 'Error for termination criterion'
SVM_vect(15) = str2num(get(hBox,'String'));
case 'Number of iterations [5..]'
tmp = str2num(get(hBox,'String'));
if tmp >= 5
SVM_vect(16) = tmp;
else
error('Value Out of Range');
end
case 'Do final optimality check [0,1]'
tmp = str2num(get(hBox,'String'));
if (tmp == 0) | (tmp == 1)
SVM_vect(17) = tmp;
else
error('Value Out of Range');
end
otherwise
error('Program does not support this option');
end
case 'Close'
set(h1,'String',num2str(SVM_vect));
close
otherwise
error('Option unknown');
end
set(h1,'String',num2str(SVM_vect));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -