اشتراط جودة النموذج لدمج التغييرات
امنع طلب السحب إذا حقق النموذج الجديد نتيجة أسوأ.
اشتراط جودة النموذج لدمج التغييرات درس مجاني في MLOps Academy على CoddyKit. هذا هو الدرس 3 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في MLOps Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة MLOps Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
A Gate at the Merge
A quality gate blocks a pull request from merging unless the new model is good enough. It turns model quality into a hard rule, not a hope. 🚧
Why Code Tests Are Not Enough
Code can pass every test and still produce a worse model. You need a separate check on the metric, like accuracy or F1, to protect users.
Pick One Guarding Metric
Choose a single primary metric that reflects success for your task. Gating on too many numbers at once makes every PR a confusing negotiation.
Set a Clear Threshold
Define a minimum bar, your threshold. If the new model scores below it, the build fails and the merge is blocked automatically.
MIN_ACCURACY = 0.85Evaluate on a Fixed Set
Always score against the same held-out test set. A frozen evaluation set makes comparisons fair across every pull request and run.
Fail the Build on Purpose
In CI, a step that exits with a non-zero code marks the job failed. So if the metric misses, you deliberately raise an error to stop the merge.
if acc < MIN_ACCURACY:
raise SystemExit(f"acc {acc} below bar")Compare to the Champion
A smarter gate compares the new model to the current baseline in production, blocking merges that regress instead of just hitting a fixed number.
assert new_acc >= baseline_accBranch Protection Enforces It
In GitHub, mark the CI job a required check under branch protection. Then the merge button stays disabled until your gate passes.
Surface the Number in the PR
Print the score so reviewers see it. A clear log line or PR comment showing the metric turns a red X into an explanation people trust.
print(f"::notice::accuracy={acc:.3f}")Allow a Reviewed Override
Sometimes a small dip is fine. Let a human override a failed gate through review approval, so the rule guides without fully blocking the team.
Guard Against Flaky Scores
Set a seed and a stable test set so the same model gives the same number. A deterministic eval keeps the gate from failing on pure luck.
Quick Check
How does a CI step actually block a merge when the model is too weak?
Recap
Pick one metric, set a threshold or beat the baseline, and fail the build when it misses. Mark the job required so a weak model can never merge silently.
الأسئلة الشائعة
هل درس «اشتراط جودة النموذج لدمج التغييرات» مجاني؟
نعم — نص درس «اشتراط جودة النموذج لدمج التغييرات» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة MLOps Academy، انتقل إلى CoddyKit PRO. تتضمن دورة MLOps Academy 4 دروس في المجموع.
ماذا ستتعلم في «اشتراط جودة النموذج لدمج التغييرات»؟
امنع طلب السحب إذا حقق النموذج الجديد نتيجة أسوأ. تتمرن على MLOps Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ MLOps Academy؟
لا تُشترط خبرة سابقة. MLOps Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 3 من أصل 4.
كم من الوقت يستغرق درس «اشتراط جودة النموذج لدمج التغييرات»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس MLOps Academy هذا؟
نعم. كل درس في MLOps Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- ماذا تعني CI/CD للنماذج
- سير عمل GitHub Actions لتعلّم الآلة
- اشتراط جودة النموذج لدمج التغييرات
- بناء الصورة ودفعها عند الإصدار