Issues related to SVR in MATLAB - matlab

I am working on support vector regression for aerospace applications. I need to implement SVR in MATLAB. On the internet, I found this link, which gives detailed information with examples. When I try running the example codes in matlab, I am getting this error,
Error using classreg.learning.FitTemplate/fillIfNeeded (line 604)
OptimizeHyperparameters is not a valid parameter name.
Error in classreg.learning.FitTemplate.make (line 124)
temp = fillIfNeeded(temp,type);
Error in RegressionSVM.template (line 349)
temp = classreg.learning.FitTemplate.make('SVM','type','regression',varargin{:});
Error in RegressionSVM.fit (line 343)
temp = RegressionSVM.template(varargin{:});
Error in fitrsvm (line 235)
obj = RegressionSVM.fit(X,Y,varargin{:});
I am using MATLAB R2016a. Kindly let me know, how to solve this issue.

I had a similar issue today. Just upgrade Matlab to Matlab 2016b and it should work. Maybe it's a new parameter that they just introduced.

Related

MATLAB newbie: error using sprintf. Function is not defined for 'matlab.graphics.GraphicsPlaceholder' inputs

Today I tried to run a MATLAB m-file that someone gave me. It works fine for him, but I encountered a warning and errors (below). I am using a Mac with OS X Yosemite (10.10.5) and a new version of MATLAB (R2015b). The person who prepared the m-file would have used an older one and Windows.
From a blog at Mathworks and posts online/here, the error seems to be due to a MATLAB update--a change from using numeric values to point towards graphics objects to using objects themselves. I understand this in theory, but don't know how to fix my code (it has been years since I used MATLAB regularly, so I'm pretty lost).
Warning: Text handle output is not supported when a contour handle
argument is supplied and label placement is automatic.
In clabel (line 214)
In control_volume_20150706>plot_xxx (line 733)
In control_volume_20150706 (line 104)
In run (line 96)
Error using sprintf
Function is not defined for
'matlab.graphics.GraphicsPlaceholder' inputs.
Error in control_volume_20150706>plot_xxx (line 734)
sprintf('%10.4f \n',text_handle);
Error in control_volume_20150706 (line 104) plot_xxx (nr,
xwidevec, yhighvec, omegamat, psimat, umat, vmat, ...
Error in run (line 96) evalin('caller', [script ';']);
This is what the code looks like in the vicinity of line 733:
Line 731 contourlevels = omegamat(1, :) ;
Line 732 [C,h] = contour(X,
Y, flipud(omegamat), contourlevels, 'LineWidth', 2 );
Line 733
text_handle = clabel(C,h);
Line 734 sprintf('%10.4f \n',text_handle);
I would be very grateful for any hints about how to deal with this.
If h is a handle which refers to some object, then in R2015a and later this is the object itself, while in previous versions it's a double which points to an object (as you noted in the question). You can use h.double in R2015a and later to get what would previously be h. E.g., pre-R2015a h = figure(999) would set h to 999, a double; with R2015a and later h is an object and h.double is 999.

How to fix the Principle Component Analysis error in Matlab

I happened to a Matlab Problem, the error looks like this:
Error using pca
Too many input arguments.
Error in mdscale (line 413)
[~,score] = pca(Y,'Economy',false);
Error in demo_libsvm_test1 (line 140)
newCoor = mdscale(distanceMatrix,2);
When I debug my code step by step, the error comes from here:
distanceMatrix = pdist(heart_scale_inst,'euclidean'); (line 139)
newCoor = mdscale(distanceMatrix,2); (line 140)
Everything above the two lines are all right. I do not know how to fix the problem. I use Matlab 2014a. Can anyone give me a help?

SSIM Coding Error

I have some questions. I try to follow some coding from Mathworks:
I = imread('cameraman.tif');
ssimValues = zeros(1,10);
qualityFactor = 10:10:100;
for i = 1:10
imwrite(I,'compressedImage.jpg','jpg','quality',qualityFactor(i));
ssimValues(i) = ssim(imread('compressedImage.jpg'),I);
end
I just change the image file which is a.jpg and b.jpg but I get this error from MATLAB:
Undefined function 'ssim' for input arguments of type 'uint8'
Error in SSIMTesting (line 6)
ssimValues(i) = ssim(imread('logohalal1.jpg'),i);
Why is that ? Can someone help me explain the code and the error ? Sorry because I'm new in MATLAB.
Thank you.
MATLAB release notes for the Image Processing Toolbox shows that this function was new to R2014a. If you have an older version of MATLAB, or you don't have that toolbox, you don't have it. This sort of issue can be avoided by using only examples found in the help on your local installation of MATLAB rather than the online help.
To check your version of MATLAB and installed toolboxes, type ver at the command line.
To check if a function can be found on your MATLAB path, you can use which, e.g. which ssim

Error in profiler for Matlab 2014a

I use osx mavericks with 2014a. To get a crisp screen I have updated the JRE and done the fix to the help-menu as described in the answer from 17 May here http://www.mathworks.com/matlabcentral/answers/102946-why-does-the-matlab-desktop-look-blurry-when-using-matlab-8-2-r2013b-on-my-mac-with-retina-display
This includes following the instructions from Mathworks http://www.mathworks.com/support/bugreports/870843
Maybe that is the reason for the error below but it is not certain as I had never tried the profiler on 2014a before I did the fix.
The Error:
When I try to click any function to get a detailed profiler report I get the following error:
Error using flip
Too many input arguments.
Error in flipud (line 14)
x = flip(x,1);
Error in profview>makefilepage (line 723)
sortedDataList = flipud(sortedDataList);
Error in profview (line 70)
s = makefilepage(profileInfo,idx, busyLineSortKeyStr2Num(busyLineSortKey));
Do you have your own function called flip on your MATLAB path? There is a new function shipping with MATLAB called flip which the profiler is trying to use.
http://www.mathworks.com/help/matlab/ref/flip.html
Try which -all flip - if you have a version on there, try removing it to see if that fixes things.

adftest function error in lagmatrix

Using the adftest function in MATLAB's econometrics toolbox, I'm receiving the following error:
>> [h1,pVal1] = adftest(y1,'model','ARD')
Error using lagmatrix (line 25)
lagmatrix: wrong # of input arguments
Error in adftest>runReg (line 705)
yLags = lagmatrix(y,0:(testLags+1));
Error in adftest (line 417)
testReg = runReg(i,y,testT,testLags,testModel,needRegOut);
y1 is a <41x1> vector of doubles.
Has anyone received this error or have any thoughts on what the issue is? I am using this code right out of the box so I'm not sure what is going on. I'd post to MATLAB's site, but it is down for maintenance.
This is either a bug in Matlab, in which case you should submit it on the Matlab support site. Before you do that, you should check that you don't have a function lagmatrix on your path that shadows the built-in function. Type
which lagmatrix
on the command line. If the path does not point to your Matlab installation, you should move lagmatrix off the Matlab search path.
Also note that y1 should not contain all NaN, or be otherwise degenerate, so you may want to check the function using the sample data as suggested in the help to be sure it's a bug and not just your data.
I had the same problem with this function. In my case, the problem was the function lagmatrix (older version) in my MATLAB path and the adftest function was the newest version. The soluction was delete the older version of lagmatrix.