KMITL Innovation Expo 2025 Logo

A Comparison of The Performance of Machine Learning Methods on Time Series Data Using Lagged Time Intervals

Abstract

This special problem aims to compare the performance of machine learning methods in time series forecasting using lagged time periods as independent variables. The lagged periods are categorized into three groups: lagged by 10 units, lagged by 15 units, and lagged by 20 units. The study employs four machine learning methods: Decision Tree (DT), Random Forest (RF), K-Nearest Neighbors (KNN), and Support Vector Machine (SVM). The time series data simulated as independent variables diverse including characteristics: Random Walk data, Trending data, and Non-Linear data, with sample sizes of 100, 300, 500, and 700. The research methodology involves splitting the data into 90% for training and 10% for testing. Simulations and analysis are performed using the R programming language, with 1,000 iterations conducted. The results are evaluated based on the average mean squared error (AMSE) and the average mean absolute percentage error (AMAPE) are calculated to identify the best performing method. The research findings revealed that for Random Walk data, the best performing methods are Random Forest and Support Vector Machine. For Trend data, the best performing methods are Random Forest. For Non-Linear data, the best performing methods are Support Vector Machine. When tested with real-world data, the results show that for the Euro-to-Thai Baht exchange rate, the best methods are Random Forest and Support Vector Machine. For the S&P 500 Index in USD, the best performing methods are Random Forest. For the Bank of America Corp Index in USD, the best performing methods are Support Vector Machine.

Objective

