์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- AWS
- ๋ด์ค๋ ํฐ
- ๋ ผ๋ฌธ์ฝ๊ธฐ
- leetcode
- ๋ฐ๋์ฒด
- ์ธ๊ณต์ง๋ฅ
- Python
- ์ฟผ๋ฆฌ
- oracle
- ์ฟผ๋ฆฌ๋ฌธ
- Paperreading
- ๋ฆฌํธ์ฝ๋
- ์ฝ๋ฉํ ์คํธ
- ํ๋ก๊ทธ๋๋จธ์ค
- ์ฝํ ์ค๋น
- CNN
- ์ธํ๋ ์ด์
- SQL
- ์ฝํ
- ๋ฅ๋ฌ๋
- ํ์ด์ฌ
- solvesql
- spark
- ChatGPT
- AI
- Gan
- ์ ํ
- API
- ์๋ง์กด
- NLP
- Today
- Total
On the journey of
[Deep Reinforcement Learning Hands On] Chapter.01 ๋ณธ๋ฌธ
[Deep Reinforcement Learning Hands On] Chapter.01
dlrpskdi 2023. 8. 4. 08:58Chapter 1. What is Reinforcement Learning?
๐ก Reinforcement Learning (RL) : an approach that natively incorporates extra dimension (which is usually time, but not necessarily) into learning equations
๊ฐํํ์ต : ์ด๋ค ํ๊ฒฝ ์์์ ์ ์๋ ์์ด์ ํธ๊ฐ ํ์ฌ์ ์ํ๋ฅผ ์ธ์ํ์ฌ, ์ ํ ๊ฐ๋ฅํ ํ๋๋ค ์ค ๋ณด์์ ์ต๋ํํ๋ ํ๋ ํน์ ํ๋ ์์๋ฅผ ์ ํํ๋ ๋ฐฉ๋ฒ์ ํตํด ํ์ต
Learning - supervised, unsupervised, and reinforcement
์ง๋, ๋น์ง๋ ํ์ต๊ณผ ๋น๊ต๋ฅผ ํตํด ๊ฐํ ํ์ต์ ํน์ง์ ์ ์
- supervised learning ์ง๋ ํ์ต
- main objective : we have many examples of the input and desired output, and we want to learn how to generate the output for some future, currently unseen inputs
- ex) text classification, image classification, regression problems etc
- 2. unsupervised learning ๋น์ง๋ ํ์ต
- main objective : to learn some hidden structure of the dataset at hand
- assumes no supervision that has no known labels assigned to our data
- ex) clustering, GANs
- reinforcement learing ๊ฐํํ์ต
- lays somewhere in between full supervision and a complete lack of predefined labels
- uses many well- established methods of supervised learning, but in a different way
๐ ๊ฐํํ์ต์ ๋จธ์ ๋ฌ๋์ ํ ์์ญ์ผ๋ก, ์ง๋ํ์ต์ ๋ฐฉ๋ฒ๋ก ์ ์ด์ฉํ๋ฉด์ ๋น์ง๋ํ์ต์ฒ๋ผ ๋ผ๋ฒจ๋ง์ ํ์๋ก ํ์ง ์๋ ๋ ํนํ ํ์ต๋ฒ์ด๋ค.
Figure 1 : Robot mouse maze world
- environemnt : a maze with food at some points and electricity at others
- robot mouse : can take actions such as turn left/right and move forward
- can observe the full state of the maze to make a decision about the actions
- trying to find as much food as possible, while avoiding an electric shock whenever possible
final goal of the agent is to get as much total reward as possible
- RL doesn’t work with predefined labels, so there’s no label for good or bad or the best direction
- three state in reward system : positive, negative, neutral
- what makes RL tricky?
- having non-i.i.d data (i.i.d : independent and identically distributed) ๊ฐ๊ฐ์ ๋๋ค ๋ณ์๋ค์ด ๋์ผํ ํ๋ฅ ๋ถํฌ๋ฅผ ๊ฐ์ง์ง ์์ sqential ์๊ณ์ด์ฑ์ด ์ค์
- observation in RL depends on an agent's behavior and to some extent, it is the result of their behavior
- the observations tell nothing about the action of your agent even it decides to do inefficient things
- if the agent is stubborn and keeps making mistakes, the observations can make the false impression, which is totally wrong
- exploration/exploitation dilemma ์ด์ฉ๊ณผ ํํ ์ฌ์ด์ ๊ท ํ
- your agent needs to not only exploit the policy they have learned, but to actively explore the environment
- by doing things differently we can significantly improve the outcome we get but, too much exploration may also seriously decrease the reward
- need to find a balance between these two activities
- reward can be seriously delayed from actions ํ๋์ ๋ํ ํผ๋๋ฐฑ์ด ์ฆ๊ฐ์ ์ด์ง ์๊ณ ์ง์ฐ ๊ฐ๋ฅ
- we need to discover such casualties, which can be tricky to do over the flow of time and our actions
- having non-i.i.d data (i.i.d : independent and identically distributed) ๊ฐ๊ฐ์ ๋๋ค ๋ณ์๋ค์ด ๋์ผํ ํ๋ฅ ๋ถํฌ๋ฅผ ๊ฐ์ง์ง ์์ sqential ์๊ณ์ด์ฑ์ด ์ค์
RL formalisms and relations
- Figure 2 : RL entities and their communications
- Reward ๋ณด์
- a scalar value we obtain periodically from the environment
- purpose : to tell our agent how well they have behaved
- don't define how frequently the agent receives this reward
- local - reflects the success of the agent's recent activity
- reinforce agent’s behavior in a positive or negative way - agent’s goal is to achieve the largest accumulated reward over its sequence of actions
- The agent ์์ด์ ํธ
- somebody or something who/which interacts with the environment by executing certain actions, taking observations, and receiving eventual rewards for this
- supposed to solve some problem in a more-or-less efficient way
- The environment ํ๊ฒฝ
- everything outside of an agent
- agent’s communication with the environment is limited by rewards, actions and observations
- Actions ํ๋
- things that an agent can do in the environment
- two types of actions - discrete or continuous
- Observations ๊ด์ฐฐ
- pieces of information the the environment provides the agent
- may be relevant to the upcoming reward or not, even include reward information
Markov decision processes
Markov process ํํธ์์๋ RL(Reinforcement Learning) ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๋ฐ ์ฌ์ฉ๋๋ ๋ฐฉ๋ฒ์ผ๋ก ์ด๋์ ๊ฐ๋ฅํ๊ฒ ํ๋ RL์ ์ด๋ก ์ ํ ๋๋ฅผ ์ตํ ๊ฒ
๋จผ์ ๋ฐฉ๊ธ ๋ ผ์ํ formalisms(reward, agent, actions, observations, and environment)์ ์ํ์ ํํ๊ณผ ๊ฐ๋ ์ ์๊ฐํ๊ณ , ์ด๊ฒ์ ๊ธฐ์ด๋ก ํ์ฌ ์ฐ๋ฆฌ๋ state, episode, history, value, gain์ ํฌํจํ RL์ธ์ด์ 2์ฐจ์ ๊ฐ๋ ์ ์๊ฐํ๋๋ฐ, ์ด๋ ์ฑ ์ ํ๋ฐ๋ถ์์ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ ์ค๋ช ํ๋๋ฐ ๋ฐ๋ณต์ ์ผ๋ก ์ฌ์ฉ๋จ. ๊ทธ๋ฆฌ๊ณ Markov decision process์ ๋ํ ์ฐ๋ฆฌ์ ์ค๋ช ์ ๋ฌ์์ ๋งํธ๋ฃ์์นด ์ธํ๊ณผ ๊ฐ์
<๋ฌ์์ ๋งํธ๋ฃ์์นด ์ธํ>
์ฐ๋ฆฌ๋ Markov Process(MP : Markov chain)์ ๊ฐ์ฅ ๋จ์ํ ์ฌ๋ก์์ ์์ํ์ฌ rewards๋ก ํ์ฅํ์ฌ Markov reward processes๋ก ์ ํ
๊ทธ๋ฐ ๋ค์ actions์ ์ถ๊ฐํ์ฌ ์ด ์์ด๋์ด๋ฅผ ๋ค๋ฅธ ๋ดํฌ์ ๋ฃ์์ผ๋ก์จ Markov Decision Processes(MDPs)๋ก ์ด์ด์ง ๊ฒ
Markov processes์ Markov decision processes๋ computer science์ ๋ค๋ฅธ ๊ณตํ๋ถ์ผ์์ ๋๋ฆฌ ์ฌ์ฉ๋จ
Markov process
Markov process๋ Markov chain์ด๋ผ๊ณ ๋ ์๋ ค์ ธ ์์
๋น์ ์์ ์ค์ง ์ฌ๋ฌ๋ถ์ด ๊ด์ฐฐํ ์ ์๋ ์ด๋ค ์์คํ ์ด ์๋ค๊ณ ์์ํด๋ณด๊ณ , ์ฌ๋ฌ๋ถ์ด ๊ด์ฐฐํ๋ ๊ฒ์ states๋ผ๊ณ ํ๋ฉฐ, ์์คํ ์ ์ญํ ๋ฒ์น์ ๋ฐ๋ผ ์ ํํ ์ ์๋ค๊ณ ํจ.
์ด๋ ๋น์ ์ ์์คํ ์ ์ํฅ์ ์ค ์ ์๊ณ ์ค์ง ์ํ๊ฐ ๋ณํํ๋ ๊ฒ์ ์ง์ผ๋ณผ ๋ฟ์ด๋ฉฐ, ์์คํ ์ ๋ํ ๊ฐ๋ฅํ ๋ชจ๋ ์ํ๋ state space๋ผ๋ ์งํฉ์ ํ์ฑํ๋๋ฐ Markov processes์์ ์ฐ๋ฆฌ๋ ์ด ์ํ ์งํฉ์ด ์ ํํด์ผ ํ๋ค๊ณ ๊ฐ์ (๊ทธ๋ฌ๋ ๋งค์ฐ ํด ์ ์์)
๊ด์ธก์น๋ ์ผ๋ จ์ states ๋๋ ์ฒด์ธ์ ํ์ฑ(์ด ๋๋ฌธ์ Markov processes๋ฅผ Markov chains๋ผ๊ณ ๋ ํจ)
์๋ฅผ ๋ค์ด, ์ด๋ค ๋์์ ๊ฐ์ฅ ๊ฐ๋จํ ๋ ์จ ๋ชจ๋ธ์ ๋ณด๋ฉด, ์ฐ๋ฆฌ๋ ์ฃผ ๊ณต๊ฐ์ธ ํ์ฌ ๋ ์ ๋ง๊ฑฐ๋ ๋น๊ฐ ์ค๋ ๊ฒ์ผ๋ก ๊ด์ฐฐํ ์ ์์
์๊ฐ์ ๋ฐ๋ฅธ ์ผ๋ จ์ ๊ด์ธก์ [sunny, sunny, rainy, sunny, ...]์ ๊ฐ์ ์ผ๋ จ์ ์ฒด์ธ์ ํ์ฑํ๋ฉฐ ์ด๊ฒ์ history๋ผ๊ณ ๋ถ๋ฆ
์ด๋ฌํ ์์คํ ์ Markov Process๋ผ ๋ถ๋ฅด๊ธฐ ์ํด์๋ Markov property๋ฅผ ์ถฉ์กฑํด์ผ ํ๋๋ฐ, ์ด๋ ์ด๋ค ์ํ์์๋ ๋ฏธ๋์ ์์คํ ์ญํ์ ์ด ์ํ์๋ง ์์กดํด์ผ ํ๋ค๋ ๊ฒ์ ์๋ฏธ
Markov property์ ์์ ์ ์์คํ ์ ๋ฏธ๋๋ฅผ ์ค๋ช ํ๊ธฐ ์ํด ๊ด์ธก ๊ฐ๋ฅํ ๋ชจ๋ ์ํ๋ฅผ ์ค์ค๋ก ํฌํจ์ํค๋ ๊ฒ
๋ค์ ๋งํด, Markov property๋ ์์คํ ์ํ๊ฐ ์๋ก ๊ตฌ๋ณ๋ ์ ์๊ณ ๊ณ ์ ํด์ผํ๋ฉฐ, ์์คํ ์ ๋ฏธ๋ ์ญํ์ ๋ชจ๋ธ๋งํ๋ ๋ฐ ํ๋์ ์ํ๋ง ํ์ํ๋ฉฐ ์ ์ฒด history๋ ์๋์ด์ผ ํจ
์ฐ๋ฆฌ์ ๋ ์จ ์์ ์ ๊ฒฝ์ฐ, Markov property๋ ์ฐ๋ฆฌ๊ฐ ๊ณผ๊ฑฐ์ ๋ดค๋ ๋ง์ ๋ ์ ์์ ์๊ด์์ด ๊ฐ์ ํ๋ฅ ๋ก ๋ง์ ๋ ์ด ๋น๊ฐ ์ค๋ ๋ ๋ค์ ์ฌ ์ ์๋ ๊ฒฝ์ฐ์๋ง ๋ชจ๋ธ์ ๋ํ๋ด๋๋ก ์ ํํจ
์์์ ์ผ๋ก ๋ด์ผ ๋น๊ฐ ์ฌ ๊ฐ๋ฅ์ฑ์ ํ์ฌ ์ํ๋ฟ๋ง ์๋๋ผ ๊ณ์ , ์๋, ๊ทธ๋ฆฌ๊ณ ๊ทผ์ฒ์ ์ฐ๊ณผ ๋ฐ๋ค์ ์กด์ฌ์ ๊ฐ์ ๋ง์ ์์๋ค์ ๋ฌ๋ ค์๋ค๋ ๊ฒ์ ์๊ณ ์๊ธฐ ๋๋ฌธ์ ๊ทธ๋ค์ง ํ์ค์ ์ธ ๋ชจ๋ธ์ ์๋
ํ์ ํ๋์กฐ์ฐจ๋ ๋ ์จ์ ํฐ ์ํฅ์ ๋ฏธ์น๋ค๋ ๊ฒ์ด ์ต๊ทผ์ ์ฆ๋ช ๋์๊ณ , ๋ฐ๋ผ์ ์ฐ๋ฆฌ์ ์๋ ์ ๋ง ์์งํ์ง๋ง ํ๊ณ๋ฅผ ์ดํดํ๊ณ ๊ทธ๊ฒ์ ๋ํ ์์์ ์ธ ๊ฒฐ์ ์ ๋ด๋ฆฐ๋ค๋ ๊ฒ์ด ์ค์ํจ
๋ฌผ๋ก , ๋ชจ๋ธ์ ๋ ๋ณต์กํ๊ฒ ๋ง๋ค๊ณ ์ถ๋ค๋ฉด, ์ฐ๋ฆฌ๋ ํญ์ state space๋ฅผ ํ์ฅํ ์ ์๊ณ ์ด๊ฒ์ ์ฐ๋ฆฌ๊ฐ ๋ ๋ง์ ์์กด์ฑ์ ํฌ์ฐฉํ ์ ์๊ฒ ํ ๊ฒ
์๋ฅผ ๋ค์ด, ์ฌ๋ฆ๊ณผ ๊ฒจ์ธ ๋์ ๋น๊ฐ ์ฌ ํ๋ฅ ์ ๋ณ๋๋ก ํ๋ณดํ๋ ค๋ฉด ํด๋น ๊ณ์ ์ ์ํ์ ํฌํจํ ์ ์์
์ด ๊ฒฝ์ฐ์ state space๋ [sunny+summer, sunny+winter, rainy+summer, rainy+winter]์ด ๋จ
์์คํ ๋ชจ๋ธ์ด Markov property๋ฅผ ์ค์ํ๋ฏ๋ก NxN ํฌ๊ธฐ์ ์ ๊ณฑํ๋ ฌ์ธ transition matrix๋ฅผ ์ฌ์ฉํ์ฌ ํ๋ฅ ์ ํ๋ณดํ ์ ์์
์ฌ๊ธฐ์ N์ ๋ชจ๋ธ์ ์ํ ์๋ฅผ ์๋ฏธํ๊ณ ํ๋ ฌ์ ํ i์ ์ด j์ ์๋ ๋ชจ๋ ์ ์ ์์คํ ์ด ์ํ i์์ ์ํ j๋ก ์ ํ๋ ํ๋ฅ ์ ํฌํจ
์๋ฅผ ๋ค์ด, sunny/rainy๊ฐ ์ค๋ ์์์์ ์ ์ด ํ๋ ฌ์ ๋ค์๊ณผ ๊ฐ์ ์ ์์
sunny | rainy | |
sunny | 80% | 20% |
rainy | 10% | 90% |
์ด ๊ฒฝ์ฐ, ๋ง์ ๋ ์ด ์๋ค๋ฉด, ๋ค์ ๋ ์ด ๋ง์ ํ๋ฅ ์ 80%์ด๊ณ , ๋ค์ ๋ ์ด ๋น๊ฐ ์ฌ ํ๋ฅ ์ 20%์ด๊ณ ๋ง์ฝ ์ฐ๋ฆฌ๊ฐ ๋น๊ฐ ์ค๋ ๋ ์ ๊ด์ฐฐํ๋ค๋ฉด, ๋ ์จ๊ฐ ์ข์์ง ํ๋ฅ ์ 10%์ด๊ณ , ๋ค์๋ ๋น๊ฐ ์ฌ ํ๋ฅ ์ 90% ์
Markov process์ ๊ณต์์ ์ ์๋ ๋ค์๊ณผ ๊ฐ์
- ์์คํ ์ด ์์ ์ ์๋ ์ํ ์งํฉ(S)
- ์์คํ ์ญํ์ ์ ์ํ๋ ์ ์ด ํ๋ฅ ๊ณผ ์ ์ด ํ๋ ฌ(T)
MP์ ์ ์ฉํ ์๊ฐ์ ํํ์ ์์คํ ์ํ์ ๊ฐ์ฅ์๋ฆฌ์ ํด๋นํ๋ ๋ ธ๋๊ฐ ์๋ ๊ทธ๋ํ์ด๋ฉฐ, ์ํ์์ ์ํ๋ก์ ๊ฐ๋ฅํ ์ ํ์ ๋ํ๋ด๋ ํ๋ฅ ๋ก ๋ ์ด๋ธ์ด ์ง์ ๋จ
์ ์ด ํ๋ฅ ์ด 0์ด๋ฉด ๊ฐ์ฅ์๋ฆฌ๋ฅผ ๊ทธ๋ฆฌ์ง ์๊ณ (ํ ์ํ์์ ๋ค๋ฅธ ์ํ๋ก ์ด๋ํ๋ ๋ฐฉ๋ฒ์ ์์) ์ด๋ฌํ ์ข ๋ฅ์ ํํ์ automata theory์์ ์ฐ๊ตฌ๋๋ finite state machine์์๋ ๋๋ฆฌ ์ฌ์ฉ๋จ
sunny/rainy ๋ ์จ ๋ชจ๋ธ์ ๊ฒฝ์ฐ ๊ทธ๋ํ๋ ๋ค์๊ณผ ๊ฐ์
<Sunny/Rainy weather model>
๋ ๋ณต์กํ ์๋ฅผ ๋ค์ด๋ณด๋ฉด, ์ง์ฅ์ธ์ ๋ ๋ค๋ฅธ ๋ชจ๋ธ(Scott Adams์ ์ ๋ช ํ ๋งํ์ ๋์ค๋ ์ฃผ์ธ๊ณต Dilbert๊ฐ ์ข์ ์)์ ์๊ฐํด๋ด
์ด ์์์์ state space๋ ๋ค์๊ณผ ๊ฐ์
- Home : ์ฌ๋ฌด์ค์ ์์
- Computer : ์ฌ๋ฌด์ค์์ ์ปดํจํฐ๋ก ์ผํ๊ณ ์์
- Coffee : ์ฌ๋ฌด์ค์์ ์ปคํผ๋ฅผ ๋ง์๊ณ ์์
- Chatting : ์ฌ๋ฌด์ค์์ ๋๋ฃ๋ค๊ณผ ๋ฌด์ธ๊ฐ๋ฅผ ์๋ ผํ๊ณ ์์
์ํ ์ ํ ๊ทธ๋ํ๋ ๋ค์๊ณผ ๊ฐ์
<State transition graph>
์ฐ๋ฆฌ๋ ๊ทธ์ ๊ทผ๋ฌด์ผ์ด ๋ณดํต Home์์ ์์๋๋ฉฐ ์์ธ ์์ด ํญ์ Coffee์ ํจ๊ป ๊ทผ๋ฌด๋ฅผ ์์ํ๊ธธ ๊ธฐ๋ํจ(no Home → Computer edge and no Home → Chatting edge)
์ ๋ค์ด์ด๊ทธ๋จ์ ๋ํ ๊ทผ๋ฌด์ผ์ด ํญ์ ์ปดํจํฐ ์ํ์์ ์ข ๋ฃ๋จ์ ๋ํ๋ด๊ณ ์ด์ ๋ค์ด์ด๊ทธ๋จ์ ์ ์ด ํ๋ ฌ์ ๋ค์๊ณผ ๊ฐ์
Home | Coffee | Chat | Computer | |
Home | 60% | 40% | 0% | 0% |
Coffee | 0% | 10% | 70% | 20% |
Chat | 0% | 20% | 50% | 30% |
Computer | 20% | 20% | 10% | 50% |
์ ํ ํ๋ฅ ์ ๋ค์๊ณผ ๊ฐ์ด ์ํ ์ ์ด ๊ทธ๋ํ์ ์ง์ ๋ฐฐ์นํ ์ ์์
<State transition graph with transition probabilities>
์ค์ ๋ก, ์ฐ๋ฆฌ๋ ์ ํํ ์ ์ด ํ๋ ฌ์ ์๋ ๊ฒ์ ๊ฑฐ์ ๋ถ๊ฐ๋ฅํจ
ํจ์ฌ ๋ ์ค์ ์ ์ธ ์ํฉ์ ์์คํ ์ํ์ ๋ํ ๊ด์ฐฐ๋ง ์์ ๋์ด๋ฉฐ, ์ด๋ฅผ episode๋ผ๊ณ ํจ
- home -> coffee -> coffee -> chat -> chat -> coffee -> computer -> computer -> home
- computer -> computer -> chat -> chat -> coffee -> computer -> computer -> computer
- home -> home -> coffee -> chat -> computer -> coffee -> coffee
์ฐ๋ฆฌ์ ๊ด์ฐฐ์ ์ํด ์ ์ด ํ๋ ฌ์ ์ถ์ ํ๋ ๊ฒ์ ๋ณต์กํ์ง ์์; ์ฐ๋ฆฌ๋ ๋จ์ง ๋ชจ๋ ์ํ์์ ๋ชจ๋ ์ ์ด๋ฅผ ์ธ๊ณ ๊ทธ๊ฒ๋ค์ 1์ ํฉ์ผ๋ก ์ ๊ทํํ๋ฉด ๋จ
๊ด์ธก ๋ฐ์ดํฐ๊ฐ ๋ง์์๋ก ์ถ์ ์น๋ ์ค์ ๊ธฐ๋ณธ ๋ชจํ์ ๋ ๊ฐ๊น์ธ ๊ฒ
๋ํ Markov property๋ stationarity(์ฆ, ๋ชจ๋ ์ํ์ ๋ํ ๊ธฐ๋ณธ ์ ์ด ๋ถํฌ๋ ์๊ฐ์ด ์ง๋จ์ ๋ฐ๋ผ ๋ณํ์ง ์์)์ ์๋ฏธํ๋ค๋ ์ ์ ์ฃผ๋ชฉํ ํ์๊ฐ ์์
Nonstationarity๋ ์ฐ๋ฆฌ์ ์์คํ ์ญํ์ ์ํฅ์ ๋ฏธ์น๋ ์จ๊ฒจ์ง ์์ธ์ด ์๋ค๋ ๊ฒ์ ์๋ฏธํ๋ฉฐ, ์ด ์์ธ์ ๊ด์ฐฐ์ ํฌํจ๋์ง ์์
๊ทธ๋ฌ๋ ์ด๋ ์ ์ด ์ด๋ ฅ์ ๊ด๊ณ์์ด ๋์ผํ ์ํ์ ๋ํด ๊ธฐ๋ณธ ํ๋ฅ ๋ถํฌ๊ฐ ๋์ผํด์ผ ํ๋ Markov property์ ๋ชจ์๋จ
ํ ์ํผ์๋์์ ๊ด์ฐฐ๋ ์ค์ ์ ์ด์ ์ ์ด ํ๋ ฌ์์ ์ฃผ์ด์ง ๊ธฐ๋ณธ ๋ถํฌ ์ฌ์ด์ ์ฐจ์ด๋ฅผ ์ดํดํ๋ ๊ฒ์ด ์ค์
์ฐ๋ฆฌ๊ฐ ๊ด์ฐฐํ๋ ๊ตฌ์ฒด์ ์ธ ์ํผ์๋๋ ๋ชจ๋ธ์ ๋ถํฌ์์ ๋ฌด์์๋ก ์ํ๋ง๋๋ฏ๋ก ์ํผ์๋๋ง๋ค ๋ค๋ฅผ ์ ์์ผ๋ ํ๋ณธ์ด ์ถ์ถ๋ ๊ตฌ์ฒด์ ์ธ ์ ์ด ํ๋ฅ ์ ๋์ผํ๊ฒ ์ ์ง, ๊ทธ๋ ์ง ์์ผ๋ฉด Markov chain formalism์ ์ ์ฉ๋์ง ์์
์ด์ ๋ ๋์๊ฐ Markov process ๋ชจ๋ธ์ ํ์ฅํ์ฌ RL ๋ฌธ์ ์ ๋ ๊ฐ๊น๊ฒ ๋ง๋ค ์ ์์ :)
Markov reward process (MRP; ๊ฐํํ์ต์ ํํํ๊ธฐ ์ํ ํ๋ฅ ๋ชจ๋ธ)
- ์์ฌ๊ฒฐ์ ๊ณผ์ ์ ํ๋ฅ ๊ณผ ๊ทธ๋ํ๋ฅผ ์ด์ฉํ์ฌ ๋ชจ๋ธ๋งํ ๊ฒ์ผ๋ก, ๊ธฐ์กด์ MP์ R ๊ณผ ๊ฐ๋ง(Discount factor; ํ ์ธ์์)๊ฐ ์ถ๊ฐ๋ ๋ชจ๋ธ์ด๋ค.
-MP๋ Markov Process์ ์ค์๋ง๋ก MP(์๋ MP)๊ฐ ์ ์ ๋ ์ํฉ(๋ค์ ์ํ๋ ํ์ฌ์ํ์๋ง ์์กดํ๋ฉฐ, ํ๋ฅ ์ ์ผ๋ก ๋ณํ๋ ๊ฒฝ์ฐ)์ ์ํ ๋ณํ
cf.MP(Markov Property): ‘ํ๋ฅ ’ state์์ ๋ฏธ๋ ์ํ ์์ธก ์ ๊ณผ๊ฑฐ๊ฐ ์๋, ‘ํ์ฌ ์ํ’๋ง์ ๊ณ ๋ คํ๊ฒ ๋ค๋ ๊ฐ์
MDP์์์ Reward๋ ์๋ ์ด๋ฏธ์ง์ ๊ฐ์ :
์์ ๊ฐ์ ์์ ๋ฐ๋ฅด๋ฉฐ ์ด์์ ์กฐ๊ฑด๋ถ ํ๊ท (๊ธฐ๋๊ฐ)์ ๊ตฌํ๊ฒ ๋๋ฉด
2. ์ถ๊ฐ์ค๋ช (์ถ๊ฐ์์)
-Reward ํจ์(R): ํ์ฌ state์ ๋ํ reward์ ๊ธฐ๋๊ฐ์ ํํํ๋ ํจ์
-Gamma ๊ฐ(๊ฐ์์ธ์) : ๋ถํ์ค์ฑ์ ํํํ๋ฉฐ, 0~1 ์ฌ์ด์ ๊ฐ์ ๊ฐ์ง๋ฉด์ ๋ฏธ๋์ ๋ณด์(return)์ ์ต์ํํ๋ ์ญํ ์ ํ๋ค.
-์ต์ข ์ ์ผ๋ก ๋ฏธ๋์ ๋ณด์์ ์๊ฒ ํ๋ ๊ฒ์ด ๊ฐํํ์ต์ ๋ชฉ์ ์ด๊ธฐ ๋๋ฌธ(์ต์ ๊ฒฝ๋ก๋ก ๊ฐ๋ค๊ณ ์๊ฐํ๋ฉด ๋จ)
2-1. ๊ต์ฌ ์์ (A diagram with rewards); figure 7
*Interpretation: v(s) - ๊ธฐ๋๊ฐ(MRP๋ก ์ป์ ์ ์์ ๊ฒ์ผ๋ก ์์๋๋ ํ๊ท ๊ฐ)
์ ๊ทธ๋ฆผ์์์ ์ซ์๋ return values๋ฅผ ์๋ฏธํ๋ค.
๊ฐ. Dilbert Reward Process (DRP)๋ฅผ ์ฌ์ฉํ ์ถ์
Q. Gamma(๊ฐ์์ธ์) = 0์ผ ๋ , Chat ์ํ์์์ ๋ณํ ์๊ฐํ๊ธฐ
A. Depends on chance(Gamma๋ฅผ ๋ชจ๋ฅผ ๋). But ์ง๊ธ์ Gamma=0์์ ์๋๊น ๊ณ์ฐํด๋ณด์.
Why ?
- Dilbert Process์ ์ํ๋ฉด Chat ์ํ์์ ํฌ๊ฒ 3๊ฐ์ง ์ง๋ก(?)๊ฐ ๊ฐ๋ฅ
- 50%(0.5) - Chat
- 30%(0.3) - Computer
- 20%(0.2) - Coffee
- ์ด๋, ์ ์ ์์ ๊ฐ๋ง๊ฐ=0์ด๋ผ๊ณ ํ์์ผ๋ฏ๋ก, ์ค๋ก์ง ํ๋ฅ ๋ง์ผ๋ก Chat ์ํ์์์ value๋ฅผ ์ธก์ ํด์ผ ํจ.
์ธก์ (๊ณ์ฐ) ๋ฐฉ์์ ์ฐ๋ฆฌ๊ฐ ์๋ ‘๊ธฐ๋๊ฐ ๊ตฌํ๋’ ๋ฐฉ์๊ณผ ๋๊ฐ๋ค:
: ๊ฐ์ฅ valuable state๋Computer์ด ๋๋ ๊ฒ
๋ง์ฐฌ๊ฐ์ง ๋ฐฉ์์ผ๋ก ๊ฐ๋ง๊ฐ=1์ผ ๋์ value๋ฅผ ์ธก์ ํด ๋ณธ๋ค๋ฉด?
-์ด๋ฐ ๊ฒฝ์ฐ ๋ฏธ๋ ์ํ์ ๋ฌดํํ ๊ฐ๋ฅ์ฑ์ ๋ํด ์ถ๋ก ํ๊ฒ ๋๊ธฐ์ ‘infinite for all states’๋ผ๋ ๊ฒฐ๋ก ์ด ๋์ถ
3.Markov decision process(MDP; ๋ง๋ฅด์ฝํ ๊ฒฐ์ ๊ณผ์ )
: MRP + Decision(๊ฒฐ์ )์ ๊ฒฐํฉํ ๊ฒ์ผ๋ก, reward values์ decisions๋ฅผ ๊ฐ์ด ๊ณ ๋ คํ๋ ๊ณผ์ ์ด๋ค.
: MRP์์ ๊ฐ์ฅ ํฐ ์ฐจ์ด๋ agent(state)์๊ฒ ์ ํ์ง๊ฐ ์ฃผ์ด์ง๋์ง ๊ทธ ์ฌ๋ถ๋ผ๊ณ ๋ณผ ์ ์๋ค(action).
MRP์์ ํ์ต์ด ๋ถ๊ฐํ๋ค. ์ ํด์ง ํ๋ฅ ์ ์ํด transition(์ ์ด)๋๊ณ , ์ ํด์ง ์์ ๋ณด์์ ๋ฐ๊ธฐ ๋๋ฌธ.
MDP์์ action์ผ๋ก๋ถํฐ ์ป์ reward๋ฅผ ํตํด value(๊ฐ์น)๋ฅผ ๋งค๊ธฐ๊ณ , ์ด๋ฅผ ๋ค์ ๊ฐ์ ์ํ(state)์์์ ์ ํ ์์ ์ฐธ๊ณ ํ๊ฒ ๋๋ค.
3-1. action(Agent์ action)
: agent์ ๊ด์ ์์ value๋ฅผ ํ๊ฐํ๋ค. state์ ๋ํ value๋ฟ ์๋๋ผ, agent๊ฐ ํ๋ action์ ๋ํด์๋ value๋ฅผ ์ธก์ ํ๊ฒ ๋๋ ๊ฒ.
3-2. policy: action์ ์ ํ๋ ํจ์(Mapping ํจ์)
์์์ผ๋ก๋ ์๋ ์ด๋ฏธ์ง์ ๊ฐ๋ค.
'Experiences & Study > ์ด๋ธ์(KIBWA)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Deep Reinforcement Learning Hands On] Chapter.04 (0) | 2023.08.04 |
---|---|
[Deep Reinforcement Learning Hands On] Chapter.02 (0) | 2023.08.04 |
[์ด๋ธ์] ๊ฐํํ์ต์ ๊ตฌ์ฑ ์์์ ๊ทธ ์ข ๋ฅ ํบ์๋ณด๊ธฐ (0) | 2023.06.26 |
[์ด๋ธ์] DQN ์๊ณ ๋ฆฌ์ฆ๊ณผ ๊ฐํํ์ต, ์ฃผ๊ฐ์์ธก (2) (0) | 2023.06.25 |
[์ด๋ธ์] DQN ์๊ณ ๋ฆฌ์ฆ๊ณผ ๊ฐํํ์ต, ์ฃผ๊ฐ์์ธก (0) | 2023.06.25 |