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

📄 lssvcb_predict.m

📁 The goal of SPID is to provide the user with tools capable to simulate, preprocess, process and clas
💻 M
字号:
function [Y_class, Y_probp, ytst0, varztstp, varztstn] = lssvcB_predict(X_test, model, prior)
% function [Y_class, Y_probp, ytst0, varztstp, varztstn] = lssvcB_predict(X_test, model, prior)
% Make classification predictions with the LSSVM Bayesian classifier.
% Input:
% X_test: Test data matrix of dim (num test examples, num features) (without standardization).
% model : Classifier.
% prior : [pin, pip], vector with prior class probability for class - and - respectively, 
%         default are the proptions of the - and + samples in the training set
%
% Return:
% Y_class: +-1 predictions on the test data of dim (num test example).
% Y_probp: Posterior probability for class +.
% ytst0: the latent output
% varztstp: the samplewise variance associated with the output w.r.t class +
% varztstn: the samplewise variance associated with the output w.r.t. class -

% Jan 2006 -- chuanl@gmail.com

if model.needstd
    nv = size(X_test, 2);
    for i=1:nv
        X_test(:,i)=(X_test(:,i)-model.meanp(i))/model.stdp(i);
    end,
end

lssvcB=model; clear model; 
[ytst0, varztstp, varztstn] = lssvcBout(X_test, lssvcB);

zmp=lssvcB.zmp; zmn=lssvcB.zmn; zetap=lssvcB.zetap; zetan=lssvcB.zetan;
if exist('prior')
    if length(prior)>1
       pin=prior(1); pip=prior(2); 
    else
       prpn=prior; 
       pip=prpn/(1+prpn); pin=1/(1+prpn);
    end
else
    pin=lssvcB.pin; pip=lssvcB.pip; 
end

[classtst, Pyptst, Pyntst] = lssvcBclass(ytst0, zmp, zmn, varztstp, varztstn, zetap, zetan, pip, pin);
Y_score=Pyptst-0.5; 
Y_class=sign(Y_score); 
Y_probp=Pyptst;

return,

⌨️ 快捷键说明

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