พื้นฐานการพยากรณ์ครั้งแรก
การพยากรณ์แบบง่ายและค่าเฉลี่ยเคลื่อนที่
พื้นฐานการพยากรณ์ครั้งแรก เป็นบทเรียน Data Science Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Data Science Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Data Science Academy มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
Always Start Simple
Before fancy models, you need a baseline: a dead-simple forecast that anything fancier must beat to earn its place. 🪜
The Naive Forecast
The simplest baseline is the naive forecast: predict that tomorrow equals today. Surprisingly hard to beat for steady data.
forecast = sales.iloc[-1]Carrying the Last Value
A naive forecast just repeats the most recent observation forward. No trend, no season, just the latest known point.
The Seasonal Naive
For cyclical data, predict the value from one full season ago. This seasonal naive respects repeating patterns cheaply.
forecast = sales.shift(12)Moving-Average Forecast
Another baseline averages the last few points. A moving average smooths out noise and projects that level ahead.
forecast = sales.tail(7).mean()Split Before You Forecast
Keep the last chunk of time as a test set. Never shuffle it: time order must be preserved so the future stays unseen.
train, test = sales[:-30], sales[-30:]Measure the Error
Compare predictions to the held-out truth with an error metric. MAE reports the average size of your mistakes in real units.
from sklearn.metrics import mean_absolute_errorThe Number to Beat
Your baseline's error becomes the benchmark. Any model that scores worse is not worth its extra complexity.
Plot Truth Versus Forecast
Always plot the prediction over the real test values. Your eyes catch lag and bias that a single number can hide.
When Naive Wins
If a complex model cannot beat naive, trust the simple one. Simplicity that performs is a feature, not a failure.
Where to Go Next
With a baseline set, you are ready for real models like ARIMA or Prophet, each judged against this honest starting point.
Quick Check
What does a simple naive forecast predict for the next time step?
Recap: Earn the Complexity
You built naive, seasonal, and moving-average baselines, then measured error so future models must prove they are better.
คำถามที่พบบ่อย
บทเรียน “พื้นฐานการพยากรณ์ครั้งแรก” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “พื้นฐานการพยากรณ์ครั้งแรก” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ 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 ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน
บทเรียน “พื้นฐานการพยากรณ์ครั้งแรก” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Data Science Academy นี้ได้ไหม
ได้ บทเรียน Data Science Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- แนวโน้ม ฤดูกาล และสัญญาณรบกวน
- หน้าต่างเลื่อนและค่าหน่วง
- ความคงที่และการหาผลต่าง
- พื้นฐานการพยากรณ์ครั้งแรก