I came across a question in codewars which is based on the calculation of the *n*th number in the Fabonacci sequence. Remember back in high school we were asked to derive this via MI, which is a long story. And thanks to the power of computation that gives options to simplify this process. Anyway, here are a few ways for solution: 1. Math function This is put at the first place because for people who do math it is the most intuitive action to just calculate the result from $$F_n = \frac{1}{sqrt(5)}\bigg[ \big(\frac{1+sqrt(5)}{2}\big)^n - \big(\frac{1-sqrt(5)}{2}\big)^n \bigg]$$ However, the calculation
Continue reading

Cost function $$J(\theta) = \frac{1}{2m} \sum^m{i=1} (H\theta(X^{(i)}) - y^{(i)})^2$$ $$Cost(h\theta(X), y) = \begin{cases} -log(h\theta(X)),&\text{if }y=1
-log(1-h\theta(X)),&\text{if }y=0 \end{cases} $$ P.S. Katex tips: in Hugo’s math mode, to get line separator for multi-line equations, use ‘’ $\times 6$ instead of ‘\‘. And if a function faild, add ‘’ as escape char for random ‘’s might help (annoying…I know…)
Continue reading

Here is a series of course notes migration, in order to say-goodbye to the text books and my messy physical notepads. Hypothesis model $$H_\theta(X) = \theta^T X = \theta_0\cdot 1 + \theta_1\cdot x_1 + \cdots + \theta_n\cdot xn$$ $\theta\in n+1$ column vector, $X\in (n+1)\times m$ matrix when having $m$ training cases. Cost function $$J(\theta) = \frac{1}{2m} \sum^m{i=1} (H_\theta(X^{(i)}) - y^{(i)})^2$$
Continue reading

I have been thinking for a while putting up a blog recording random stuff. It might be a better way to keep track what I’ve been looking at and regularize some massy notes. After wasting a summer leaving the plain template lying in my disk folder, it’s good to start now since the season is getting closer to my background picture. With the free domain provided by Github, there has been a good amount of choices for set up a static website/blog.
Continue reading

Author's picture

lxip

唯自渡方是真渡

Data Science

MA US