⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 determine_alpha1.m

📁 核方法&svm是模式识别是很重要的方法
💻 M
字号:
function [ alpha1,alpha1_index,success ] = determine_alpha1( Y,mat_kernel,alpha,not_alpha1_index,b,C,littleValue )%UNTITLED1 Summary of this function goes here%  Detailed explanation goes heresuccess = 0;sup_index = find(alpha>littleValue & alpha<C-littleValue);length_not = length(not_alpha1_index);if length_not~=0    for i = 1:length_not        sup_index(sup_index==not_alpha1_index(i)) = [];    endendif ~isempty(sup_index)    sub_value = abs((Y(sup_index,1).*(mat_kernel(sup_index,:)*(alpha.*Y)+b))-1);    [max_sub,sub_index] = max(sub_value);    if max_sub > littleValue         alpha1_index = sup_index(sub_index);        alpha1 = alpha(alpha1_index);    else        zero_index = find(alpha >= 0 & alpha <= littleValue);        if length_not~=0            for i = 1:length_not                zero_index(zero_index==not_alpha1_index(i)) = [];            end        end        zero_value = Y(zero_index,1).*(mat_kernel(zero_index,:)*(alpha.*Y)+b);        zero_value_index = find(zero_value < 1-littleValue);        if ~isempty(zero_value_index)            alpha1_index = zero_index(zero_value_index(1,1));            alpha1 = alpha(alpha1_index);        else            C_index = find(alpha >= C-littleValue & alpha <= C);            if length_not~=0                for i = 1:length_not                    C_index(C_index==not_alpha1_index(i)) = [];                end            end            C_value = Y(C_index,1).*(mat_kernel(C_index,:)*(alpha.*Y)+b);            C_value_index = find(C_value > 1+littleValue);            if ~isempty(C_value_index)                alpha1_index = C_index(C_value_index(1,1));                alpha1 = alpha(alpha1_index);            else                success = 1;                alpha1_index=[];                alpha1=[];            end        end    endelse    zero_index = find(alpha >= 0 & alpha <= littleValue);    if length_not~=0        for i = 1:length_not            zero_index(zero_index==not_alpha1_index(i)) = [];        end    end    zero_value = Y(zero_index,1).*(mat_kernel(zero_index,:)*(alpha.*Y)+b);    zero_value_index = find(zero_value < 1);    if ~isempty(zero_value_index)        alpha1_index = zero_index(zero_value_index(1,1));        alpha1 = alpha(alpha1_index);    else        C_index = find(alpha >= C-littleValue & alpha <= C);        if length_not~=0            for i = 1:length_not                C_index(C_index==not_alpha1_index(i)) = [];            end        end        C_value = Y(C_index,1).*(mat_kernel(C_index,:)*(alpha.*Y)+b);        C_value_index = find(C_value > 1);        alpha1_index = C_index(C_value_index(1,1));        alpha1 = alpha(alpha1_index);    endend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -