## Awesome seminars at UW

There are some fascinating seminars sponsored by UW, and most of them are recorded:

CSE Colloquia:

Every Tuesday 3:30 pm

https://www.cs.washington.edu/htbin-post/mvis/mvis/Colloquia#current

Yahoo! Machine Learning Seminar

Every Tuesday from 12 – 1 pm

http://ml.cs.washington.edu/seminars

UWTV: Research/Technology/Discovery Channel

Broadcast all the new findings, research, technology for free!!

http://www.uwtv.org/

## How to Install Eclipse and Android SDK on Ubuntu 10.04 LTS

Before walking you through the installation process in details, it’s good to know a big picture:

- Since Android development needs Java, so we are going to need Java installed on Ubuntu
- If you are using 64-bit Linux machine (e.g. 64-bit Ubuntu), you may need to install ia32-libs.

- You will also need Java Development Tools (JDK), and Eclipse is recommended
- The last thing is to install Android Development Tools (ADT) on Eclipse

All the information regarding the installation can be found at the Android developer website

Here is the installation in details:

- Install Java
- If you are using 64-bit Ubuntu, you will need to install ia32-libs package:

sudo apt-get ia32-libs - Next, install Javasudo apt-get install sun-java6-jdk
A tricky part is that when the Java installation almost done, you will need to click <Ok>, which can be done by click in the terminal and press Tab until the <Ok> is highlighted.

- If you are using 64-bit Ubuntu, you will need to install ia32-libs package:
- Next, you will need to install Java Development Tools (JDK). Eclipse is recommended because there is an Android Development Tools (ADT) plugin available.
- Go to http://www.eclipse.org/downloads/
- I download Eclipse IDE for Java Developers (both 32- and 64-bit are available)
- Extract the downloaded file eclipse-java-indigo-SR1-linux-gtk-x86_64.tar.gz, and you will get the folder called eclipse, containing all necessary files
- Since Eclipse is built to be portable, you can move the extracted eclipse folder to any location you want. It is recommended to move the file to your home directory /home/yourusername/
- You might want to add the launch icon on the menu, please follow the process here.

- Launch Eclipse, we will now install the ADT plugin
- go to Help>Install New Software..
- According to the ADT plugin page, we will put the URL

https://dl-ssl.google.com/android/eclipse/

and click Add - Tick the newly added plugin, and click Next until done

- Next, we will install Android software development kit (Android SDK)
- Download the Android SDK from

http://developer.android.com/sdk/index.html

For (both 32- and 64-bit) Ubuntu, you will download android-sdk_r16-linux.tgz - Extract android-sdk_r16-linux.tgz in the home folder (/home/yourusername/)
- The extracted folder is android-sdk-linux
- Now go back to Windows>Preferences
- On the left panel, click Android
- In the SDK Location, select your extracted SDK location, which is

/home/yourusername/android-sdk-linux - Click Apply and OK, wait a few minutes for the program to update

- Download the Android SDK from
- Retrieve all necessary files for SDK
- Go to Window>Android SDK Manager
- Tick all the Android versions that apply, and click Install packages

- Done, So now you may proceed to build a new project!!!

Additional reading can be found from http://developer.android.com/sdk/installing.html#troubleshooting

## Solved: pdfExpress verification gives some errors

My paper did not pass the pdfExpress verification due to the error:

Error Font Helvetica is not embedded (111x)

Here we follow the process from the submission homepage:

If you are using the conference template in its Winword version and still get errors (or no answers) from pdfExpress, try this procedure:

1) Please check the top margin of the the first page. it MUST be 2.5 cm; for OTHER pages it must be 1.9 (cm)

2) Generate the pdf file

3) Then you have to embed the fonts. You can do that either

3.1) by using acrobat professional or

3.2) using the line command

gs -dSAFER -dNOPLATFONTS -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=letter -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -sOutputFile=OUTPUT.pdf -f INPUT.pdf

where INPUT.pdf is the pdf source file, OUTPUT.pdf is the output file to be submitted with the fonts embedded and gs is the ghost-script executable command.

If this does not work, or you have other pdfExpress problems, please contact Dr. Romolo Camplani at camplani@elet.polimi.it

However, after trying such a method, the pdf is rejected from the submission website. So, we still have to put the output file to pdfExpress to verify again, and of course you can now expect no error. Then you can proceed to submit the pdfExpress-verified pdf to IJCNN, and the file is PID1839743.pdf whose content is identically the same as ClosedFormDcsGMM_IJCNN_final_added2.tex.

## How to remove white-border from a figure?

When adding a figure to your publication, you might want to remove the undesired white-border off your figures. I believe that the best way is to create figures without the border if it is possible. In MATLAB, I think you can do so. However, if you have the figures already, you might want to have a program to remove the borders automatically, wisely and controllably. I developed a toolbox in MATLAB for this purpose. Please refer to the URL below.

## Plot 3D ellipsoid

