Skip to content

SeoK106/RandomForest_with_Iris-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Practice Random Forest through python with Iris dataset in scikit-learn

Scikit-learn์˜ Iris dataset๊ณผ RandomForestClassifier๋ฅผ ์‚ฌ์šฉํ•ด ๊ตฌํ˜„ํ•œ ๋ชจ๋ธ์ž…๋‹ˆ๋‹ค.

Dataset

IrisDatasetTable

  • feature(๋ถ„๋ฅ˜ ๊ธฐ์ค€): ๊ฝƒ๋ฐ›์นจ(sepal) ๊ธธ์ด, ๊ฝƒ๋ฐ›์นจ ๋„“์ด, ๊ฝƒ์žŽ(petal) ๊ธธ์ด, ๊ฝƒ์žŽ ๋„“์ด
  • targets(๋ถ„๋ฅ˜๋˜๋Š” ๊ฒฐ๊ณผ): setosa=0, versicolor=1, virginica=2
  • ์ด 150๊ฐœ ๋ฐ์ดํ„ฐ

Files in 'Code' folder

code ํด๋”์— ์žˆ๋Š” ๊ฐ ํŒŒ์ผ๋“ค์— ๋Œ€ํ•œ ์„ค๋ช…์€ ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  1. Simple RF model: ์ „์ฒด ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๋งŒ๋“  model์— ๋Œ€ํ•ด sample_data๋ฅผ ์‚ฌ์šฉํ•ด์„œ Iris specied ์˜ˆ์ธก์„ ํ•œ๋‹ค.
  2. Advanced RF model: train : test = 7 : 3์œผ๋กœ ๋งŒ๋“  ๋ฐ์ดํ„ฐ๋กœ ํ•™์Šตํ•œ modeld์„ ์‚ฌ์šฉํ•ด predict species from sample_data๋ฅผ ํ•œ๋‹ค.
  3. FeatureControlled RF model-threshold: 2๋ฒˆ์˜ ์ฝ”๋“œ์—์„œ ๋ฐœ์ „์‹œํ‚จ ์ฝ”๋“œ๋กœ threshold ์ด์ƒ์˜ ์ค‘์š”๋„ ๊ฐ’์„ ๊ฐ€์ง€๋Š” feature๋งŒ์„ ์‚ฌ์šฉํ•˜์—ฌ model์„ ๋งŒ๋“ ๋‹ค.
  4. FeatureControlled RF model-topSelect: 3๋ฒˆ๊ณผ ๋น„์Šทํ•˜์ง€๋งŒ feature์˜ ์ค‘์š”๋„๋ฅผ ๊ตฌํ•œ ํ›„ ์ƒ์œ„ ๋ช‡๊ฐœ๋งŒ ์‚ฌ์šฉํ•˜์—ฌ model์„ ๋งŒ๋“œ๋Š” ์ฐจ์ด๊ฐ€ ์žˆ๋‹ค.

Experimental Result

๋ชจ๋“  ์ฝ”๋“œ๋Š” python IDLE๋ฅผ ํ†ตํ•ด ์‹คํ–‰ํ•˜๊ฑฐ๋‚˜ cmd๋กœ >python fileName.py์ด๋Ÿฐ์‹์œผ๋กœ ์‹คํ–‰ํ•˜๋ฉด ๋œ๋‹ค.
cf. Window cmd์—์„œ ๋„์–ด์“ฐ๊ธฐ๊ฐ€ ์žˆ๋Š” ํŒŒ์ผ๋ช…์€ >python "file name.py"์ด๋ ‡๊ฒŒ ์“ฐ๋ฉด ๋œ๋‹ค.

  1. Simple RF model SimpleRFmodel
  2. Advanced RF model AdvancedRFmodel
  3. FeatureControlled RF model-threshold threshold
  4. FeatureControlled RF model-topSelect topSelect2 graph

Random Forest model์ด๋‚˜ ์ฝ”๋“œ์— ๋Œ€ํ•œ ๋” ์ž์„ธํ•œ ์„ค๋ช…์ด ํ•„์š”ํ•˜๋‹ค๋ฉด Here๋ฅผ ์ฐธ๊ณ ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

About

Practice Random Forest through python with Iris dataset in Scikit-learn.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages