0Pricing
NLP Academy · درس

ضبط قوة التنظيم

تحكّم في فرط التخصيص باستخدام C

ضبط قوة التنظيم درس مجاني في NLP Academy على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في NLP Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة NLP Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Why Models Overfit Text

With thousands of word features, a model can memorize quirks of the training set. Regularization keeps it from chasing that noise. 🧯

Penalize Big Weights

Regularization adds a penalty for large coefficients. The model must justify every big weight, so it stays simpler and generalizes better.

Meet the C Parameter

In scikit-learn you control strength with C. It is the inverse of regularization, so smaller C means a stronger penalty.

clf = LogisticRegression(C=1.0)

Small C, Simpler Model

A tiny C shrinks weights hard toward zero. The model becomes very simple, which can underfit and miss real signal.

clf = LogisticRegression(C=0.01)

Large C, Trusts the Data

A big C weakens the penalty and lets weights grow. The model fits training data closely but risks overfitting.

clf = LogisticRegression(C=100)

L2 Is the Friendly Default

The default L2 penalty gently shrinks all weights. It is a safe starting point for most text classification problems.

L1 Drives Weights to Zero

Switching to the L1 penalty zeroes out many coefficients, performing feature selection and giving you a sparser, simpler model.

clf = LogisticRegression(penalty='l1', solver='liblinear')

Tune With Cross-Validation

Do not guess C by hand. Use cross-validation to test several values and pick the one that scores best on held-out folds.

Search a Grid of Values

GridSearchCV tries each C, runs cross-validation, and reports the winner. Sweep C across powers of ten for a fast first pass.

from sklearn.model_selection import GridSearchCV
grid = {'C': [0.1, 1, 10]}

Read the Best Parameter

After fitting, best_params_ shows the C that won. The matching model is ready for honest evaluation on your test set.

print(search.best_params_)

Aim for the Sweet Spot

The goal is balance: enough freedom to learn, enough penalty to generalize. That sweet spot gives the best score on unseen text.

Quick Check

What happens as you lower the C value?

Recap: Balance With C

Regularization fights overfitting, and C sets its strength inversely. Tune C with cross-validation to find the balanced sweet spot. ✅

الأسئلة الشائعة

هل درس «ضبط قوة التنظيم» مجاني؟

نعم — نص درس «ضبط قوة التنظيم» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة NLP Academy، انتقل إلى CoddyKit PRO. تتضمن دورة NLP Academy 4 دروس في المجموع.

ماذا ستتعلم في «ضبط قوة التنظيم»؟

تحكّم في فرط التخصيص باستخدام C تتمرن على NLP Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ NLP Academy؟

لا تُشترط خبرة سابقة. NLP Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.

كم من الوقت يستغرق درس «ضبط قوة التنظيم»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس NLP Academy هذا؟

نعم. كل درس في NLP Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. لماذا ينجح Logistic Regression مع النصوص
  2. التدريب على سمات TF-IDF
  3. فحص أقوى المعاملات
  4. ضبط قوة التنظيم
← العودة إلى NLP Academy