Monday, April 09, 2012

Machine Learning


Machine learning

Input: data $\mathcal{X}$ and label $\mathcal{Y}$. Unknown target function $$f:\mathcal{X} \rightarrow \mathcal{Y}$$ Training examples $$(x_1,y_1),\ldots,(x_n,y_n)$$ Hypothesis set $$H=\{h_1,\ldots,h_m\}$$ Learning algorithm $$h = A \leftarrow \{H, X, Y\}$$ Final hypothesis $$h \approx f$$ Example of SyntaxHighlighter
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js">
MathJax.Hub.Config({
extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js"],
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
},
"HTML-CSS": { availableFonts: ["TeX"] }
});
</script>

Thursday, April 28, 2011

Particle Filter (Mouse Tracker Example)

Particle Filter (evolved after Bayesian) was introduced by Gordon (Gordon et al., 1993), and has been a preferred choice for tracking application due to its ability to solve both non linear equations and non-Gaussian noise. Its main principle is derived from the Sequential Monte Carlo method (Bolic, 2004) that recursively generate random measurements to approximate the distribution of unknowns variables.

The Particle Filter technique has been proved to be robust and is widely used in many applications such as robotics (Bererton, 2004), human tracking (Okuma et al., 2004; Hue et al., 2001; Green and Guan, 2003), network applications (Coates, 2004), vehicle tracking (Nummiaro et al., 2002), sound detection (Checka et al., 2004), bearing tracking (Bolic, 2004), and gesture recognition (Alexander, 2002).

In this page, we show a simple example of how Particle Filter can be used to track mouse movements.



Labels:

Sunday, April 03, 2011

Compound Interest

Wilson Leoputra

1 Compound interest

Compound interest is a method to calculate future value (FV) based on a set of parameters: present value (PV), interest, and the duration on which the present value is accumulated. The formula for compound interest can be written as:
(1)

where P is the principal (present value), r is the interest (in %), n is the duration the principal is accumulated (it can be day or month or year), and A is the future value. As an example if a client deposit $25000 with compound interest of 10% each year, what is the amount of money he will receive after 5 years? Substituting P = 25000,r = 10%,n = 5 to Eq. 1, we get: A = 25000(1 + 0.1)5 = 40262.75. This can also be written as an iterative process as:



Iteration 
Future value




1
25000.00 * (1.1) = 27500.00


2
27500.00 * (1.1) = 30250.00


3
30250.00 * (1.1) = 33275.00


4
33275.00 * (1.1) = 36602.50


5
36602.50 * (1.1) = 40262.75


2 Compound interest added a constant yearly

In some situations, we need a formula to compute the compound interest with a constant being accumulated each year. Let b be the constant parameter, e.g. b = 25000, we obtain the following value sequences:



Iteration 
Future value




1
25000.00 * (1.1) = 27500.00


2
(27500.00 + 25000) * (1.1) = 57750.00


3
(57750.00 + 25000) * (1.1) = 91025.00


4
(91025.00 + 25000) * (1.1) = 127627.50


5
(127627.50 + 25000) * (1.1) = 167890.25



The question is: what is the formula to generate these sequences?
The step by step derivation is shown below.

C0 = P
C1 = P * (1 + r) = P + Pr
C2 = (C1 + b)(1 + r)
= C1 + C1r + b + br
= (P + Pr) + (P + Pr)r + b + br
= P + Pr + Pr + Pr2 + b + br
= P + 2Pr + Pr2 + b + br
= P(1 + 2r + r2) + b + br
= P(1 + r)2 + (r + 1)b
C3 = (C2 + b)(1 + r)
= C2 + C2r + b + br
= (P + 2Pr + Pr2 + b + br) + (Pr + 2Pr2 + Pr3 + br + br2) + b + br
= (P + 3Pr + 3Pr2 + Pr3) + br2 + 2b + 3br
= P(1 + r)3 + (r2 + 3r + 2)b
C4 = (C3 + b)(1 + r)
= C3 + C3r + b + br
= (P + 3Pr + 3Pr2 + Pr3 + br2 + 2b + 3br)+
(Pr + 3Pr2 + 3Pr3 + Pr4 + br3 + 2br + 3br2) + b + br
= (P + 4Pr + 6Pr2 + 4Pr3 + Pr4) + 3b + 6br + 4br2 + br3
= P(1 + r)4 + (r3 + 4r2 + 6r + 3)b

C5 = (C4 + b)(1 + r)
= C4 + C4r + b + br
= P(1 + r)5 + (3b + 6br + 4br2 + br3) + (3br + 6br2 + 4br3 + br4) + b + br
= P(1 + r)4 + (r4 + 5r3 + 10r2 + 10r + 4)b

From these five sequences, we can see that
Ci = P(1 + r)i + something × b

The “something” can be plotted as




ith   Something r = 1 r = 0.1








C2 r + 1 2 1.1




C3 r2 + 3r + 2 6 2.31




C4 r3 + 4r2 + 6r + 3 14 3.64




C5 r4 + 5r3 + 10r2 + 10r + 4 30 5.11




We obtain 2,6,14,30,, if r = 1. Now we borrow the Geometric Series formula to solve this:

Sn = 

where a = initial value and x = ratio. Table shows that the first sequence takes the value of r + 1, so a = r + 1. If r = 1, the first sequence that we get is 2. If r = 0.1, the first sequence that we get is 1.1 and so on. After trial and error, we found that we can set a = r + 1 and x = r + 1n = n - 1 in order to obtain the correct output. Substituting these to Sn give us:

Sn  = 



To proof if this formula is correct, we subsitute n = 2,3,4, to Sn

S2 = = 0

S3 ==    = r+1
S4 = = = = = r2 + 3r + 2
S5 = = = = r3 + 4r2 + 6r + 3

Alternatively, the trick is to multiply (Ci ×) + -
C3
=(r2 + 3r + 2) ×
= + -
= 
= ((r + 1)3 - (r - 1))
C4
= (r3 + 4r2 + 6r + 3) ×
=  + -
= 
 ((r + 1)4 - (r - 1))

The formula for compound interest with a constant being accumulated each year is:

 





Labels:

Thursday, March 31, 2011

Volumetric Graph Cuts for video segmentation

Content to be added