필터 지우기
필터 지우기

Systems of double class cannot be used with the "predict" command.???

조회 수: 5 (최근 30일)
hello there... i am new to svm. i got error while using "predict" as..... "Systems of double class cannot be used with the "predict" command. Convert the system to an identified model first, such as by using the "idss" command." i tried "idss" and i am getting error .. "The number of inputs and outputs of the model must match that of the data." What exactly should be done to avoid this issue? kindly help me
Thanks in advance.
  댓글 수: 2
Walter Roberson
Walter Roberson 2016년 7월 15일
Please show your test code.
anumala udayeni
anumala udayeni 2016년 7월 18일
편집: Walter Roberson 2016년 7월 18일
clc;
clear all;
close all;
filename='D:\forensics\csv dataset\dset3o-1.csv';
s=csvread(filename);
labels = s(:, 1); % labels from the 1st column
features =s(:, 2);
features_sparse = sparse(features);
Mi=max(features_sparse);
sf=(features_sparse)/(Mi);
libsvmwrite('D:/featuress.train', labels, sf);
[train_labels, train_features] =libsvmread('D:/featuress.train');
svmstruct=svmtrain(train_labels, train_features,'kernel_function','rbf','RBF_sigma',8,'Boxconstraint',90.5097);
d = 0.02;
[x1Grid,x2Grid] = meshgrid(min(train_features(:,1)):d:max(train_features(:,1)),...
min(train_features(:,1)):d:max(train_features(:,1)));
xGrid = [x1Grid(:),x2Grid(:)];
Mi2=max(features);
sf2=(features)/(Mi);
sys=idss(svmstruct);
[~,scores] = predict(sys,sf2);

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2016년 7월 18일
You are calling svmtrain to create svmstruct . That structure will be an SVMStruct, described by svmtrain() documentation
You are calling idss() passing in a single parameter, svmstruct . According to http://www.mathworks.com/help/ident/ref/idss.html#inputarg_sys0 when you call idss() with only one parameter, that parameter must be:
"Any dynamic system to convert to an idss model:
  • When sys0 is an identified model, its estimated parameter covariance is lost during conversion. If you want to translate the estimated parameter covariance during the conversion, use translatecov.
  • When sys0 is a numeric (non-identified) model, the state-space data of sys0 define the A, B, C, and D matrices of the converted model. The disturbance matrix K is fixed to zero. The NoiseVariance value defaults to eye(Ny), where Ny is the number of outputs of sys."
The description of Dynamic Models at http://www.mathworks.com/help/ident/ug/dynamic-system-models.html lists routines that can produce identified models. All of those routines start with the two characters 'id'. You do not call any routines that start with 'id' so you are not creating any identified model. The routines that produce numeric models are tf, zpk, ss, frd, pid, pidstd, pid2, and pidstd2. You are not calling any of those. We must conclude that svmstruct is not an appropriate input to use for idss if you are passing only one parameter.
  댓글 수: 2
Walter Roberson
Walter Roberson 2016년 7월 18일
It looks to me as if the root difficulty is that you tried to use predict() on the svm model, instead of using svmpredict() . And then you noticed that predict() required a Control Systems model such as built by idss() so you tried to use idss to convert the svm model to something usable by predict. When what you should have done is skipped idss and used svmpredict
anumala udayeni
anumala udayeni 2016년 7월 19일
thank you
i resolved it.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Transfer Function Models에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by