Introduction

ClassificationPrediction using RL like DQN.
Different
Existing deep learning is a method of increasing the accuracy of a model through a network.
DQN is a reinforcement learning method in which Q values are selected and acted through a model.
- Usually, RL does not used to  solve classification or Prediction problems.
DQN code used in the game is analyzed and refactored to be used.

 

- ๊ฐ•ํ™”ํ•™์Šต ์•Œ๊ณ ๋ฆฌ์ฆ˜์ธ DQN์„ ์‚ฌ์šฉํ•ด์„œ ๋ถ„๋ฅ˜ ๋ฐ ์˜ˆ์ธก์„ ์‹œ๋„ํ•จ
- ์ผ๋ฐ˜ ๋”ฅ๋Ÿฌ๋‹๊ณผ ๋‹ค๋ฅธ ์ 
๊ธฐ์กด ๋”ฅ๋Ÿฌ๋‹์€ ๋„คํŠธ์›Œํฌ๋ฅผ ํ†ตํ•ด ๋ชจ๋ธ์˜ ์ •ํ™•๋„๋ฅผ ์˜ฌ๋ฆฌ๋Š” ๋ฐฉ์‹์ด๋ผ๋ฉด
DQN์€ ๋ชจ๋ธ์„ ํ†ตํ•ด Q๊ฐ’์„ ๊ณจ๋ผ์„œ ํ–‰๋™์„ ํ•˜๋Š” ๊ฐ•ํ™”ํ•™์Šต ๋ฐฉ์‹์ด๋‹ค. 
- ๊ฐ•ํ™”ํ•™์Šต์œผ๋กœ๋Š” ๋ณดํ†ต ๊ฒŒ์ž„, ๋กœ๋ด‡๊ณผ ๊ฐ™์€ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•œ๋‹ค.

๊ฐ•ํ™”ํ•™์Šต์œผ๋กœ ๋ณดํ†ต classification์ด๋‚˜ prediction ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜์ง€ ์•Š๊ธฐ์— ๊ฒŒ์ž„์—์„œ ์‚ฌ์šฉ๋˜๋Š” DQN ์ฝ”๋“œ๋ฅผ ๋ถ„์„ํ•˜๊ณ  ๋ฆฌํŒฉํ† ๋งํ•˜์—ฌ ์‚ฌ์šฉํ•จ. 

 

 

DQN

Data

Using Titanic Dataset in the Kaggle.
total of 12 attribute values and 891 data.
Using 7 attributes excluding 5 attributes.


๋ฐ์ดํ„ฐ์…‹์€ ์บ๊ธ€์— ํƒ€์ดํƒ€๋‹‰์œผ๋กœ ์‹คํ—˜ํ•ด๋ด„
์ด 12๊ฐœ์˜ ์†์„ฑ๊ฐ’์ด ์žˆ๊ณ , 891๊ฐœ์˜ ๋ฐ์ดํ„ฐ๊ฐ€ ์žˆ์Œ
์ด ์ค‘์—์„œ 5๊ฐœ์˜ ์†์„ฑ ๋นผ๊ณ  7๊ฐœ์˜ ์†์„ฑ๋งŒ ๊ฐ€์ง€๊ณ  ์ง„ํ–‰ํ•ด๋ด„

 

 

Only DNN 

Simple DNN

preprocess it to compare.
Train : Validation = 7:3    to share data.
It proceeds under the same conditions using a simple DNN model.

 

When using a general DNN model using only 7 attribute values,

Train accuracy   : 91.493%
Validation accuracy : 74.254%

Test   : 62.20%

 

๋น„๊ต๋ฅผ ํ•˜๊ธฐ์œ„ํ•ด ์ „์ฒ˜๋ฆฌํ•˜๊ณ ,
Train : Validation = 7:3์œผ๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ๋‚˜๋ˆ”.
๊ฐ„๋‹จํ•œ DNN ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ™์€ ์กฐ๊ฑด์œผ๋กœ ์ง„ํ–‰ํ•จ

 

With DQN

When learning with a Deep Q-Network (DQN) model using DNN

