Neural Network Summary

Advertisements

At this point, we will apply our neural network to a working model and verify its correctness after we have completed our Python codes to perform forward and backward progression.

It is worth noting that our neural network must be programmed automatically to recognize the appropriate weights to perform this task.

By applying the neural network for 1500 iterations, we notice that the value of the loss gradually decreases for each iteration, according to what is shown in the graph, which is in line with the aforementioned algorithm.

So the final prediction result for the 1500-repeat neural network is as follows:

Predictions after 1500 training iterations

By comparing the predictions with the real values, we find that there is agreement between them with a slight difference. This means that the training of the neural network was successful due to the forward and backward algorithm.

Advertisements

Neural Network Summary

Advertisements

في هذه المرحلة سنقوم بتطبيق الشبكة العصبية الخاصة بنا على نموذج عملي ونتأكد من صحتها وذلك بعد أن اكتملت لدينا أكواد البايثون المخصصة لإجراء التقدم للأمام والعودة إلى الخلف

من الجدير بالذكر أنه يجب أن تبرمج شبكتنا العصبية تلقائياً على التعرف على الأوزان المناسبة لأداء هذه المهمة

وبالتطبيق العملي على الشبكة العصبية لـ 1500 تكرار نلاحظ أن قيمة الخسارة تنخفض تدريجياً لكل تكرار وفق ما هو موضح في المخطط البياني وهو ما يتماشى مع الخوارزمية المذكورة آنفاً

: لتصبح نتيجة التنبؤ النهائية للشبكة العصبية المكونة من 1500 تكرار على النحو التالي

تنبؤات بعد 1500 تدريب

بمقارنة التنبؤات مع القيم الحقيقة نجد أن هناك توافق بينهما مع وجود اختلاف بسيط هذا يعني أن تدريب الشبكة العصبية تكلل بالنجاح  بفعل الخوارزمية الخاصة بالتقدم للأمام والرجوع إلى الخلف 

Advertisements

Backpropagation

Advertisements

After finding the errors and deviations in the data values, we must adjust the appropriate value for the weights and biases through the derivative of the deviation function related to them, which indicates the slope of the function in calculus.

Gradient Regression Algorithm

If the value of the derivative is known to us, we reset the ratios of weights and biases by raising or decreasing those ratios, but this is not enough to calculate the derivative of the skew function directly in terms of weights and biases because their value does not exist in the equation that represents them, so it is necessary to use the law of the serial scale to reach the solution .

This mathematical equation may seem somewhat complicated, but it is the only way to lead us to the correct solution. For simplicity, we have shown the partial derivative of a single-layer Neural Network.
After we extract this result, we add the backpropagation task in the Python code for our case.

And in the following video tutorial, a detailed explanation of the law of the serial scale in backpropagation and the application of calculus is provided by 3Blue1Brown

Advertisements

Backpropagation

Advertisements

بعد العثور على الأخطاء والانحرافات في قيم البيانات يتوجب علينا ضبط القيمة المناسبة للأوزان والتحيزات من خلال مشتق دالة الانحراف المتعلقة بهما والتي تدل على ميل الدالة بحساب التفاضل والتكامل 

خوازمية انحدار التدرج

إذا كانت قيمة المشتق معلومة لدينا فنقوم بإعادة تعيين نسب الأوزان والتحيزات عن طريق رفع تلك النسب أو خفضها إلا أن هذا لا يكفي لحساب مشتق دالة الانحراف مباشرةً بدلالة الأوزان والتحيزات لأن قيمتهما غير موجودة في المعادلة الممثلة لها لذلك لابد من الاستعانة بقانون المقياس التسلسلي للوصول إلى الحل

قد تبدو هذه المعادلة الحسابية معقدة نوعاً ما لكنها السبيل الوحيد لإيصالنا إلى الحل السليم وعلى سبيل التبسيط قمنا إظهار المشتق الجزئي  

مؤلفة من طبقة واحدة Neural Network لـ

وبعد استخلاصنا لهذه النتيجة نقوم بإضافة

في كودات بايثون لحالتنا هذه  backpropagation مهمة

وفي الفيديو التعليمي التالي شرح مفصل لقانون

backpropagation المقياس التسلسلي في

Blue1Brown3  وتطبيق التفاضل والتكامل مقدم من

Advertisements

Loss function

Advertisements

In the previous article, we had talked about the concept of Neural Network and how to manipulate weights and biases to get more accurate results based largely on finding the Loss function.

This is done by using the tool for assessing the general variance of the data set from its mean, which is called sum-of-sqaures, which is a statistical measure of deviation from the mean in the data set, which is shown by the equation:

The sum of the variance between the predictive values ​​and the real value is what we call the term sum of squares error, and this is done by squaring the difference by measuring its absolute value.

Through this study we can find accurate formulas for weights and biases that avoid as much as possible the loss of a job that could create a problem in reaching correct results.

Advertisements

Loss Function

Advertisements

كنا قد تحدثنا في المقال السابق عن مفهوم

