www.pudn.com > kernelSVM.rar > determine_alpha1.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 here
success = 0;

sup_index = find(alpha>littleValue & alpha 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
    end
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);
    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);
    end
end