Two Q values according to behavior are received through DNN and output.
Among these values, behavior according to a large value or random behavior according to the set epsilon probability.

Try this action and set +100 reward if it get it right and -100 reward if it get it wrong.
This is stored in the replay memory as [Environment, Action, Correct Answer, Reward].

When it becomes larger than the set value of the replay memory, the model is updated by randomly selecting a sample and learning it.

- Using DQN
Train Accuracy   : 92.616%
Validation Accuracy : 79.85%


Test    : 73.444%
 

DNN์„ ์‚ฌ์šฉํ•œ DQN(Deep Q-Network) ๋ชจ๋ธ๋กœ ํ•™์Šตํ•˜์˜€์„ ๋•Œ
DNN์„ ๊ฑฐ์ณ output์œผ๋กœ ํ–‰๋™์— ๋”ฐ๋ฅธ 2๊ฐ€์ง€์˜ Q๊ฐ’์„ ๋ฐ›์Œ.
์ด ๊ฐ’ ์ค‘์—์„œ ํฐ ๊ฐ’์— ๋”ฐ๋ฅธ ํ–‰๋™์„ ํ•˜๊ฑฐ๋‚˜, ์„ค์ •ํ•œ epsilon ํ™•๋ฅ ์— ๋”ฐ๋ฅธ ๋žœ๋คํ•œ ํ–‰๋™์„ ํ•จ.
์ด ํ–‰๋™์„ ํ•ด๋ณด๊ณ  ๋งž์ถ”๋ฉด +100, ํ‹€๋ฆฌ๋ฉด -100 reward๋ฅผ ์„ค์ •ํ•จ.
์ด๋ฅผ ๋ฆฌํ”Œ๋ ˆ์ด ๋ฉ”๋ชจ๋ฆฌ์— [ํ™˜๊ฒฝ, ํ–‰๋™, ์ •๋‹ต, ๋ฆฌ์›Œ๋“œ]๋กœ ์ €์žฅํ•จ. 
๋ฆฌํ”Œ๋ ˆ์ด ๋ฉ”๋ชจ๋ฆฌ ์„ค์ •ํ•œ ๊ฐ’๋ณด๋‹ค ์ปค์ง€๋ฉด ๊ทธ์ค‘์—์„œ ๋žœ๋ค์œผ๋กœ ์ƒ˜ํ”Œ์„ ๋ฝ‘์•„์„œ ํ•™์Šต์„ ํ•˜์—ฌ ๋ชจ๋ธ์„ ์—…๋ฐ์ดํŠธํ•จ.

 

Result

Next

Previously, 4,000 pieces of fresh_orange and rotten_orange data were obtained through Crawling.
There is a code that was classified as an Inception model and received about 95% of Test Accuracy. 
If we apply the DQN and DDQN algorithms, we will experiment to see if the accuracy will increase further.

- only use the pre-training model,
- DQN algorithm using pre-training model.

 

์ด์ „์— ํฌ๋กค๋ง์œผ๋กœ fresh_orange, rotten_orange ๋ฐ์ดํ„ฐ 4์ฒœ์žฅ์„ ์–ป๊ณ ,
Inception ๋ชจ๋ธ๋กœ ๋ถ„๋ฅ˜ํ•ด์„œ Test Accuracy ์•ฝ 95% ๋ฐ›์€ ์ฝ”๋“œ๊ฐ€ ์žˆ๋Š”๋ฐ, 
์ด๋ฅผ DQN, DDQN ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์ ์šฉํ•˜๋ฉด ์ •ํ™•๋„๊ฐ€ ๋” ์˜ฌ๋ผ๊ฐ€๋‚˜ ์‹คํ—˜ํ•ด๋ณผ ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.

- pre-training model๋งŒ ์‚ฌ์šฉํ–ˆ์„ ๋•Œ
- pre-training model์„ ์‚ฌ์šฉํ•˜๋Š” DQN ์•Œ๊ณ ๋ฆฌ์ฆ˜

728x90
๋ฐ˜์‘ํ˜•
Liky