본문 바로가기

BITS

[Reinforcement Learning in Finance] MDP and RL: Decision Policies

이번 포스트는 MDP를 위한 expected total rewards를 실제로 어떻게 최대화하는 지에 관한 것이다.

- 강화학습의 목표는 expected total reward를 최대화하는 것에 있다.

- 이는 폴리시에 대한 최적의 선택을 통해 얻을수 있다. 

$\pi: S \mapsto A$

- 이러한 폴리시는 현재 환경의 상태인 $S_t$를 인식하여 action A를 행하게 한다. 즉, $a_t = \pi (s_t)$ 

- 만약에 policy function이 conventional function of it's argument $S_t$라면, 결과인 $a_t$ 는 single number 이다. 

- 즉, policy function이 $\pi(s) = \frac{s}{2}$ 와 같을때 각각의 s에 대한 값으로 한가지 action이 나오게 된다. 이러한 정책을 deterministic policy라 한다. 

- 또는 function 이 아닌 probability distribution을 사용하는 MDP stochastic policies를 사용할수도 있다. 


Deterministic vs Stochastic Policies

Deterministic policies: $a_t = \pi (s_t)$

- 언제나 given state에 대해 동일한 답을 제공한다.

- 일반적으로 pervious states와 action에 근거한다. 

- MDP에서 deterministic policies에서 state transition도 current state에만 의존한다. 

- MDP에서 optimal deterministic policy $\pi$는 언제나 존재한다.

Stochastic (randomized) policies

- 파이는 가능한 actions $a_t$ 에대한 통계 분포를 뜻한다.

$a_1$ ~ $\pi(a | s_t), \sum_a \pi(a|s_t) = 1$

- 이러한 분포는 현재 S의 값에 근거한다.

- deterministic policy가 아닌 stochastic policy를 사용한다면, 동일한 state 라고 할지라도 지난번에 내린 결정과 다른 결정을 만들수도 있다. 

- transition probabilities가 알려져있다면, deterministic policy인 $\pi$만 고려하면되지만, 그렇지 않은 경우에는 actions의 randomization으로 모델에 대한 더 좋은 estimation을 위한 exploration을 제공할수 있다. 

- 이러한 상황은 fully obseravle Markov environment보다, partially observed한 환경 (pomdp) 에서 확인 할 수 있다.


exploration and exploitation dilemma

- 고려할 multiple possible actions이 없는 supervised나 unsupervised에서는 발생하지 않는다.

- 그러나 강화학습에서는 여러가지 행동중에서 one possible action 를 선택해야하고, maximize the total reward 하는것이 전체의 목표이다.

-  agent가 주어진 환경에서 각기 다른 action 을 함으로써, 나중에 더 많은 reward를 받을수 있는 환경을 만들어지기도 한다.

- 따라서 다른 action이나 다른 state를 시도하기도 한다. 

- exploration: 더 좋은 actions이나 states를 찾고, inferior rewards를 더한다. 랜덤한 액션을 때때로 취하면서, good actions나 states를 찾아야한다.  그러나 이런식의 trial-and-error method를 계속하다보면, bad actions with low rewards를 가지게 될수있다. 

- exploitation: high reward를 주는 state만 revisit 하거나 action을 반복ghrdms previous visits에서 하는 방법. 이러한 접근법은 good action을 줄수는 있지만,  best action이 아닐 가능성이 높다. 왜냐하면, 어느 특정조합이 더 좋은 reward를 줄수 있지만, agent는 exploitation만 하게되면 이러한 전체적인 상황은 모르기 때문이다. 

- 이둘을 동시에 할수 없기 떄문에, 적절한 혼합사용이 필요하고, universal answers가 있지 않다. 

- agent가 environment가 실시간으로 교류하는 online reinforcement learning에 한해서만 이러한 딜레마가 적용되고, batch-mode의 경우에 있어서는 또다른 agent의 action으로 인해 얻어진 data가 있기때문에, 반드시 optimal 한것이 아닐지라도 이미 exploration, exploitation dilemma를 겪었다고 할수 있다. 


Select all correct answers

1.  Stochastic policies can be used for Exploration, or in settings where transition probabilities of a MDP are unknown.

2. Deterministic policy is a policy at = p (st) that gives a fixed action for each state of the world.

3. An optimal deterministic policy always exists for any Markov Decision Process (MDP).

4. An optimal deterministic policy always exists for any Partially Observable Markov Decision Process (POMDP).

5. The Exploration-Exploitation dilemma refers to the need to both collect rewards from good known combinations of actions and states, and keep trying new actions to see if they can produce yet better rewards.

6. Deterministic policies can be easily obtained from stochastic policies by fixing a random seed.

Answer 1,2,3,5

This is a translated note for the coursera course (linked below).  

https://www.coursera.org/learn/reinforcement-learning-in-finance/lecture/PZbAt/introduction-to-markov-decision-processes-and-reinforcement-learning-in-finance