Summer camp: R Day1

Data type in the datasheet words: “California” categorical data: a / b / c logical: TRUE, FALSE number: 10 missing data: NA Hot key run one chunk in the scripts: ctrl + Enter run all chunks in the scripts: ctrl + Enter + Shift Data type in R vector vector <- c("Ada","Emily","Jack") if you combine different data types into one vector, you will get vector consist of string vector <- c(TRUE,"Ada",10) factor...

How to make decisions in a bandit game?

Suppose you are faced with a 10-arm bandit. For each arm, it has a distribution of reward. Your goal is to get as much reward as possible. But the problem is, you do not know the distribution (mean, variance, etc.). Your only method is trial-and-error, i.e. learn by trying. Now, I think that I should first evaluate my action and then take it by strategy. How to evaluate an action? 1....

Dynamic Programming for MDP

Before we delve into solving MDP by dynamic programming, let’s review concepts in MDP! Markov Decision Process We can use MDP to describe our problems. It includes Action, State, Reward. Markov Property The next state could be fully derived by only the current state. $$P(s_t,r_t|s_{t-1}, a_{t-1}, \dots s_0) = P(s_t,r_t|s_{t-1},a_{t-1})$$ Reward Hypothesis What we mean by goals and purposes can be well thought of as maximization of the expected value of the cumulative sum of a received scalar signal (reward)....

Fourier Transform

Cute Fourier Transformation coming ! Fourier transformation $X(t)$ is the amplitude-time function, we want to transform this into frequency domain. Typically, we want to decompose the function into several sine and cosine function with different frequency, phase and amplitude. $F$ represents the frequency we focus on. $$X(F) = \int_{-\infty}^{+\infty} X(t) e ^{-i2\pi Ft}dt$$ The dot product verifies the similarity of the analysis function and the amplitude-time function. Discrete Fourier transformation When we can only sample data from the signals, we replace the X with the folowwing....

Mandelbrot Set

空间上的分形和时间上的混沌有相似性。一个动力方程是时间上的混沌,会收敛到吸引子,根据此画出的动力平面和参数平面是空间上的分形。 Mandelbrot Set 复迭代 有一个关于z的复映射with 参数c如下: $$f_c(z) = z^2 +c$$ 我们想要知道在参数平面中临界点$z = 0$的轨迹是否有界,即 对于一个c,根据迭代规则 $$z_{n+1} = z_{n}^2 + c$$ 生成的序列${x_0,x_1,…} -> \infty$,则无界,$c \notin M,$ 如果序列有界,则$c \in M$。 另外我们还想要知道在动力平面中$c \in C$, 不同z0 的值产生的轨迹是否有界,此时$z_0 \in Julia,$ 如果序列有界,$z_0 \notin Julia$ 如果序列无界。 Algorithm 逃逸时间算法 为了绘制参数平面中的M集,我们需要确定每个c是否属于M集,这里用到了逃逸时间算法。 逃逸准则 对于一个复数$z_n = x_n +iy_n$, 模$|z_n| = \sqrt {x_n^2 + y_n^2}$。我们claim: 如果对于一个复数序列 ${z1,z2…zn}$ 有$|z_j| > max(2,|c|)$则序列将逃逸到无穷大。 证明 当 $|z_j| > max(2,|c|)$, 则 由$|z_j|>2$ 可知 $|z_j| = 2+e,$ for $e\in \R^+$...

September 15, 2020 · 2 min · Orange ·  Math