0Pricing
MLOps Academy · บทเรียน

การทดสอบพฤติกรรมของโมเดล

ตรวจสอบความไม่แปรเปลี่ยนและทิศทางที่คาดหวัง

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

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

Beyond a Single Accuracy Number

One accuracy score hides how a model truly behaves. Behavioral tests probe how predictions react when you change the input on purpose.

Treat the Model as a Black Box

Behavioral tests check inputs and outputs only, ignoring the model internals. This black-box view works for any framework you serve.

Invariance Tests

Some changes should not move the prediction at all. An invariance test swaps a neutral word and asserts the output stays the same.

assert predict("great hotel") == predict("great motel")

Directional Expectation Tests

Other changes should move output a known way. A directional test adds a positive word and asserts the score goes up, not down.

assert predict("good") < predict("very good")

Minimum Functionality Tests

Check the easy cases a model must never miss. A minimum functionality test asserts an obvious example gets the obvious label.

From the CheckList Idea

These three test types come from the CheckList paper for NLP. The pattern generalizes to tabular, vision, and any model you ship.

Test Fairness Slices

Run the same case across groups. A slice test asserts prediction quality stays steady when only a sensitive attribute changes.

Robustness to Noise

Add a typo or jitter a number and the label should hold. A robustness test guards against tiny, harmless perturbations.

assert predict("hotle") == predict("hotel")

Pin a Known Prediction

Lock the output for a fixed example so retrains do not drift it silently. This regression test flags surprise behavior changes.

Wire Them Into pytest

Behavioral tests are ordinary pytest functions. They live beside your data tests and run in the same CI step on every push.

def test_invariance(model):
    assert model.predict(a) == model.predict(b)

Tests Encode Your Specs

Each behavioral test is a written rule the model must obey. Together they form a living specification of expected behavior.

Quick Check

Adding a stronger positive word should raise a sentiment score. Which test is that?

Recap: Probe Behavior, Not Just Scores

You now run behavioral tests: invariance, directional, and minimum functionality cases that turn expected model behavior into checks CI enforces. ✅

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

บทเรียน “การทดสอบพฤติกรรมของโมเดล” ฟรีหรือไม่

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

คุณจะเรียนรู้อะไรในบทเรียน “การทดสอบพฤติกรรมของโมเดล”

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

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

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

บทเรียน “การทดสอบพฤติกรรมของโมเดล” ใช้เวลานานแค่ไหน

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

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

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

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

  1. ทดสอบหน่วยของไปป์ไลน์ข้อมูล
  2. การทดสอบพฤติกรรมของโมเดล
  3. กำหนดเกณฑ์คุณภาพและค่าขีดจำกัด
  4. ตรวจสอบข้อมูลด้วย Great Expectations
← กลับไปที่ MLOps Academy