ปัจจุบันเทคโนโลยีสารสนเทศมีบทบาทสำคัญต่อการดำรงชีวิตของมนุษย์ ทำให้มีการพัฒนาเทคโนโลยีเพื่ออำนวยความสะดวกต่อการดำรงชีวิตของมนุษย์ มีแหล่งข้อมูลข่าวสารที่ทันสมัย รวมถึงแหล่งข้อมูลขนาดใหญ่ที่เรียกกว่าข้อมูลมหัต (Big Data) เป็นข้อมูลที่มีปริมาณมาก (Volume) มีความเปลี่ยนแปลงอย่างรวดเร็วอยู่ตลอดเวลา (Velocity) และมีความหลากหลายสูง (Variety) เนื่องจากคุณสมบัติเหล่านี้จัดเป็นอุปสรรคหรือปัญหาของ ข้อมูลขนาดใหญ่ที่ไม่สามารถนำข้อมูลมาใช้ประโยชน์ได้ทันทีจึงต้องมีกระบวนการจัดการข้อมูล ขนาดใหญ่เสียก่อน โดยใช้วิธีการเรียนรู้ของเครื่อง (Machine Learning) เข้ามาเกี่ยวข้อง การเรียนรู้ด้วยเครื่อง (Machine Learning) คือวิทยาการคอมพิวเตอร์ประเภทหนึ่ง เกี่ยวข้องกับการศึกษาและสร้างอัลกอริทึมที่สามารถเรียนรู้ข้อมูลและทำนายข้อมูลได้ สามารถแบ่งการเรียนรู้ของเครื่องออกเป็น 2 กลุ่มประกอบด้วย การเรียนรู้แบบไม่มีผู้สอน (Unsupervised Learning) คือการวิเคราะห์ข้อมูลที่ไม่มีตัวแปรตามหรือคำตอบกำกับไว้ มุ่งเน้นไปที่การหาความสัมพันธ์ระหว่างข้อมูลและการแบ่งกลุ่มเพื่อลดมิติของข้อมูล เช่น การวิเคราะห์แบ่งกลุ่ม (Cluster Analysis) ซึ่งได้รับความนิยมใช้เพื่อลดมิติของข้อมูลและการแบ่งกลุ่มข้อมูลด้วยคุณลักษณะต่าง ๆ และการเรียนรู้แบบมีผู้สอน (Supervised Learning) คือการวิเคราะห์ข้อมูลที่มีตัวแปรตามหรือคำตอบกำกับไว้ ถ้าตัวแปรตามเป็นเชิงปริมาณจะเป็นการพยากรณ์ข้อมูลอนุกรมเวลา (Time series) แต่ถ้าตัวแปรตามเป็นเชิงคุณภาพจะเป็นการวิเคราะห์การจำแนก (Classification) โดยเทคนิคที่นิยมใช้อย่างแพร่หลายได้แก่ การถดถอยโลจิสติกส์ (Logistic Regression) ต้นไม้ตัดสินใจ (Decision Tree) เทคนิคป่าสุ่ม (Random Forest) และโครงข่ายประสาทเทียม (Artificial Neural Network) เป็นต้น การจำแนกถูกนำมาประยุกต์ใช้ในงานวิจัยในหลายด้าน (วริทธิ์พล , 2565) ข้อมูลอนุกรมเวลา (Time Series) คือ ชุดข้อมูลที่รวบรวมและจัดเก็บตามลำดับ ต่อเนื่องกันภายใต้การเพิ่มขึ้นของเวลา โดยข้อมูลดังกล่าวจะถูกเก็บรวบรวมอย่างต่อเนื่องในระยะเวลาติดต่อกัน ตามช่วงเวลาที่ต้องการ เช่น ข้อมูลราคาทองคำ ข้อมูลปริมาณน้ำในเขื่อน ซึ่งจะถูกบันทึกข้อมูลเป็นวัน ในบางกรณี การจัดเก็บข้อมูลอาจมีลักษณะการจัดเก็บแบบเป็นช่วงเวลาต่อเนื่องกัน เพื่อสร้างตัวแบบอนุกรมเวลา (Time Series Model) ในการทำนายเหตุการณ์ที่จะเกิดขึ้นในอนาคตโดยการวิเคราะห์อนุกรมเวลา (Time Series Analysis) ในการวิเคราะห์อนุกรมเวลา ส่วนใหญ่ข้อมูลอนุกรมเวลาเป็นข้อมูลที่เยอะ ซับซ้อน และมีการเปลี่ยนแปลงอยู่ตลอดเวลา จึงทำให้ยากต่อการหาวิธีที่ดีที่สุดในการพยากรณ์ จึงได้มีการนำการเรียนรู้ด้วยเครื่องมาใช้ในการวิเคราะห์ข้อมูล เพราะ วิธีการเรียนรู้ด้วยเครื่องมีประสิทธิภาพในการวิเคราะห์ข้อมูลอนุกรมเวลามากกว่า (พรทิวา , 2564) โดยทั่วไปในการวิเคราะห์อนุกรมเวลาจะใช้ตัวแปรเพียงตัวเดียว แต่ในวิธีของการเรียนรู้ด้วยเครื่องจะมีการใช้ตัวแปรอิสระ ( ) มาช่วยในการพยากรณ์ ในการวิจัยครั้งนี้จึงสนใจนำช่วงเวลาที่ช้ากว่ากัน (Lag) ของข้อมูลอนุกรมเวลา เข้ามาเป็นตัวแปรอิสระ โดยตัวแปรตาม ( ) คือ ข้อมูลอนุกรมเวลาชุดเดิม แล้วจึงนำไปวิเคราะห์ด้วยวิธีการเรียนรู้ด้วยเครื่อง ประกอบด้วย วิธีต้นไม้ตัดสินใจ (Decision Tree) ป่าสุ่ม (Random Forest) วิธีเพื่อนบ้านใกล้เคียงสุด K อันดับ (K Nearest-Neighbor: KNN) และวิธีซัพพอร์ตเวกเตอร์แมชชีน (Support Vector Machine) โดยแต่ละวิธีจะทำการศึกษาเกี่ยวกับการวัดความถูกต้องและความผิดพลาดในการจำแนกข้อมูล Lai et al. (2023) งานวิจัยนี้เกี่ยวกับการพยากรณ์สถานการณ์ปัจจุบันของโควิด 19 โดยใช้ข้อมูลน้ำเสีย ให้ผู้ป่วยโควิด 19 เป็นตัวแปร และให้ปริมาณไวรัสในตัวอย่างน้ำเสียเป็นตัวแปร ผู้วิจัยไม่ทราบตัวแปร จึงได้ใช้วิธีช่วงเวลาที่ช้ากว่ากัน (Lag) เอามาช่วยในการพยากรณ์ตัวแปร พอทราบค่าได้นำไปพยากรณ์ด้วยวิธีการเรียนรู้ด้วยเครื่อง ประกอบไปด้วย แบบจำลองอารีแมกซ์ (Autoregressive Integrated Moving Average with Exogenous Variables : ARIMAX) และการเรียนรู้ด้วยเครื่องจากชุดข้อมูลแบบลำดับเวลา (Time Series Machine Learning : TSML) โดยเทคนิคที่ดีที่สุด คือ วิธีการเรียนรู้ด้วยเครื่องจากชุดข้อมูลแบบลำดับเวลา พรทิวา (2564) งานวิจัยนี้เกี่ยวกับระบบวิเคราะห์ข้อมูลอนุกรมเวลาด้วยเทคนิคทางการเรียนรู้ของเครื่อง โดยเปรียบเทียบวิธีพยากรณ์ออกเป็น 3 เทคนิคประกอบไปด้วยเทคนิควิเคราะห์การถดถอยพหุคูณ (Multiple Linear Regression) วิธีต้นไม้ตัดสินใจ (Decision Tree) และ วิธีป่าสุ่ม (Random Forest) โดยใช้การคัดเลือกเทคนิคที่เหมาะสมที่สุดสำหรับการพยากรณ์โดยใช้เกณฑ์ค่าเฉลี่ยของค่าสัมบูรณ์เปอร์เซ็นต์ความคลาดเคลื่อน (Mean Absolute Percentage Error, MAPE) ต่ำที่สุดผลวิจัยพบว่าการเปรียบเทียบเทคนิคระหว่างวิธีต้นไม้ตัดสินใจ วิธีป่าไม้สุ่ม และ การถดถอยพหุคูณ สำหรับการพยากรณ์ยอดขายรวมรายวันแยกตามรายสินค้าและจำนวนผู้เสียชีวิตรายใหม่จาก สถานการณ์ COVID-19 ในประเทศไทยพบว่าเทคนิคให้ค่า MAPE เฉลี่ยต่ำที่สุดคือ เทคนิคป่าสุ่ม Kayode-Ajala. (2022) งานวิจัยนี้เกี่ยวกับการประยุกต์ใช้อัลกอริทึมการเรียนรู้ของเครื่อง ในการตรวจจับเว็บไซต์ที่เป็นแฟร์ชิ่ง ซึ่งใช้วิธีการเรียนรู้ด้วยเครื่องประกอบด้วย วิธีซัพพอร์ตเวกเตอร์แมชชีน (Support Vector Machine) วิธีเพื่อนบ้านใกล้เคียงสุด K อันดับ (K Nearest-Neighbor: KNN) วิธีต้นไม้ตัดสินใจ (Decision Trees) และ วิธีป่าสุ่ม (Random Forest) ซึ่งวิธีที่ดีที่สุดคือ วิธีเพื่อนบ้านใกล้เคียงสุด K อันดับ Ballı (2021) งานวิจัยนี้เกี่ยวกับการวิเคราะห์ข้อมูลของการระบาดโควิด-19 และการพยากรณ์จำนวนผู้ติดเชื้อรวมในระยะสั้นๆ โดยใช้เทคนิคการเรียนรู้ด้วยเครื่องประกอบวิธีการถดถอยเชิงเส้น (Linear regression) วิธีโครงข่ายประสาทเทียมแบบเพอร์เซ็ปตรอนหลายชั้น (multi-layer perceptron) วิธีป่าสุ่ม (random forest) วิธีนาอีฟ เบย์ (Naive Bayes) และ วิธีซัพพอร์ตเวกเตอร์แมชชีน (Support Vector Machine) พบว่าเทคนิคให้ค่า MAPE เฉลี่ยต่ำที่สุดคือ วิธีซัพพอร์ตเวกเตอร์แมชชีน Bemthuis et al. (2023) งานวิจัยนี้เกี่ยวกับระบบสนับสนุนการตัดสินใจ (Decision Support Systems) กำลังพัฒนาไปในทิศทางที่ซับซ้อนมากขึ้น โดยมุ่งหวังที่จะทำให้การตัดสินใจเป็นไปโดยอัตโนมัติมากที่สุด จึงวิธีการที่ใช้เทคนิคการจำแนกประเภทด้วยต้นไม้การตัดสินใจ และเปรียบเทียบประสิทธิภาพกับผลลัพธ์ที่ได้จากการใช้เทคนิคสนับสนุนเวกเตอร์แมชชีน การทดลองของเราพบว่า วิธีการของเรามีความแม่นยำและความยืดหยุ่นในด้านการดึงกฎทางธุรกิจ ต้นไม้การตัดสินใจ จากการศึกษางานวิจัยที่เกี่ยวข้องทางผู้วิจัยจึงสนใจศึกษาการเปรียบเทียบประสิทธิภาพของวิธีการเรียนรู้ด้วยเครื่องจากข้อมูลอนุกรมเวลา โดยวิธีการช่วงเวลาที่ช้ากว่ากัน ซึ่งประกอบไปด้วยวิธีต้นไม้ตัดสินใจ (Decision Tree) วิธีป่าสุ่ม (Random Forest) วิธีเพื่อนบ้านใกล้เคียงสุด K อันดับ (K Nearest-Neighbor: KNN) และวิธีซัพพอร์ตเวกเตอร์แมชชีน (Support Vector Machine) โดยพิจารณาค่าเฉลี่ยของค่าคาดเคลื่อนกำลังสองเฉลี่ย (Mean Square Error: AMSE) และค่าเฉลี่ยของค่าเฉลี่ยเปอร์เซ็นต์ความคลาดเคลื่อนสัมบูรณ์ (Mean Absolute Percentage Error: AMAPE) เป็นเกณฑ์ในการวัดประสิทธิภาพของแบบจำลอง และเป็นแนวทางการในการเปรียบเทียบประสิทธิภาพด้วยวิธีการเรียนรู้ด้วยเครื่อง เพื่อตัดสินใจในการเลือกแบบจำลองที่ดีที่สุด

