0Pricing
Machine Learning Academy · درس

البرمجة التقليدية في مقابل تعلّم الآلة

قارن بين البرمجة القائمة على القواعد والتعلّم القائم على البيانات، وافهم سبب تفوق ML على المنطق المكتوب يدويًا في مهام التعرف على الأنماط

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

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

What Is Traditional Programming?

في البرمجة التقليدية، تكتب كل قاعدة يدويًا ويتبعها الكمبيوتر. وهي تعمل بشكل رائع عندما تكون القواعد واضحة، ولكنها تصبح مستحيلة مع المشكلات المعقدة.

Rules-Based Systems and Their Limits

فلتر البريد العشوائي القائم على القواعد ليس سوى سلسلة طويلة من جمل الشرط (if). ما المشكلة؟ مرسلو البريد العشوائي يتكيفون، فيكتبون fr33 بدلاً من free — وستحتاج قواعدك إلى تحديث لا نهائي.

# Traditional rules-based spam filter
def is_spam_traditional(email_text):
    spam_words = ['free', 'winner', 'click here', 'buy now']
    for word in spam_words:
        if word in email_text.lower():
            return True
    return False

print(is_spam_traditional('You are a WINNER! Click here for free stuff'))
# Output: True
print(is_spam_traditional('fr33 stuff for you!'))
# Output: False  -- fails on obfuscated spam

How Machine Learning Flips the Paradigm

Machine learning flips the script: instead of writing rules, you feed the model many examples with correct answers, and it learns the rules on its own.

# The ML paradigm shift
# Traditional: Input + Rules -> Output
# ML:          Input + Output -> Rules (learned automatically)

# Pseudocode conceptual example
from sklearn.naive_bayes import MultinomialNB
from sklearn.feature_extraction.text import CountVectorizer

emails = ['Free money now', 'Meeting at 3pm', 'Win a prize', 'Project update']
labels = [1, 0, 1, 0]  # 1=spam, 0=not spam

vectorizer = CountVectorizer()
X = vectorizer.fit_transform(emails)

model = MultinomialNB()
model.fit(X, labels)  # model learns the rules from data

Data as the New Source of Intelligence

The fuel for machine learning is labeled data — examples where you know the right answer. The more good data you have, the more the model can learn.

When Traditional Programming Still Wins

ML isn't always the answer. Stick with traditional code when the rules are clear and stable, when you have very little data, or when you need fully predictable behaviour.

Pattern Recognition: Where ML Shines

ML really shines at pattern recognition — spotting a cat in a photo, flagging fraud, recognising speech. These patterns are too subtle to spell out by hand.

The Learning Process in Brief

At its core, a model learns by minimising error: it guesses, sees how wrong it was, and adjusts — like fixing your aim after each dart throw. 🎯

# Conceptual training loop
import numpy as np

# Simulate a simple learning process
learning_rate = 0.1
weight = 0.0  # start with a random guess

for epoch in range(10):
    prediction = weight * 2.0
    target = 5.0
    error = target - prediction
    weight += learning_rate * error  # adjust based on error
    print(f'Epoch {epoch+1}: weight={weight:.3f}, error={error:.3f}')

Key Vocabulary: Model, Training, Inference

Three words you'll use a lot: a model maps inputs to outputs, training teaches it from examples, and inference is using it on new data.

Generalisation: The True Goal

The real goal of ML is generalisation — doing well on new, unseen data, not just memorising the training set. That's why we always test on fresh data.

A Concrete Comparison Side by Side

Predicting house prices? Traditional code uses a human's guessed formula. An ML model instead learns the right weights straight from real sales data.

# Traditional: hand-coded formula
def price_traditional(bedrooms, bathrooms, sqft):
    return 100000 + bedrooms * 50000 + bathrooms * 30000 + sqft * 150

# ML: coefficients learned from data
from sklearn.linear_model import LinearRegression
import numpy as np

# Training data (bedrooms, bathrooms, sqft)
X_train = np.array([[3, 2, 1500], [4, 3, 2000], [2, 1, 900]])
y_train = np.array([300000, 450000, 180000])

model = LinearRegression()
model.fit(X_train, y_train)  # learns coefficients from data
print('Learned coefficients:', model.coef_)

Why ML Is Transforming Every Industry

ML is booming because three things lined up: massive data, cheap powerful hardware (GPUs), and free open-source tools that put it in everyone's hands.

Quick Check

Test your understanding of Machine Learning with Python concepts from this lesson.

Lesson Recap

Great start! Traditional code follows hand-written rules, ML learns rules from labeled data, and its true goal is generalising — not memorising. Next: the types of ML.

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

هل درس «البرمجة التقليدية في مقابل تعلّم الآلة» مجاني؟

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

ماذا ستتعلم في «البرمجة التقليدية في مقابل تعلّم الآلة»؟

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

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

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

كم من الوقت يستغرق درس «البرمجة التقليدية في مقابل تعلّم الآلة»؟

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

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

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

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

  1. البرمجة التقليدية في مقابل تعلّم الآلة
  2. التعلّم الخاضع للإشراف وغير الخاضع للإشراف والتعلّم المعزز
  3. سير عمل ML: من البيانات إلى التنبؤ
  4. ML في العالم الحقيقي: حالات الاستخدام والقيود
← العودة إلى Machine Learning Academy