Libsvm is a small library for support vector machines written in C. here is the link to the source of libsvm I've used ( https://github.com/cjlin1/libsvm ). Can someone correct the options in the svmtrain() function or label matrix in the following code to perform regression successfully, since the output says optimization finished with #0 iteration.
The goal of the code before svmtrain() function is to arrange water pixels of an underwater color image (some rect in image) into an (m x 3) matrix as data. The label matrix is an ( m x 1 ) vector preset to 1;{ here is the link to the underwater image, equation of red channel compensation }
the output:
optimization finished, #iter = 0
nu = 0.000000
obj = 0.000000, rho = -1.000000
nSV = 0, nBSV = 0
here is the code:
##to load image package
pkg load image
## add the path to the matlab folder inside the LIBSVM package source
addpath('./libsvm-master/libsvm-master/matlab')
##load libsvm
pkg load statistics
##load an under water rgb image
im = imread('9554.png');
im=double(im);
startrow=1;
startcol=1;
endrow=100;
endcol=100;
## save rgb pixels in m x 3 form
data=zeros(endrow*endcol,3,'double');
for i=startrow:endrow
for j=startcol:endcol
data((i-1)*endrow+j,1:3)=im(i,j,1:3);
end
end
## m x 1 label matrix, all preset to 1
label_data=ones(size(data,1),1,'double');
model=svmtrain(label_data,data,'-s 3 -c 1');
question from:
https://stackoverflow.com/questions/65868286/how-to-do-regression-using-svmtrain-function-in-libsvm-what-settings-what-i 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…