Other Innovations

Genomic analysis, Bacteriocin dynamic production of putatively novel bacteriocin DCR3-2 inhibiting Listeria monocytogenes synthesized by Lactococcus lactis subsp. hordinae DCR3-2 isolated from Thai pickled crab (Pu-dong)

คณะวิทยาศาสตร์

Genomic analysis, Bacteriocin dynamic production of putatively novel bacteriocin DCR3-2 inhibiting Listeria monocytogenes synthesized by Lactococcus lactis subsp. hordinae DCR3-2 isolated from Thai pickled crab (Pu-dong)

Listeriosis is a severe foodborne illness characterized by a fatality rate exceeding 30%, attributed to the pathogen Listeria monocytogenes. This study evaluated 160 lactic acid bacteria (LAB) isolated from Thai pickled crabs for their potential as agents against L. monocytogenes and for their probiotic properties and probiogenomic characteristics. Among these strains, strain DRC3-2 exhibited activity through the synthesis of bacteriocin DRC3-2, which significantly inhibited L. monocytogenes ATCC 19115 in spot-on-lawn assays. Phenotypic and whole-genome analyses revealed that strain DRC3-2 thrived in environments with 2-6% NaCl, pH values ranging from 3 to 9, and temperatures between 25 and 45°C. Based on average nucleotide identity (ANI) and digital DNA‒DNA hybridization (dDDH) values, strain DRC3-2 was taxonomically classified as Lactococcus lactis subsp. hordinae. The production of bacteriocin DRC3-2 peaked during the late stationary phase, following its synthesis in the early exponential growth phase. BAGEL4 analysis identified the putative novel bacteriocin DRC3-2 as lactococcin A and B, with respective bit-scores of 40.05 and 36.58. In silico safety assessments confirmed the nonpathogenic nature of strain DRC3-2 in humans, highlighting its absence of antibiotic resistance genes. Finally, this investigation underscores the novel bacteriocin DRC3-2 for application in the prevention and treatment of L. monocytogenes infections.

