0Pricing
Data Science Academy · บทเรียน

การถดถอยด้วยต้นไม้ตัดสินใจ

แบ่งข้อมูลแบบไม่เป็นเส้นตรง

การถดถอยด้วยต้นไม้ตัดสินใจ เป็นบทเรียน Data Science Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Data Science Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Data Science Academy มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Beyond Straight Lines

A decision tree predicts numbers by asking yes-or-no questions about your features, splitting the data step by step. No straight line required. 🌳

Splits Are the Questions

Each branch is a split, like is size above 80? The tree keeps asking, narrowing rows into smaller and smaller groups.

Leaves Hold the Answer

At the bottom sit the leaves. Each leaf predicts one number: the average target of all training rows that landed there.

Choosing the Best Split

The tree tries many split points and keeps the one that most reduces prediction error in the resulting groups. Greedy, one step at a time.

Train One in Two Lines

The familiar fit-predict contract holds. Create a DecisionTreeRegressor, fit it, and predict just like any other estimator.

from sklearn.tree import DecisionTreeRegressor
model = DecisionTreeRegressor().fit(X, y)

Predictions Look Like Steps

Because each leaf gives one flat value, a tree's predictions form a staircase, not a smooth curve. That is fine for many real patterns.

Trees Catch Non-Linear Shapes

Splits can bend any direction, so a tree captures non-linear relationships that a line would completely miss. That is its real strength.

Deep Trees Overfit

Left unchecked, a tree grows until each leaf holds one row, memorizing noise. That deep tree overfits and fails on new data.

Limit the Depth

Control growth with max_depth. A shallower tree stays general and is far easier to read and trust.

DecisionTreeRegressor(max_depth=4)

More Pruning Knobs

You can also set min_samples_leaf so leaves keep enough rows. This stops the tree from carving out tiny, noisy groups.

DecisionTreeRegressor(min_samples_leaf=10)

No Scaling Needed

Trees split on thresholds, so feature units do not matter. You can skip scaling, a nice contrast to Ridge and Lasso.

Quick Check

Think about how a tree turns rows into a prediction.

Recap

A decision tree splits data with questions, predicts a leaf average, and bends to non-linear shapes. Cap its depth so it generalizes. 🎯

คำถามที่พบบ่อย

บทเรียน “การถดถอยด้วยต้นไม้ตัดสินใจ” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “การถดถอยด้วยต้นไม้ตัดสินใจ” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Data Science Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Data Science Academy มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “การถดถอยด้วยต้นไม้ตัดสินใจ”

แบ่งข้อมูลแบบไม่เป็นเส้นตรง คุณปฏิบัติ Data Science Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Data Science Academy หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Data Science Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน

บทเรียน “การถดถอยด้วยต้นไม้ตัดสินใจ” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Data Science Academy นี้ได้ไหม

ได้ บทเรียน Data Science Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. ทบทวนการถดถอยเชิงเส้น
  2. การทำให้เป็นปกติแบบ Ridge และ Lasso
  3. การถดถอยด้วยต้นไม้ตัดสินใจ
  4. ป่าสุ่มสำหรับการถดถอย
← กลับไปที่ Data Science Academy