2 added 1 character in body edited Mar 23 '16 at 19:49 AlessioX 27911 gold badge22 silver badges1616 bronze badges Assuming X is the matrix of new data points (size m x n where each row is an example), you can tackle the problem by considering several kernel. if your kernel is linear (i.e. dot product) The predicted labels can be easily evaluated by p = X * model.w + model.b; where model.w is an array containing the free parameters of the hyperplane and model.b is the bias. if your kernel is RBF (i.e. Gaussian) % square and sum new data points by rows X1 = sum(X.^2, 2); % square and sum SVs X2 = sum(model.SV.^2, 2)'; % evaluate exponential for RBF formula K = bsxfun(@plus, X1, bsxfun(@plus, X2, - 2 * X * model.SV')); % evaluate kernel K = model.kernelFunction(1, 0) .^ K; % multiply Gram matrix by SV labels K = bsxfun(@times, model.SVL', K); % multiply again by alphas K = bsxfun(@times, model.alphas', K); % gather final predictions p = sum(K, 2);  where model.alphas is the Lagrange Multiplier vectors, model.kernelFunction() is the kernel function, model.SV are the Support Vectors and model.SVL are the Support Vectors Labels 3. for an arbitrary kernel, apply the standard rule: or an arbitrary kernel, apply the standard rule: for i = 1:m prediction = 0; for j = 1:size(model.SV, 1) prediction = prediction + model.alphas(j) * model.SVL(j) * model.kernelFunction(X(i,:)', model.SV(j,:)'); end p(i) = prediction + model.b; end  After all that you might want to shrink the predicted labels vector p in a friendly binary format: predictedLabels(p >= 0) = 1; predictedLabels(p < 0) = 0;  and predictedLabels is now your final output. Assuming X is the matrix of new data points (size m x n where each row is an example), you can tackle the problem by considering several kernel. if your kernel is linear (i.e. dot product) The predicted labels can be easily evaluated by p = X * model.w + model.b; where model.w is an array containing the free parameters of the hyperplane and model.b is the bias. if your kernel is RBF (i.e. Gaussian) % square and sum new data points by rows X1 = sum(X.^2, 2); % square and sum SVs X2 = sum(model.SV.^2, 2)'; % evaluate exponential for RBF formula K = bsxfun(@plus, X1, bsxfun(@plus, X2, - 2 * X * model.SV')); % evaluate kernel K = model.kernelFunction(1, 0) .^ K; % multiply Gram matrix by SV labels K = bsxfun(@times, model.SVL', K); % multiply again by alphas K = bsxfun(@times, model.alphas', K); % gather final predictions p = sum(K, 2);  where model.alphas is the Lagrange Multiplier vectors, model.kernelFunction() is the kernel function, model.SV are the Support Vectors and model.SVL are the Support Vectors Labels 3. for an arbitrary kernel, apply the standard rule: for i = 1:m prediction = 0; for j = 1:size(model.SV, 1) prediction = prediction + model.alphas(j) * model.SVL(j) * model.kernelFunction(X(i,:)', model.SV(j,:)'); end p(i) = prediction + model.b; end  After all that you might want to shrink the predicted labels vector p in a friendly binary format: predictedLabels(p >= 0) = 1; predictedLabels(p < 0) = 0;  and predictedLabels is now your final output. Assuming X is the matrix of new data points (size m x n where each row is an example), you can tackle the problem by considering several kernel. if your kernel is linear (i.e. dot product) The predicted labels can be easily evaluated by p = X * model.w + model.b; where model.w is an array containing the free parameters of the hyperplane and model.b is the bias. if your kernel is RBF (i.e. Gaussian) % square and sum new data points by rows X1 = sum(X.^2, 2); % square and sum SVs X2 = sum(model.SV.^2, 2)'; % evaluate exponential for RBF formula K = bsxfun(@plus, X1, bsxfun(@plus, X2, - 2 * X * model.SV')); % evaluate kernel K = model.kernelFunction(1, 0) .^ K; % multiply Gram matrix by SV labels K = bsxfun(@times, model.SVL', K); % multiply again by alphas K = bsxfun(@times, model.alphas', K); % gather final predictions p = sum(K, 2);  where model.alphas is the Lagrange Multiplier vectors, model.kernelFunction() is the kernel function, model.SV are the Support Vectors and model.SVL are the Support Vectors Labels or an arbitrary kernel, apply the standard rule: for i = 1:m prediction = 0; for j = 1:size(model.SV, 1) prediction = prediction + model.alphas(j) * model.SVL(j) * model.kernelFunction(X(i,:)', model.SV(j,:)'); end p(i) = prediction + model.b; end  After all that you might want to shrink the predicted labels vector p in a friendly binary format: predictedLabels(p >= 0) = 1; predictedLabels(p < 0) = 0;  and predictedLabels is now your final output. 1 answered Mar 23 '16 at 19:04 AlessioX 27911 gold badge22 silver badges1616 bronze badges Assuming X is the matrix of new data points (size m x n where each row is an example), you can tackle the problem by considering several kernel. if your kernel is linear (i.e. dot product) The predicted labels can be easily evaluated by p = X * model.w + model.b; where model.w is an array containing the free parameters of the hyperplane and model.b is the bias. if your kernel is RBF (i.e. Gaussian) % square and sum new data points by rows X1 = sum(X.^2, 2); % square and sum SVs X2 = sum(model.SV.^2, 2)'; % evaluate exponential for RBF formula K = bsxfun(@plus, X1, bsxfun(@plus, X2, - 2 * X * model.SV')); % evaluate kernel K = model.kernelFunction(1, 0) .^ K; % multiply Gram matrix by SV labels K = bsxfun(@times, model.SVL', K); % multiply again by alphas K = bsxfun(@times, model.alphas', K); % gather final predictions p = sum(K, 2);  where model.alphas is the Lagrange Multiplier vectors, model.kernelFunction() is the kernel function, model.SV are the Support Vectors and model.SVL are the Support Vectors Labels 3. for an arbitrary kernel, apply the standard rule: for i = 1:m prediction = 0; for j = 1:size(model.SV, 1) prediction = prediction + model.alphas(j) * model.SVL(j) * model.kernelFunction(X(i,:)', model.SV(j,:)'); end p(i) = prediction + model.b; end  After all that you might want to shrink the predicted labels vector p in a friendly binary format: predictedLabels(p >= 0) = 1; predictedLabels(p < 0) = 0;  and predictedLabels is now your final output.