Read more
Dream High Packaging Protection from Mycelium

คณะบริหารธุรกิจ

Dream High Packaging Protection from Mycelium

In a world increasingly focused on sustainability and reducing environmental impact, DreamHigh is pioneering an innovative approach to packaging solutions using mycelium—a natural, biodegradable, and renewable material derived from fungi. Our mission is to revolutionize the packaging industry by offering eco-friendly alternatives that not only reduce waste but also align with global efforts to combat climate change. Mycelium packaging offers a compelling alternative to traditional plastic and Styrofoam packaging, which contribute significantly to environmental pollution. It is fully biodegradable, compostable, and capable of breaking down in natural environments within weeks, leaving no toxic residues behind. Additionally, mycelium-based products are lightweight, durable, and customizable, making them suitable for a wide range of applications, from consumer goods packaging to protective shipping materials. DreamHigh’s business plan outlines a scalable production process leveraging advanced mycelium cultivation techniques and partnerships with local agricultural sectors to utilize agricultural waste as a key raw material. This not only ensures cost-efficiency but also supports a circular economy by repurposing waste that would otherwise be discarded.

Read more
Botanical Hand Care: Nourish and Protect with Murraya Extract

คณะวิทยาศาสตร์

Botanical Hand Care: Nourish and Protect with Murraya Extract

Development of Hand Cream from Murraya Extract Using an Eco-Friendly Extraction Process. This research focuses on extracting active compounds from Murraya paniculata using a water-based, environmentally friendly method. The extract exhibits outstanding antibacterial properties and anti-oxidant. It is incorporated into a hand cream formulation.

Read more