07.29.11

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

Without MEX fwdbck procudure

forward-backward MEX

forward-backward MEX

VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)

07.28.11

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.

matlab repmat

Fig.1 matlab default repmat function

MEX version repmat

Fig. 2 MEX version repmat

VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)

09.6.10

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*');

Matlab plot

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

scatter plot with lables


Let’s scale Y to log in order to see small values
Scatter plot with Y-log scale

Scatter plot with Y-log scale


The same thing we can make with 2-dimension data

VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)

Tags: ,
| Posted in Matlab, Software | No Comments »