How to set alexnet from scratch? - matlab

I would train an alexnet DNN (given by MATLAB function alexnet) from scratch (i.e. without pretraining on ImageNet given by alexnet function). I could to manually set weights but I don't know the from what distribution I can sample my initial weights. Is there a built-in MATLAB option that make it for me?
For example, I've read that Python's library has the option pre-training=off but I don't find a similar option in MATLAB.

Related

How to perform multi-class cross-validation for LIBSVM in MatLab

I want to use LIBSVM in MatLab to do some multi-class classification. I have read that LIBSVM use One vs. One by default when provided with multiple labels, and I am fine with it.
My question is about the parameter search and the model validation. When doing a 2-class validation to find the parameters C and gamma (when using RBF as kernel), I would use the built-in cross validation to find the best (C,gamma)-pair, using a simple grid search. I have read the LIBSVM documentation but I have no idea how validation works for multiclass SVM.
Does the built-in option returns the multi-class accuracy? How can I provide the best parameters to each of the OvO models it will automaticaly built?
The answer is given there http://www.csie.ntu.edu.tw/~cjlin/libsvm/faq.html#f507. I did not read the FAQ of LibSVM enough.

Matlab - Create RBF Network without using Neural Network Toolbox

In the lectures we only mention how to train the RBF network with Gausian function and how to use the "newrb" tool box in Matlab. But in the assignemnet I need to create my own RBF network which using the NN toolbox is forbidden. Basically I not even know how to start it and our professor not willing to provide any information.
With some tips I have write my own program but the performance is very bad, I am wonder if any one can give me some helpful tutorial or guides that how to create the RBF network with Gaussian function without using NN toolbox.
I have used k-means to obtain the centers and gaussian function to caculuate the weights, the main probrlem is that I have no idea how to design the method that transform the Input matrix to the RBF matrix. Hope you can help.
This is clearly homework, and it's not clear what your question is. But I think you are wondering how to create the Gram matrix. If so, see:
http://en.wikipedia.org/wiki/Gramian_matrix
You should have the math for how to do each step in your textbook and/or notes.

How to train SVM in matlab for character recognition?

Im a final year student working on my major project. My project is basically to extract text from a natural scene, and recognize it and then display them in a notepad etc..
I have already extracted the text form the images and have also obtained 85 features for each character which is extracted.
How ever, for the recognition part, I have no clue as of how to train or use SVM(support vector machines) in matlab so I can get a match.
Please help me out as this is turning out to be painstakingly difficult
If you're happy with using an existing SVM implementation, then you should either use the bioinformatics toolbox svmtrain, or download the Matlab version of libsvm. If you want to implement an SVM yourself then you should understand SVM theory and you can use quadprog to solve the appropriate optimisation problem.
With your data, you will need to have an N-by-85 feature matrix, where N is a number of characters, and an N-by-1 array of 'true labels' which you provide manually. Depending on which tool you use to train an SVM, the paramaters to svmtrain are slightly different - check the documentation.
If you want to evaluate your SVM to show that it works, you may need to organise your data such that you can estimate the generalization error of classifier - see cross-validation

Matlab SVM training for muliclasses dataset

I have a question about the SVM MATLAB toolbox 2009b! the question is:
How I can train SVM classifier for classifying multi-classes datasets in MATLAB toolbox 2009b?
I just want to work with MATLAB toolbox, so please answer it if there is a way to implement it. For example, the below code is for classifying two classes datasets:
svmtrain( training data, ...
labels of training data, ...
'Kernel_Function', ...
'rbf', ...
'RBF_Sigma', ...
sigma value, ...
'Method', ...
'LS', ...
'BoxConstraint', ...
C ...
);
I want to know is there a way for training SVM for multi-classes dataset with writing a code such as above code, or should I write some code for training a SVM for each class versus the other classes?
It means, should I consider 1 for the label of the selected class and set the label of the other classes to 0, and train a SVM with above code, and do it for all classes!?
Thanks for your consideration :-)
I have not used SVM in Matlab, so other people can likely provide a more informed response, but I will share what I have learned.
Matlab Bioinformatics Toolbox SVM
From reading the documentation, the SVM in the Bioinformatics Toolbox appears to only support binary classification. As suggested in the question, a binary classifier can, with some effort, be used to classify into multiple classes. There is some discussion on approaches for doing this in the context of SVM here.
Alternate options
LIBSVM does support multi-class classification and comes with a Matlab interface. You could try installing and using it.
Additionally, while looking into this, I did come across several other Matlab toolboxes with SVM implementations. If LIBSVM is not a good option for you, it may be worth looking around to see if a different SVM implementation fits your needs.
If you have MATLAB release R2014b or later you can use the fitcecoc function in the Statistics and Machine Learning Toolbox to train a multi-class SVM.
Yup, the way for solving your problem - is to implement one vs all strategy. One of the SVM's lacks is that it has no direct multiclassification implementation.
But you can implement it through the binary classification.
I didn't see any function for svm multi classification in matlab. But i think it is not hard to implement it by yourself

How to train SVM for Tamil Character Recognition using MATLAB?

Hi I am doing my Final Year M.E Project in Tamil Character Recognition. I have completed till Feature Extraction step. Now I got Features for Each image in the Dataset(HP Labs). How to Feed these features to train SVM and How to Perform Class Labeling. I am new to this Neural Network area. So please Help me....
In Training
In Matlab neural Network has two inputs:
Input vector
Target Vector
Example:
net = newFF(input,target);
net = train(net,input,target);
You give feature is input vector. Target is corresponding feature id(char ID).
In Testing
Extract feature from image, then test the feature in Neural Network using sim function.
sim(net,features).. It returns corresponding char-ID.
open Matlab then type nftool and study that tool box.
same thing in SVM
Training
svmtrain(input,label).
input as feature.
label as ID of particular feature.
Testing
using svmclassify() method . It returns output of charID.
you may want to look at the svmclassify and svmtrain methods in the bioinformatics toolbox in matlab.
by the way, do you really want support vector machines or neural networks? they are very different from each other. please be clear which classifier you want to use for your problem before deciding to use a particular implementation.
if you are new to the field of machine learning and want to try out a couple of algorithms, I would suggest you try Weka first.