Close Menu
    Trending
    • New York Requiring Companies to Reveal If AI Caused Layoffs
    • Powering next-gen services with AI in regulated industries 
    • From Grit to GitHub: My Journey Into Data Science and Analytics | by JashwanthDasari | Jun, 2025
    • Mommies, Nannies, Au Pairs, and Me: The End Of Being A SAHD
    • Building Essential Leadership Skills in Franchising
    • History of Artificial Intelligence: Key Milestones That Shaped the Future | by amol pawar | softAai Blogs | Jun, 2025
    • FedEx Deploys Hellebrekers Robotic Sorting Arm in Germany
    • Call Klarna’s AI Hotline and Talk to an AI Clone of Its CEO
    Finance StarGate
    • Home
    • Artificial Intelligence
    • AI Technology
    • Data Science
    • Machine Learning
    • Finance
    • Passive Income
    Finance StarGate
    Home»Machine Learning»Decision Tree Models | Part 2. Basic of tree, Random Forest, Gradient… | by Wichada Chaiprasertsud | Feb, 2025
    Machine Learning

    Decision Tree Models | Part 2. Basic of tree, Random Forest, Gradient… | by Wichada Chaiprasertsud | Feb, 2025

    FinanceStarGateBy FinanceStarGateFebruary 5, 2025No Comments3 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    Fundamental of tree, Random Forest, Gradient Boosting Tree & XGBoost, and so forth.

    Earlier:

    ในตอนที่แล้วเราได้พูดถึง Determination Tree ปกติไป คราวนี้เราจะมาพูดถึง Determination Tree ที่ถูกพัฒนาเพื่อแก้ไขปัญหาบางอย่าง

    https://slideplayer.com/slide/7029806/ Zhangxi Lin ISQS Texas Tech University Note

    Determination Tree มีความ unstable สูงมาก ๆ การเปลี่ยนแปลงแค่นิดเดียว หรือเพียงแค่ข้อมูลเดียวเหมือนดังรูป อาจทำให้เราได้ Tree ที่มี construction เปลี่ยนไปโดยสิ้นเชิง

    เราจึงจะแก้ไขปัญหานี้โดยการใช้ method — ensemble mannequin หรือ mannequin ที่เป็น mixture ของ mannequin หลาย ๆ อัน ซึ่งก็มีหลายวิธี เช่น

    • Bagging ซึ่งเป็นการ practice mannequin หลาย ๆ ตัวแยกกันแบบ parallel แล้วเอาผลมา mix
    • Boosting ซึ่งเป็นการ practice mannequin หลาย ๆ ตัวต่อกัน แบบ sequentially แล้วให้ mannequin ตัวหลังมาแก้ error ของ mannequin ตัวก่อนหน้า

    กลายเป็น mannequin ที่ถูกพัฒนาต่อมา ไม่ว่าจะเป็น

    ปัจจุบันไม่ค่อยนิยมแล้ว เพราะคนไปใช้ Random Forest ซึ่งเป็นเวอร์ชันที่ถูกพัฒนาจาก Bagging

    https://www.analyticsvidhya.com/blog/2023/01/ensemble-learning-methods-bagging-boosting-and-stacking/

    Take Majority Vote(Common) of Prediction

    enhanced Bagging, Bagging + random characteristic choice for every cut up. Enhance robustness and scale back overfitting

    machine learning — What is the difference between bagging and random forest if only one explanatory variable is used? — Cross Validated

    Many timber → Forest!

    Forest takes bootstrap samples of the rows in coaching information (sampling with substitute; after chosen we put it again to the pool, so it may be chosen once more) then at every step, a set of variables (columns) is sampled.

    โดยค่าของ max options หรือ max samples รวมถึง จำนวนต้นไม้ใน RF เราสามารถกำหนดได้

    Execs: คำนวณง่าย คำนวณได้แบบ parallel เป็น robust baseline

    Cons: ด้วยความที่ mannequin advanced ขึ้น เราอาจจะตีความผลจากต้นไม้ได้ยาก เพราะผลมาจากต้นไม้หลายต้นเฉลี่ยกัน

    ปัจจุบันไม่ค่อยนิยมแล้ว เพราะคนไปใช้ Gradient Boosting ซึ่งเป็นเวอร์ชันที่ถูกพัฒนาจาก Boosting

    https://www.almabetter.com/bytes/tutorials/data-science/adaboost-algorithm
    https://medium.com/towards-data-science/the-ultimate-guide-to-adaboost-random-forests-and-xgboost-7f9327061c4f
    • Focuses on re-weighting misclassified samples.
    • Every weak learner is educated sequentially, with extra weight given to incorrectly categorised factors.
    • The ultimate mannequin is a weighted sum of weak learners. Fashions that carry out higher get greater weight.

    สังเกตได้ว่ากระบวนการแบบนี้จะทำให้ Outlier มีผลกับ mannequin มาก ๆ เพราะจะได้ weight ที่เพิ่มขึ้น

    ใช้หลักการ Boosting เหมือนกัน แต่เป้าหมายของต้นไม้ตัวถัดไปคือ การทำนาย Error ไม่ใช่ Goal!

    prediction outcome = summation of all timber (not common as RF any extra)

    Preliminary Prediction
    ค่า Preliminary Prediction มักจะเป็นค่าจากโมเดลง่าย ๆ เช่น:

    • ค่าเฉลี่ย (Imply) ของ yy สำหรับปัญหาการพยากรณ์แบบ Regression
    • ค่า Log-Odds ของ Class Prior สำหรับ Classification
    • ตัวอย่างเช่น ในปัญหาการทำนายราคา ถ้าค่าเฉลี่ยของราคาบ้านคือ 3 ล้าน บาท ค่าเริ่มต้นของโมเดลก็จะเป็น 3 ล้านบาททุกตัวอย่าง

    Prediction

    • Residuals/Error เป็นค่าที่โมเดลถัดไปจะเรียนรู้
    • เช่นค่า +0.95 หรือ -0.44 ในรูป
    • เมื่อโมเดลแรกทำนายออกมา ค่า Residual (ri = yi — f0(xi)) จะกลายเป็น goal ใหม่ ที่โมเดลถัดไปต้องเรียนรู้
    • ตัวอย่าง:
    • ถ้าเราทำนายราคาบ้านได้ 2.5 ล้าน แต่ความจริงคือ 3 ล้าน, Residual คือ +0.5 ล้าน
    • โมเดลต้นไม้ต้นต่อไปจะพยายามพยากรณ์ +0.5 ล้าน (ค่าความผิดพลาดที่เหลืออยู่)

    การใช้ Gradient Descent Studying Fee (η) เพื่อป้องกัน Overfitting

    • การเพิ่มผลรวมของต้นไม้แต่ละต้นไม่ได้เกิดขึ้นแบบ 100% แต่ถูกปรับด้วยค่าที่เรียกว่า Studying Fee (η) ของ GD
    • ค่า η ควบคุมว่าโมเดลต้นไม้ใหม่จะมีอิทธิพลต่อผลลัพธ์สุดท้ายแค่ไหน
    • ค่า η ต่ำ (เช่น 0.1) → โมเดลเรียนช้าลง แต่ลด Overfitting
    • ค่า η สูง (เช่น 1.0) → โมเดลอัปเดตเร็วขึ้น แต่เสี่ยง Overfitting

    Mannequin สุดท้ายเป็นการรวมค่าทั้งหมด (Ensemble Mannequin)

    • ผลลัพธ์สุดท้ายไม่ได้มาจากต้นไม้ต้นเดียว แต่เป็น การรวมกันของต้นไม้หลายต้น
    • สมการของโมเดลสุดท้ายคือ
    • ซึ่งหมายความว่าแต่ละต้นไม้ช่วยกันลดข้อผิดพลาดทีละน้อย ทำให้ผลลัพธ์สุดท้ายแม่นยำขึ้น

    เมื่อเราได้ Error แล้ว สังเกตได้ว่า Error แต่ละค่าจะมีค่า weight ที่คูณอยู่ ซึ่งนั่นคือการที่เราจะหา weight ที่ดีที่สุดโดยการใช้ GD Gradient Descent

    “Optimize weight of leaf nodes by gradient descent Authentic Tree”

    ทำให้บน mannequin สามารถปรับ studying charge สำหรับ GD ได้ด้วยนั่นเอง

    Mannequin ที่ให้ผลใกล้เคียงกับ XGBoost แต่เร็วกว่ามาก

    เป็นการปรับปรุง GBM โดยเพิ่ม

    • Regularization (มี L1 (Lasso) และ L2 (Ridge) ทำให้ลด Overfitting ได้ดีขึ้น)
    • Parallelization มีการคำนวณแบบ Parallel และ Optimized Reminiscence Utilization
    • Pruning ใช้วิธี “Loss-based Pruning”
    • จัดการ Lacking Values ได้อัตโนมัติ และอื่น ๆ

    รวมถึงหนึ่งใน key สำคัญคือการใช้ Approximate Tree Studying

    Approximate Tree Studying

    ปัญหาของ Gradient Boosting ปกติคือ การแบ่งโหนด (Splitting) ของต้นไม้ต้อง Kind ค่า Characteristic ทุกครั้ง → ทำให้ใช้เวลานานมาก ส่งผลให้

    • การหาจุดแบ่ง (Finest Break up) เป็นกระบวนการที่มีค่าใช้จ่ายสูง (Computational Value สูง)

    XGBoost แก้ปัญหานี้ด้วย Approximate Splitting

    • แทนที่จะ Kind ทุกค่า ในแต่ละรอบ XGBoost ใช้วิธี Approximate Algorithm ที่เป็น Grasping operate
    • โดยการ แบ่ง Characteristic เป็น Quantile Sketch (Bucket-based) → ลดการคำนวณ
    • ทำให้การตัดสินใจเลือก Break up Level เร็วขึ้น อาจมีการเลือก Break up Level ที่ไม่แม่นยำที่สุดในบางกรณี แต่โดยรวมแล้วยังได้ผลลัพธ์ที่ดีและเร็วขึ้นมาก

    *XGBoost package deal ไม่อยู่ใน sklearn

    https://towardsmachinelearning.org/boosting-algorithms/
    https://www.researchgate.net/figure/Evolution-of-XGBoost-Algorithm-from-Decision-Trees-34_fig2_352693260

    Examples of Determination Tree Fashions, Their Capabilities, and Libraries

    https://github.com/pvateekul/2110446_DSDE_2024s2 by รศ.ดร.พีรพล เวทีกูล (Assoc. Prof. Peerapon Vateekul, Ph.D.)



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleEntrepreneurs Drive the Economy — But Are We Doing Enough to Support Them?
    Next Article Customer spotlight: Personify Health’s thoughtful approach to AI adoption
    FinanceStarGate

    Related Posts

    Machine Learning

    From Grit to GitHub: My Journey Into Data Science and Analytics | by JashwanthDasari | Jun, 2025

    June 13, 2025
    Machine Learning

    History of Artificial Intelligence: Key Milestones That Shaped the Future | by amol pawar | softAai Blogs | Jun, 2025

    June 13, 2025
    Machine Learning

    A First-Principles Guide to Multilingual Sentence Embeddings | by Tharunika L | Jun, 2025

    June 13, 2025
    Add A Comment

    Comments are closed.

    Top Posts

    Decoding Life One Sequence at a Time: A Practitioner’s Dive into Protein Prediction | by Everton Gomede, PhD | Apr, 2025

    April 27, 2025

    Build Games with Amazon Q CLI. Get hands-on experience with an AI… | by Er.Monali Hingu | May, 2025

    May 21, 2025

    Virtualization & Containers for Data Science Newbies

    February 12, 2025

    How Automatic Speech Recognition is Shaping the Future of Voice Technology | by Matthew-Mcmullen | May, 2025

    May 6, 2025

    What if your software could think, learn, and adapt on its own? 🤖 – Prishusoft

    May 26, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Data Science
    • Finance
    • Machine Learning
    • Passive Income
    Most Popular

    AI reasoning models can cheat to win chess games

    March 5, 2025

    09360627233

    March 26, 2025

    Fired Meta Workers Say They Have Records of Good Performance

    February 12, 2025
    Our Picks

    RAG vs. Fine-Tuning: Strategic Choices for Enterprise AI Systems | by willard mechem | Mar, 2025

    March 29, 2025

    Day 4: React Controlled Components: Master User Input Handling in Next.js (JSX Guide)🚀 | by Lokesh Prajapati | Apr, 2025

    April 18, 2025

    Snap CEO Evan Spiegel Gives Future Entrepreneurs Key Advice

    March 25, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Data Science
    • Finance
    • Machine Learning
    • Passive Income
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2025 Financestargate.com All Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.