Tuesday, September 19, 2017

Review Techfest Munich 2017

I took part in Hackathon Techfest Munich at TU Munich in September, 2017. This was the first time I joined Hackathon. It was really interesting.

1. Activities

This Hackathon was more than Hackathon with many disciplines, which is not only for software developers, but also for biologists, business, media, .etc. It is great idea because we can learn together and practice to work in the multi-discipline environment.
In the first day, a presentation was held to introduce to participants about themes of this competition. Then, they divided into smaller groups and organize seminar to explain in detail. Especially, they asked participants to write down their ideas and to present. It is a good idea since those who did not have any idea have a chance to brainstorm their idea or choose the ideas from others to establish and work in the following days.
We work during 3 days with awesome support from organizers such as hardware, food, drink, .etc.

Beside project-related activities, we enjoyed many funny and crazy events there.

2. Feeling and the future

I used to be introvert person, scare to communicate to strangers. But I changed a lot, I made a lot of friends there. It was really one of the most amazing events I have joined.
After this event, I learned that if I have an crazy ideas, I just share to our community. I should not bother the implement beyond my knowledge since the mentors and team-mates would help me. Before that, I had many ideas, but I had worried I could not implement because I am software developers, not biologist or hardware engineer.
After all, I have idea that why not we organize these kinds of Hackathon for children, which help them determine their potential career in the future. In my country, high-school students do not decide their career objective since they do not clearly know about which job they would like to study and work. They usually decide well-paid jobs or high-rated jobs. In Vietnam, doctor and banking officer are the most very-highly-rated jobs and many good students chose this job since they want to be respected regardless of their interest. As a result, they could not graduated or find their jobs. Hence, Hackathon is a good idea to help children choose their right job.
Finally, I write this blog with the hope that students can join these events like this event to expand their network and experience more challenges.

Monday, September 11, 2017

Review Pattern Recognition Chapter 5: Maximum-Likelihood estimation

Chapter 5 is very complicated to understand. That is why I publish this blog to summarize the knowledge in the Chapter 5.
Basically, we have a look on mindmap:

Second option is a video with an example I have made:


Hopefully, you have fun to learn this chapter.

Friday, September 1, 2017

Pattern Recognition - Chapter 5: Maximum-Likelihood estimation

We talked about Bayesian decision rule in Chapter 3, in which we assumed that x is a scalar or 1-dimension and we have known the exact density function. In reality, we have to make decision based on many criteria (so x is a feature vector or high dimension) and we do not know the perfect and exact density function. The former problem that we addressed in Chapter 4 and the latter will be considered in this chapter.
We have two methods to estimate function: Maximum-likelihood (MLE) and Maximum-A-Posterior (MAP). We will consider MLE in this chapter, the latter will be told in Chapter 6. The discriminant function in Chapter 3:
It is easy to know because it is relative class frequencies, but  is difficult. To estimate the likelihood, we can predict the kind of density function (Gaussian, Poisson, Uniform distribution, ...) and estimate that function as well as use the resulting estimates (for more exact result, we should consider mixed densities as we told in Chapter 2).
Because the unknown function  depends on a few parameters, so we transfer from the unknown-function estimating problem to the problem of estimating parameters of known-function. For example: Gaussian distribution we estimate mean(s) and (co-)variance.

1. Maximum-Likelihood estimate (MLE)

MLE is maximizing the likelihood (the probability of obtaining the observed training samples). Informally interpreting, MLE chooses parameters to maximize  as discriminant function in Chapter 3. Let is parameter vector of class . For example, Gaussian density function (n-dimension):
Note that superscripts are not power of parameters, they illustrate i-th dimension. Because  depends on , so =. Because we observe over several samples, so we let Di is training data, which contains samples of class  and transfer from maximizingproblem to maximizingproblem. Assume that Di give no information aboutif, so the parameters for the different classes are independent (in case of dependent parameters, we can use Hidden-Markov models). That is why we can work with each class separately, and eliminate the notation of class distinctions . Now, our task is transferred from maximizingproblem to maximizingproblem. Let D contains n samples: x1, x2, ..., xn. Since samples are independent, so:
(1)
MLE will estimateby selecting optimalhaving the highest probability. Intuitively, the value of  best agrees with the actually observed training sample:
(*Source: Richard O.Duda et al. Pattern Recognition)
This means we find gradient of distribution density over parameters and set this gradient to be equal 0:
Inserting (1) to above equation:
To be convenient for analytical purposes, we will estimatewith the logarithm of the likelihood than with the likelihood itself (especially Gaussian distribution). Maximum likelihood corresponds to minimum negative log-likelihood due to functional form of log-function and probability values between 0 and 1.
(2)
Because:
so (2):
Hence, the gradient of log-likelihood over parameters to be equal 0:
(3)
We will find optimal parametersfrom (3) in the next parts with different distribution density functions.

2. MLE in Gaussian distribution (unknown mean)

We find optimal mean vector to maximize log-likelihood:
In general, we consider high-dimension Gaussian distribution:
Because the gradient of constant is 0, so we eliminate the first gradient:
(4)
If matrix A is symmetric, we have (for more detail):
(5)
Here, we apply chain-rule over:
(6)
We insert (5) and (6) to (4):
Whereis optimal mean vector. Sinceis not zero-matrix, so:

To achieve the maximum-likelihood, the mean vector is the arithmetic average of the training samples.

3. MLE in Gaussian distribution (unknown mean and covariance)

We will find the gradient of log-likelihood over mean vector and covariance. Since the analysis of the multi-variate case is basically very similar to uni-variate case, we will consider uni-variate case and predict the results in multi-variate case.
We obtain the results:
and
From the above results, we have the results in multi-variate:
and
Both results are arithmetic average or expected value.

4. MLE in Poisson distribution

Likelihood of Poisson distribution:
Log-likelihood is:
The derivative of log-likelihood over lambda is equal 0:
The optimal parameter is the arithmetic average:

5. Summary

Explanation of self-attention (single head)

Attention (*Source: https://jasperwalshe.com/perspective-and-performance/) 1. Main ideas Convolutional neural networks (CNN) only f...