وكيفية التعامل مع الأوزان Neural Network

والتحيزات للحصول على نتائج أكثر دقة تعتمد

Loss function بشكل كبير على العثور على

التي تعرقل الحصول على تلك النتائج ومعالجتها

بالشكل الصحيح ويتم ذلك باستخدام أداة تقييم التباين

العام لمجموعة البيانات من وسطها والتي

والتي تعتبر مقياس إحصائي sum-of-sqaures تسمى

للانحراف عن المتوسط في مجموعة البيانات

: والموضوح بالمعادلة

فحاصل التباين بين القيم التنبؤية والقيمة الحقيقة هو ما نطلق عليه مصطلح خطأ مجموع المربعات ويتم ذلك بتربيع الفرق بقياس قيمته المطلقة . ومن خلال هذه الدراسة يمكننا إيجاد صيغ دقيقة للأوزان والتحيزات التي تجنبنا قدر الإمكان من فقدان وظيفة يمكن أن تخلق مشكلة في الوصول إلى نتائج صحيحة

Advertisements

What’s A Neural Network?

Advertisements

The general concept of the work of this system can be summarized by analogy with the work system of the brain, which depends for its content on a mathematical mechanism based on several inputs that determine the structure of the required results.

Accordingly, we can define the components of the Neural Network:

  • input layer x
  • Irregular hidden layers
  • output layer ŷ
  • Different equilibriums between classes w and b
  • Determine the sigmoid activation function of the hidden layers σ.

Often when calculating the number of Neural Network layers the input layer is ignored as shown in this two-layer Neural Network architecture diagram :

It is easy to create a Neural Network in Python:

Neural Network Training:

The value of ŷ for a simple two-layer Neural Network is derived by the following equation:

It is clear from the previous equation that the values ​​of the variables represented by the weights w and the biases b, after careful tuning of their values, determine the output of ŷ, which represents the output value, and this is known as the Neural Network training.

We can divide each iteration of the training process into the following stages:

• The stage of calculating the value of the outputs, defined as: feedforward

• The stage of updating the values ​​of w and b, defined as: backpropagation

This is what the sequential graph shows :

feedforward

The above graph shows that Feedforward is a simple calculus and accordingly the output of a two-layer Neural Network is :

By adding the basic task of Feedforward in the Python code in our previous case, assuming that the value of biases is zero, that is, it is equal to zero, we get:

However, we have to find a more accurate method for our predictions.. This method is provided by the Loss Function property that we will learn about in the next essay .

Advertisements

؟ Neural Network ما هو مفهوم

Advertisements

يمكن تلخيص المفهوم العام لعمل هذه المنظومة بتشبيهها بمنظومة عمل الدماغ التي تعتمد بمضمونها على آلية رياضية مبنية على عدة مدخلات تحدد هيكلية النتائج المطلوبة

Neural Network وبناءً على ذلك يمكننا تحديد مكونات

x طبقة الإدخال *

طبقات مخفية غير منتظمة * 

ŷ طبقة الإخراج *

b و w توازنات مختلفة بين بين الطبقات *

σ تحديد وظيفة التنشيط السينية للطبقات المخفية *

Neural Network في الغالب عند حساب عدد طبقات

يتم تجاهل طبقة الإدخال كما هو موضح في

Neural Network هذا الرسم البياني لبنية

: مؤلفة من طبقتين

Neural Network ويعتبر من السهل إنشاء

في لغة بايثون

: Neural Network تدريب

Neural Network لـ ŷ يتم استنتاج قيمة

: بسيطة من طبقتين بالمعادلة التالية

يتبين لنا من خلال المعادلة السابقة أن

b والتحيزات w قيم المتغيرات المتمثلة بالأوزان

بعد تحري الدقة في ضبط قيمها هي التي

التي تمثل قيمة المخرجات ŷ تحدد ناتج

Neural Network وهذا ما يُعرَف بتدريب

يمكننا تقسيم كل تكرار لعملية التدريب

: إلى المراحل التالية

ŷ مرحلة حساب قيمة المخرجات *

    feedforward : والمحددة باسم

    b و w مرحلة تحديث قيم *

    backpropagation : والمحددة باسم

    : وهذا ما يوضحه الرسم البياني المتسلسل

    Feedforward

    Feedforward يوضح الرسم البياني السابق أن

    هو عملية حسابية بسيطة للتفاضل والتكامل

    Neural Network وبناءً عليها يكون ناتج

    : مكونة من طبقتين هو

    Feedforward وبإضافة المهمة الأساسية لـ

    في كود بايثون في حالتنا السابقة مع افتراض

    أن قيمة التحيزات معدومة أي أنها

    : تساوي الصفر ينتج لدينا

    إلا أنه يتوجب علينا إيجاد طريقة

    .. أكثر دقة لتنبؤاتنا

    Loss Function هذه الطريقة توفرها لنا خاصية

    التي ستنعرف عليها في المقال القادم

    Advertisements