Chulalongkorn University Theses and Dissertations (Chula ETD)
Other Title (Parallel Title in Other Language of ETD)
Comparison of predicting the direction of Thai stock prices based on Random Forests, XGBoost and LightGBM models
Year (A.D.)
2023
Document Type
Thesis
First Advisor
อัครินทร์ ไพบูลย์พานิช
Faculty/College
Faculty of Commerce and Accountancy (คณะพาณิชยศาสตร์และการบัญชี)
Department (if any)
Department of Statistics (ภาควิชาสถิติ)
Degree Name
วิทยาศาสตรมหาบัณฑิต
Degree Level
ปริญญาโท
Degree Discipline
สถิติและวิทยาการข้อมูล
DOI
10.58837/CHULA.THE.2023.1477
Abstract
การศึกษานี้มีวัตถุประสงค์เพื่อทำนายทิศทางของหุ้นไทย โดยทำการทดลองเปรียบเทียบเครื่องมือทางสถิติด้วยตัวแบบ Random Forests, XGBoost และ LightGBM โดยใช้ตัวแปรค่าของข้อมูลก่อนหน้า (Lag Features) เพียงอย่างเดียว ข้อมูลตัวชี้วัด (Indicators) ของหุ้นเพียงอย่างเดียว และ ข้อมูลตัวชี้วัด (Indicators) ของหุ้นร่วมกับข้อมูลก่อนหน้า (Lag Features) กับทั้ง 3 ตัวแบบ ด้วยวิธีการปรับแต่งไฮเปอร์พารามิเตอร์ระหว่างการปรับให้เหมาะสมแบบเบย์ (Bayesian Search) และการค้นหาแบบสุ่ม (Random Search) ในการทำนายทิศทางหุ้นล่วงหน้า 1, 3, 5,10, 15, 30, 60, 90 และ 180 วัน โดยศึกษาหุ้นทั้งหมด 8 ตัวที่ต่างอุตสาหกรรม ดังนี้ เกษตรและอุตสาหกรรมอาหาร (AGRO) สินค้าอุปโภคบริโภค (CONSUMP) ธุรกิจการเงิน (FINCIAL) สินค้าอุตสาหกรรม (INDUS) อสังหาริมทรัพย์และก่อสร้าง (PROPCON) ทรัพยากร (RESOURC) บริการ (SERVICE) เทคโนโลยี (TECH) ข้อมูลราคาหุ้นจาก finance.yahoo.com ปี ค.ศ. 2014-2023 โดยเลือกหุ้นที่มีมูลค่าสูงสุดจากแต่ละกลุ่มอุตสาหกรรม ซึ่งขั้นตอนการแบ่งข้อมูลออกเป็นข้อมูลชุดฝึกฝน (Training Set) และข้อมูลชุดทดสอบ (Test Set) และทำการแบ่ง K-Fold Cross-Validation ทั้งหมด 5 Fold และวัดผลตัวแบบด้วยค่าความแม่นยำ (Accuracy), Precision, Recall, F1-Score และ AUC จากการศึกษาพบว่า ตัวแบบ Random Forests, XGBoost และ LightGBM มีผลลัพธ์การทำนายใกล้เคียงกันในแต่ละชุดตัวแปร และวิธีวิธีการปรับแต่งไฮเปอร์พารามิเตอร์ระหว่างการปรับให้เหมาะสมแบบเบย์ (Bayesian Search) และการค้นหาแบบสุ่ม (Random Search) ให้ผลลัพธ์ใกล้เคียงกันในแต่ละตัวแบบ โดยการใช้ตัวแปรข้อมูลตัวชี้วัด (Indicators) ของหุ้นเพียงอย่างเดียว และ การใช้ตัวแปรข้อมูลตัวชี้วัด (Indicators) ร่วมกับข้อมูลก่อนหน้า (Lag Features) ให้ประสิทธิภาพในการทำนายสูงที่สุดในการทำนายล่วงหน้า 1 วัน
Other Abstract (Other language abstract of ETD)
Through an experimental comparison of statistical methods, this study attempts to forecast the direction of the Thai stock market by utilizing models from Random Forests, XGBoost, and LightGBM. Across all three models, it exclusively uses Lag Features, stock Indicators, and combined stock Indicators with Lag Features. Bayesian Search and Random Search techniques are used to hyperparameter tune the models to forecast the direction of equities 1, 3, 5, 10, 15, 30, 60, 90, and 180 days ahead of time by examining a total of 8 stocks across several industries: Consumer goods (CONSUMP), industrial products (INDUS), real estate and construction (PROPCON), agricultural and food sector (AGRO), financial services (FINCIAL), resources (RESOURC), services (SERVICE), and technology (TECH) information on stock prices from finance.yahoo.com between 2014 and 2023, chosen by tallying the value of the best-performing stocks in each sector. The procedure of splitting the data into Training Set and Test Set data, dividing the K-Fold Cross-Validation into 5 folds, and evaluating the model's performance using F1-Score, AUC, Accuracy, and Precision. According to the study, the prediction outcomes for each set of variables were comparable for Random Forests, XGBoost, and LightGBM models. shows how similar results were obtained in each model by hyperparameter adjustment between Random Search and Bayesian Search. The best prediction efficiency in predicting one day ahead of time is achieved by employing the stock indicator data variables alone and the indicator data variables in conjunction with Lag Features.
Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-No Derivative Works 4.0 International License.
Recommended Citation
ไชยมหา, สาธิตา, "การเปรียบเทียบการทำนายทิศทางของราคาหุ้นไทยโดยใช้ตัวแบบ Random Forests, XGBoost และ LightGBM" (2023). Chulalongkorn University Theses and Dissertations (Chula ETD). 75437.
https://digital.car.chula.ac.th/chulaetd/75437