Saturday, May 15, 2010

remove accidentally inserted words from your spelling dictionary for emacs

somehow, I accidentally inserted an incorrect word to my spelling dictionary in emacs.  Wow, it took me a while to figure out where my private dictionary is.

Below are my only configuration script for ispell in emacs:
(global-set-key (kbd "") 'ispell-word)
(global-set-key (kbd "") 'ispell)



So i thought I am using ispell and noticed  the following documenation for ispell:

Whenever ispell is started the file `.ispell_words' is read from
your home directory (if it exists). This file contains a list of
words, one per line. The order of the words is not important, but
the case is. Ispell will consider all of the words good, and will
use them as possible near misses.

Unfortunately, I didn't find such a file in my home directory. It turned out that I was using aspell in ispell mode. What the hell!

The private dictionary for aspell is located at
~/.aspell.en.pws

Finally solved the problem.




Wednesday, April 7, 2010

how to make backspace working for firefox in Ubuntu?

http://embraceubuntu.com/2006/12/21/fix-firefox-backspace-to-take-you-to-the-previous-page/

 

Fix Firefox Backspace to Take You to the Previous Page December 21, 2006

Posted by Carthik in bugsquashing, snippets, ubuntu.
trackback
In a surprising development that seems really strange and unnecessary, Firefox 2.0 won’t go to the previous page when I press the “backspace” button on the keyboard. I have grown used to this over the period I have used Firefox. The fact that I can’t use backspace the way I am used to has been annoying me no end. So I decided to dig a little deeper.
The feature was removed to fix a bug. The bug that was caused by fixing the previous bug, which is that the backspace does not behave like it should has been fixed too (Thank heavens!)
But then, until the bug fix propagates to a firefox build available on Ubuntu, one has to resort to a little scratching to fix the matter. Here’s how you resurrect the backspace button in Firefox 2.0 (current as of this date):
Type “about:config” in the address bar of Firefox and press Enter.
`Filter` for ‘browser.backspace_action’ and change its value to 0 (zero).

Tuesday, December 1, 2009

matlab sparse matrix format

I have encountered several cases to handle matlab sparse matrix in mex c or c++.

Here, I use a simple example to explain how the sparse matrix is stored in matlab (Very creative, but not necessarily for my usage. Hence, it is always convenient to understand the structure)

The sparse matrix format in matlab involve several components:
nz: the number of non-zeros
m: the number of rows
n: the number of cols

jc: the index of columns.
ir: the index of rows;
pr: the nonzero entries stored in a double vector.

The tricky part is the relation between jc, ir and pr.

For example, consider a 7-by-3 sparse mxArray named Sparrow containing six nonzero elements, created by typing:

Sparrow = zeros(7,3);
Sparrow(2,1) = 1;
Sparrow(5,1) = 1;
Sparrow(3,2) = 1;
Sparrow(2,3) = 2;
Sparrow(5,3) = 1;
Sparrow(6,3) = 1;
Sparrow = sparse(Sparrow);
Then, the matrix looks like below:

>> full(Sparrow)

ans =

0 0 0
1 0 2
0 1 0
0 0 0
1 0 1
0 0 1
0 0 0

Then

The contents of the ir, jc, and pr arrays are listed in this table.

Subscript

ir

pr

jc

Comment

(2,1)

1

1

0

Column 1 contains two nonzero elements, with rows designated by ir[0] and ir[1]

(5,1)

4

1

2

Column 2 contains one nonzero element, with row designated by ir[2]

(3,2)

2

1

3

Column 3 contains three nonzero elements, with rows designated by ir[3],ir[4], and ir[5]

(2,3)

1

2

6

There are six nonzero elements in all.

(5,3)

4

1



(6,3)

5

1




If the jth column of the sparse mxArray has any nonzero elements:

  • jc[j] is the index in ir, pr, and pi (if it exists) of the first nonzero element in the jth column.

  • jc[j+1]-1 is the index of the last nonzero element in the jth column.

  • For the jth column of the sparse matrix, jc[j] is the total number of nonzero elements in all preceding columns.

The number of nonzero elements in the jth column of the sparse mxArray is:

jc[j+1] - jc[j];

Note that the size of jc is n+1.
the size of ir is nz, the same as pr.

Hence, to iterate over the spare matrix in c, you can use the following code:

for (col=0; col < n; col++){
startIndex = jc[col];
endIndex = jc[col+1];
for (i=startIndex; i < endIndex; i++){
row = ir[i];
val = pr[i];
......

}

}

Monday, November 30, 2009

ICDM Trip Soon

This Sunday, I will be out of town for ICDM conference held in Miami, FL.

I will present my paper:

Uncovering Groups via Heterogeneous Interaction Analysis.


This work addresses the community detection problem when multiple different types of interactions are presented between the same set of users.

A more general case is that users registered at different social media sites. Can we somehow uncover the hidden community structure?

We show that using an integration based on structural features is more robust. For evaluation, I proposed a simple cross-dimension network validation scheme. Similar to cross validation. This could be used as a simple rule for evaluation in the future.

Of course, there are many interesting directions to pursue in the future. One important aspect is that some of the dimensions are noisy. Is it possible to identify them? Is this the same as tensor decomposition?

Wednesday, November 18, 2009

about collective behavior

Recently, I just submitted a magzine article talking about collective behavior to IEEE Intelligent systems based on my recent work published this year:
Relational Learning via Latent Social Dimensions  KDD-2009
Scalable Learning of Collective Behavior based on Sparse Social Dimensions CIKM-2009.

So what is collective behavior? I define collective behavior as behaviors when individuals are exposed in a social network environment. 

I found that different areas have quite different definitions. 
(1) . According to wiki (mostly written by sociologist),"The term "collective behavior" was first used by Robert E. Park, and employed definitively by Herbert Blumer, to refer to social processes and events which do not reflect existing social structure (laws, conventions, and institutions), but which emerge in a "spontaneous" way. "Collective behavior can be divided into four categories:
1. The Crowd
2. The public
3. The mass
4. The social movement
It is subtle to differentiate these four terms based on the name.
(2) On the other hand, in other field, such as artificial life

Swarm Intelligence in Data Mining

collective behavior refers to a group of agents which can be treated as an entity, which is commonly observed in bird flocks, ants and other animals.  There are several principles:
homogeneity (all the agents follow the same behavior model), locality (influenced only by neighbors), collision avoidance (avoid with nearby flock mates), velocity matching and flock centering.
Two popular methods are introduced in the chapter: particle swarm intelligence and ant colony optimization.  quite interesting ideas :)
(3) In data mining field, there is one paper talking about learning from collective behavior.
The setup is like oracle: suppose you have the luxury to observe the interaction and corresponding actions of a group of people and each person in the group follow a fixed policy,  then  how can we learn the policy and strategies so that when new situations arrive, we can predict the collective behavior?  The authors provide some theoretical bounds about the learnability. Unfortunatelly, evertying is synthetic and it is really difficult for me to figure out a proper scenario such that their setup might be true.
The nice part of this work is that at least two kinds of policies are studied:
  • one is mimic your friend
  • the other is try to differentiate from your neighbors
while the first one is well known, the 2nd strategy, as I believe existing in the real world, do not studied well in data mining or SNA. One way of achieving this is connecting those nodes that are two hops away and seperate them from 1-hop away neighbors as suggested in using ghost edges for sparsely labeled networks But when everyting is mixed, more work needs to be done.
Another key difference of this work from my article is that my article talks about "spatial" prediction of collective behavior (given some observations, predict the others within the same network), while this one talks about "temporal" prediction.
I think it is a great idea to combine these two aspects together.

(4) Adaptive networks and behavior. Concerning social networks and collective behavior, two directions are converging. One study the dynamics of networks, the other study the dynamics on networks. In reality, there two factors are evolving simultaneously. Social networks can evolve, so are collective behavior. How to capture these two factors in the modeling? 

This also relates to social influence and social selection and several papers are talking about this issue:
Modeling the co-evolution of network and behavior
Nonequilibrium phase transition in the coevolution of networks and opinions
Feedback effects between similarity and social influence in online communities

(5) Collective Attention investigate how a news or a resource attracts users' attentions. Does networks come into play? This can also be a further direction for investigation.

Anyway, I feel that this direction has many more issues to address. Also many challenges such as problem formulation, data collection, and evaluation. More in the near future :)
Just check my homepage


Monday, November 16, 2009

Change default paper size in tetex in Linux

Run command in sudo mode:

texconfig

Tips in research

writing is like a hour glass.

Starts big, cover every aspects of the neck, and present a big picture.

Use conference deadlines to make yourself efficient.

Start from bad writing then improve!