Improve speed up for forward-backward algorithm
In the previous post we were talking about repmat function in MEX format. We can reach further improvements if replace forward-backward procedure with C implementation (MEX format). The source code for the forward-backward in C can be found in PMTK which is a collection of Matlab/Octave functions, written by Matt Dunham, Kevin Murphy.
The results see below (with the same initial conditions):

Without MEX fwdbck procudure

forward-backward MEX
Speeding up with repmat function (MEX version)
To run your matlab applications with repmat “functionality” faster, you can use MEX format of this function from Lightspeed matlab toolbox.
With the same initial conditions you can see “productivity boosting”. Figure 1 – with default repmat function. Figure 2 – with MEX version of repmat function.

Fig.1 matlab default repmat function

Fig. 2 MEX version repmat
| Posted in Matlab, Software | 1 Comment »
Plotting in Matlab by groups or (labels)
How to plot in Matlab by labels?
Suppose You have some data:
1st case – we have 1-d (dimension) data or vector, so the next step is to plot this vector:
>plot(data,'b*');

Simple Plot
Now You’ve made some classification using f.e. kmeans algorithm:
>[IDX,C]=kmeans(data,5,'emptyaction','singleton');So we have labels in vector IDX and centroids in C. Now let’s try to plot data-vector using labels
>scatter(1:1000, data, 30, IDX, 'filled');
scatter plot with lables
Let’s scale Y to log in order to see small values

Scatter plot with Y-log scale
The same thing we can make with 2-dimension data

| Posted in Matlab, Software | No Comments »