What's the difference between the svmtrain and fitcsvm in matlab? - matlab

I know that fitcsvm is a new command in matlab new version and in the latest document say that svmtrain will be removed. Are the two commands the same? Actually I notice that they are different in result in my recent work. Can anyone help me with this strange problem?

According to my experiments, I found that the two functions are different. fitcsvm takes the empirical distribution into consideration, the distribution is related to the number of positive samples and negatives in the default situation. However, svmtrain just take this distribution as [0.5 0.5], and one can think there's no prior knowledge.
Further, it may be with the data whether they have been standardization, to get more about this, just find the related document about SVM.

from fitcsvm:
fitcsvm and svmtrain use, among other algorithms, SMO for optimization. The software implements SMO differently between the two functions, but numerical studies show that there is sensible agreement in the results.
from Wikipedia Sequential minimal optimization:
SMO is an iterative algorithm for solving the optimization problem ...

Related

Are there any softwares that implemented the multiple output gauss process?

I am trying to implement bayesian optimization using gauss process regression, and I want to try the multiple output GP firstly.
There are many softwares that implemented GP, like the fitrgp function in MATLAB and the ooDACE toolbox.
But I didn't find any available softwares that implementd the so called multiple output GP, that is, the Gauss Process Model that predict vector valued functions.
So, Are there any softwares that implemented the multiple output gauss process that I can use directly?
I am not sure my answer will help you as you seem to search matlab libraries.
However, you can do co-kriging in R with gstat. See http://www.css.cornell.edu/faculty/dgr2/teach/R/R_ck.pdf or https://github.com/cran/gstat/blob/master/demo/cokriging.R for more details about usage.
The lack of tools to do cokriging is partly due to the relative difficulty to use it. You need more assumptions than for simple kriging: in particular, modelling the dependence between in of the cokriged outputs via a cross-covariance function (https://stsda.kaust.edu.sa/Documents/2012.AGS.JASA.pdf). The covariance matrix is much bigger and you still need to make sure that it is positive definite, which can become quite hard depending on your covariance functions...

MATLAB - How to set sigma in templateSVM

I have a dataset with multiple labeled vectors and I wanted to perform a multi-class SVM with RBF Kernel with the integrated function in MATLAB called 'templateSVM'.
To do so, I use the templateSVM function with the following command:
t = templateSVM('BoxConstraint', 1, 'KernelFunction', 'rbf')
The problem is that I cannot find how to set the 'sigma' parameter.
Thanks to previous computations, I know that C=1 and sigma=8 are the best parameters to get the best results. Not knowing how to set sigma leads me to awful results.
Would you know how to set this parameter?
Thanks a lot in advance.
Unfortunately the options available with templateSVM seem to be quite limited (I had this problem myself and couldn't find a solution). There are some crucial options (such as the RBF sigma parameter) that do not seem to be available with templateSVM but are available with svmtrain.
I know that this isn't a real answer to your question, but I suggest that you look into using libsvm instead - it is very configurable and integrates well with Matlab.
I know it's an old question, but the answer would be useful for new users.
Link below can answer the question:
https://www.mathworks.com/matlabcentral/answers/336748-support-vector-machine-parameters-matlab
"setting SIGMA": Use the 'KernelScale' name-value pair.

Some issues with fmincon in matlab

I was using Matlab's fmincon but the optimization stopped with the following message
fmincon stopped because the size of the current step is less than
the selected value of the step size tolerance.
I have TolX set to 10^-10 and Tolfun to 10^-10 as well
I checked the logs and the first-order optimality was 198. Therefore this is definitely not the optimum solution. What could possibly go wrong?
Further, I used different version of matlab R2013b and R2014a and for the same code and data, they have different results. Is there something wrong with fmincon in matlab R2013b?
When you have a question about the difference between two versions of Matlab or, as in this case, two toolbox versions, the first place to check is release notes: for Matlab and for the Optimization toolbox. Indeed, it seems that fmincon was updated. Do you specify an 'Algorithm'? If not, the difference may be due the different default in R2014a. In this case, you may be able to specify the use of the 'interior-point' algorithm in R2013b and get better results.
You can read about the algorithms used by fmincon here.

Log-Likelihood estimator for Matlab

I need to calculate the log-likelihood of a linear regression model in Matlab (I don't have the newer mle function unfortunately).
I realize that the parameters are the same as ordinary least squares (at least asymptotically), but it's the actual log-likelihood value that I need.
Although the theoretical result is well know and given in several sources, I'd like to find a pre-existing implementation so that I can be confident that it's tried and tested.
The problem is I have no numerical examples against which I can validate my own implementation.
Failing that, if someone can point me to a numerical example of a loglihood calculation for a linear regression model with N(0,sigma I) errors that would be great too. It's easy enough to program, but I can't really trust it unless its been tested.

svmtrain function in matlab never exits ... do alternatives exist?

I am trying to learn how to use support vector machines in matlab. I have the bioinformatics toolbox, which has SVM functions svmtrain and svmclassify.
I managed to successfully use it for some reference data sets, with some nice accuracy. When I try to use the svm on my actual data the training never stops. My data set is 400 instances in 25 dimensions, so it should not take very long?!
Can I use other solvers in matlab? I dont want to buy new toolbox please ...
There are several things that may cause problems for training, but it should not run infinitely. Do you get any errors when using the solver?
With regard to alternatives: LIBSVM has an interface to matlab. This is a state-of-the-art library with thousands of users. I highly recommend it, because it is easy to install/use and offers additional functionality for parameter tuning and more.