how to save matlab neural networks toolbox generated figures - matlab

In the matlab workspace the output/results can be easily saved. But when I train the network with some data to see the performance of the training (In Neural Network Toolbox), the regression plots along with the histograms and performance plots can not be saved as a figure file.currently i am using snipping tools to capture them.
My Question is how to do that? Is there any options to save those plots(generated in Maltab Neural Network toolbox)?
I would be grateful to have any codes/ answers regarding my inquiry. Many thanks.
I am adding to snapshot of plots which i want to save by commanding codes in matlab.
currently i am using snipping tools but when i put then in word, their property/image quality shrinks.

First of all you need to identify the gfx object you want to snap-shoot (its handle). This may come from identifiable properties. Then you'd want to use print to save it to a file; you need to provide the file name, eventually the type; see the help for more details.
For example, if you want to save the figure with the tag 'my.awesome.fig', you may try:
h = findobj('Type', 'figure', 'tag', 'my.awesome.fig');
for k = 1:numel(h)
print(h(k), sprintf('Pic%d.ps',k));
end;

The training figures other than nntraintool itself are genuine matlab figures. The tags are for example TRAINING_PLOTERRHIST TRAINING_PLOTPERFORM TRAINING_PLOTRESPONSE . the nntraintool figure is java--you can access it with nnjava.tools('nntraintool'). See Undocumented Matlab for how to manipulate java figures in Matlab.
Richard

If you mention about the quality of figures only, you can do it by clicking EDIT/COPY in the figure menu.

Related

Training a model for Latent-SVM

GOOD MORNING COLLEAGUES!
I am very into train a new model from my own data set of faces!
I have found no information about this topic, then I hope my information could help people and I can get some answers as well.
I will try to explain the steps I have needed to do to train my own model and later on some questions...
I have download the Latent code from: http://cs.brown.edu/~pff/latent-release4/
I have download the PASCAL VOC 2008 code (devkit) from: http://host.robots.ox.ac.uk/pascal/VOC/voc2008/index.html
I have emulate the structure of files/folders of the VOC PASCAL but in my own data set:
Annotations. I have created a .xml where I have defined a object, face, (in each image I only have one face). I didn't define difficulties or poses...
JPEGImages where I have stored all the images
ImageSets where I have defined three files:
test.txt, where I wrote the file name of my positive samples
train.txt, where I wrote the file name of my negative samples
trainval.txt, where I wrote the file name of my positive samples (exactly the same file than test.txt).
I have change some things in globals.m and VOCinit.m (to tell the algorithm the path and the location of some files...)
Then I run the training with the command: pascal('face', 1);
Following these steps I have achieved that the training run completely and doesn't fail and I get my own model BUT I have some doubts...
Can you see anything weird in my explanation? Could it work?
Must the files test.txt/trainval.txt be equal? Why... What does it mean?
Do I have to choose the number of parts I want in the model INSIDE the function?
Please, you imagine I have two kind of samples (frontal faces and side faces) and I want to detect both... How can I address this issue? I thought I have to train a model with two components... but How can I tell to the training code which are frontal or side samples?? In the annotations with the label pose?? (I don't think so...) Are there other way to handle this purpose?
Thank you for your time!!
I hope you can solve my doubts :)
I think test.txt should contain samples (images) that will be used to estimate how good the system is after learning the faces. However, trainval.txt is used during the learning stage (training) to fine-tune the parameters of the model; it is an essential part of supervised learning.
Also, it is very hard to have one single SVM to classify faces that are both frontal and sideways. Here is my suggestion:
Train one SVM to detect if the input image is a frontal face or a sideways face. Call this something like SVM-0.
Train another SVM for frontal faces. This SVM will classify all your individuals. Note, however, that SVM is usually a binary classifier, so make sure you choose the right SVM, one that as a multiclass architecture. Call this SVM-F.
Tran a final SVM for sideways faces. Again, use a multiclass SVM. Call it SVM-S.
Present the input image to SVM-0 and if it detects it is a frontal face, present the input again to SVM-F; otherwise, give the input to SVM-S.
In my experience, you should expect very low performance in SVM-S. It is a hard problem to solve. But frontal faces is not a big deal, unless you are working with faces that vary in pose, illumination, and expression (PIE). Face recognition is affected greatly with PIE variations in the images.
I recommend you this website, it contains very good information and tutorials for starters, with or without experience.

How to load input for NN in Matlab

I want to use NN toolbox in matlab
my input is a 42*3 and my target is 42*1
i Have 42 samples with 3 features
but I cant load the target and it hasn't any error but it doesn't load
can anyone help me
Try to load an example dataset first. Matlab provides six example data sets, you can choose in the GUI. If you have no problems with those, the problem is with your data.

MATLAB Neural network - how to generate a relationship/function out of it?

I have just tried out Neural Network fitting tool in Matlab, however, I am not able to generate a function which relates all the input variables to the output, can anybody help me out on this? Is there a post-processor available to do that?
cheers,
Gaurav
If You are using nftool at the last page there are saving options.
You can generate script that will allow You to solve similar problem but with new fitting data and (what I think You want) You can save object with Your net that You can use with Your input to get output.
The trained NN object itself can be used as the input-output function. It is an object that contains an "evaluate" method. See the example from mathworks for details:
http://www.mathworks.com/help/nnet/ref/fitnet.html

Plotting graph with respect to frequency

I am doing a project on Open Modelica and i have to simulate filters on it using active elements(op amp). Modelica plots graph with respect to time but i want my graphs with respect to frequency to analyze the frequency response of the system. I searched the internet but couldn't find anything useful. Please reply as soon as possible.
If you want to plot a variable with respect to another variable you can use plotParameteric from OMShell (OpenModelica Shell). In OMEdit (OpenModelica Connection Editor) you can click on parametric plot button x(y) and then select 2 variables.
I assume that what you want is a Bode plot. If so, it is important to understand that such a plot does not arise from a transient simulation. It is necessary to transform your system into a linear, time-invariant representation in order to express the response of your system in the frequency domain.
I do not know what specific features OpenModelica has in this regard. But those are at least the kinds of things you should search the documentation for. If you have access to MATLAB, then all you really need to do is extract the linearized version of the model (normally expressed as the so-called "ABCD" matrices) and MATLAB can get you the rest of the way.
There is also the Modelica_LinearSystems2 library which might be compatible with OpenModelica (I have no idea). It includes many types of operations you would typically perform on linear systems.

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