Plot 3D Gaussian distribution? The harder part is to plot the 3D ellipsoid which can be done by calculating the axes (radii) of the ellipsoid from its eigenvalues. Simultaneously, We will get its corresponding eigenvectors which tells how to rotate the ellipsoid. The function ellipsoid(.) can plot canonical ellipsoid, and hence we need to rotate the canonical ellipsoid using the eigenvectors. That is it. Here are some codes adapted from Rajiv Singh’s version.

% plot 3D ellipsoid % developed from the original demo by Rajiv Singh % http://www.mathworks.com/matlabcentral/newsreader/view_thread/42966 % 5 Dec, 2002 13:44:34 % Example data (Cov=covariance,mu=mean) is included. Cov = [1 0.5 0.3 0.5 2 0 0.3 0 3]; mu = [1 2 3]'; [U,L] = eig(Cov); % L: eigenvalue diagonal matrix % U: eigen vector matrix, each column is an eigenvector % For N standard deviations spread of data, the radii of the eliipsoid will % be given by N*SQRT(eigenvalues). N = 1; % choose your own N radii = N*sqrt(diag(L)); % generate data for "unrotated" ellipsoid [xc,yc,zc] = ellipsoid(0,0,0,radii(1),radii(2),radii(3)); % rotate data with orientation matrix U and center mu a = kron(U(:,1),xc); b = kron(U(:,2),yc); c = kron(U(:,3),zc); data = a+b+c; n = size(data,2); x = data(1:n,:)+mu(1); y = data(n+1:2*n,:)+mu(2); z = data(2*n+1:end,:)+mu(3); % now plot the rotated ellipse % sc = surf(x,y,z); shading interp; colormap copper h = surfl(x, y, z); colormap copper title('actual ellipsoid represented by mu and Cov') axis equal alpha(0.7)

## Simple Classification Models: LDA, QDA and Linear Regression

Finally, my website was set free from the hacker–at least for now ^_^. In my backup directory, I found some notes I made for the Pattern Recognition class I taught in Spring 2010. The notes contains the details of the derivation of

- Linear Discriminant Analysis (LDA) and Quadratic Discriminant Analysis (QDA) [pdf]
- Linear Regression for Classification [pdf]

Hope this can be useful.

## Using recursion in MATLAB

This week I wind up with coding sum-product algorithm in MATLAB. All went well, and there were some interestingly simple but powerful techniques I would like to share. We all know that programming function with recursion can save a lot of time, and is a classic technique in C++. I just realized that we can do so in MATLAB too, and the way to do it is very similar to that in C++.

### Example1: “Calculate the summation at each node in a binary tree”

I have a 3-level binary tree whose nodes are connected as follows: node1 is the parent of node 2 and 3, node 2 is the parent of node 4 and 5, node 3 is the parent of node 6 and 7. Let’s assume that nodes 4 – 7 are instantiated with number 4, 5, 6 and 7 respectively. We want to calculate for a node n the summation of its corresponding children in the leaf level. Let’s name the function fn_recurs_sum_tree(tree, n) where the variable “tree” is the binary tree structure with node 4-7 instantiated as above, and n denotes the node of interest. More specifically, tree is a cell array of the size 7 x 1, where tree{n} returns the value stored in the node n of the tree. Here is the example of the code

```
````function sum = fn_recurs_sum_tree(tree,n) if ~isempty(tree{n,1}) sum = tree{n,1}; else sum = fn_recurs_sum_tree(tree,2*n) + fn_recurs_sum_tree(tree,2*n+1); end `

### Example2: “Calculate the summation at every node in a binary tree”

What if we want to find the summation at every node in the network? Of course, we would not call the function fn_sum_bin_tree(tree, n) for n=1, 2 and 3 as that would not be efficient when the number of node is large. One technique is to call the function at the root node (i.e., n = 1) so that all the summation is accumulated from bottom to the top. The price to pay is to deal with how to pass the cell array tree into such a function. Here is the example.

```
````function [sum, tree] = fn_recurs_sum_tree2(tree,n) if ~isempty(tree{n,1}) sum = tree{n,1}; else [sum1, tree] = fn_recurs_sum_tree2(tree,2*n); [sum2, tree] = fn_recurs_sum_tree2(tree,2*n+1); sum = sum1 + sum2; tree{n,1} = sum; end `

Here are some test codes:

% #### example code ###### % initial the tree tree = cell(7,1); for n = 4:7 tree{n,1} = n; end % Calculate the sum for a single node 2 sum = fn_recurs_sum_tree(tree,2) % Calculate the sum for the whole network [sum, tree] = fn_recurs_sum_tree2(tree,1)

This technique is very useful when you have to deal with tree. So, hope this helps! Sample codes are made available here:

fn_recurs_sum_tree.m

fn_recurs_sum_tree2.m

example1.m

Just copy all the codes, put them in the same folder, then run example1.