Username Remember Me?
Password   forgot password?
   
   
a question about regression. 
Posted: 14 August 2009 02:30 PM   [ Ignore ]  
Newbie
Rank
Total Posts:  2
Joined  2009-08-14

I am new for prtools, I am trying use prtools for regression analysis, but the codes shown as follow can not be run correctly, please tell me what is wrong, thanks!

a=dataset([2333411 4723.97 5105138 1978195 5366;…
2575911 4552.03 4953038 1823332 6192; ...
3718427 4436.03 7770971 1711326 6944; ...
4713368 4758.87 9118844 1548581 7582; ...
5102903 5197.33 5598079 1501252 8349; ...
5537553 5560.31 3637681 1462364 9133; ...
6310271 6611.78 2717925 1431940 10528; ...
7936776 6976.65 3907711 1396138 13373]);
a.targets=[35554725;40904753;46342420;58603258;68922066;84587418;106522163;125334211];
a.labtype=’targets’;
w2b = a*svmr([],0.01,’r’,2);
plotr(w2b,’r--’);
fprintf(’svm regression : %f\n’, b*w2b*testr);

while running the code, Matlab gives follow error information

Welcome to PRTools, version 4.1.5 (30-Jul-2009).
This version of PRTools is valid for non-commercial academic use only.
See http://prtools.org/ for more information.

Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 1.067212e-017.
> In D:\software\svm\prtools_ac\prtools\linearr.m at line 45
In D:\software\svm\prtools_ac\prtools\map.m at line 199
In D:\software\svm\prtools_ac\prtools\@mapping\mtimes.p at line 15
In D:\ql\paper\matlab-program\mysvr.m at line 25
??? Error using ==> plot
Vectors must be the same lengths.

Error in ==> D:\software\svm\prtools_ac\prtools\scatterr.m
On line 27 ==> h = plot(+x(:,1),y,clrs);

Error in ==> D:\ql\paper\matlab-program\mysvr.m
On line 38 ==> scatterr(a);

Profile
 
 
Posted: 14 August 2009 11:54 PM   [ Ignore ]   [ # 1 ]  
Moderator
RankRankRankRank
Total Posts:  250
Joined  2008-11-08

I tried to run your code, but encountered several problems:

1. The routine svmr was not consistent with the most recent changes in PRTools.
I have changed it. I hope it is OK now. Please get the new version from the web site.

2. Please do not directly use the dataset fields like a.targets and a.labtype directly.
It is highly recommended to use the corresponding getxxxx routines:

a = setlabtype(a,’targets’)
a = settargets(a,targets)

as additional addministration as to be set. With the most recent PRTools and the above
definition of the dataset, the svmr() call works fine for me with the linear kernel:
w = a*svm([],0.01,’p’,1).

3. I didn’t manage to get other kernels working. If you give +w2b you will see the
computed coefficients and often b = NaN, with indicates a failure for the SVM.
Please contact the author of the svmr routine (David Tax) for more information.

4. As the dataset is multidimensional it cannot be plotted by plotr. Moreover it is
better to make a scatterplot first, e.g. scatterr(a(:,1)) to see the first dimension.

Bob Duin

Profile
 
 
Posted: 16 August 2009 07:14 AM   [ Ignore ]   [ # 2 ]  
Newbie
Rank
Total Posts:  2
Joined  2009-08-14

dear Bob Duin
Thanks very much! I will try it again.
Quan Liang

Profile