1 / 63

Simple Neural Nets for Pattern Classification

Simple Neural Nets for Pattern Classification. الشبكات العصبية البسيطة لتصنيف النمط. اعداد المهندسة : بنان عبد الكريم محمودي. How are neural networks used? كيف تستخدم الشبكات العصبية. Typical architectures : It is convenient to visualize neurons as arranged in layers

kassia
Télécharger la présentation

Simple Neural Nets for Pattern Classification

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Simple Neural Netsfor Pattern Classification الشبكات العصبية البسيطة لتصنيف النمط اعداد المهندسة : بنان عبد الكريم محمودي

  2. How are neural networks used?كيف تستخدم الشبكات العصبية • Typical architectures : • It is convenient to visualize neurons as arranged in layers • من المناسب تخيل او تصور الخلايا العصبية كانها مرتبة في طبقات • Neurons in the same layer behave in the same manner • الخلايا العصبية في نفس الطبقة تتصرف بنفس الطريقة • Key factors in determining the behavior of a neuron are its activation function and pattern of weighted connections over which sends and receives signals • العناصر الاساسية في تقرير سلوك الخلاية العصبية هو تابع تفعيلها ونمط ارتباطات الاوزان الذين يرسلان ويستقبلان الاشارات • Within each layer neurons usually have the same activation function and same pattern of weighted connections to other neurons • ضمن كل طبقة الخلايا العصبية عادة لها نفس تابع التفعيل ونفس نمط الاوزان المرتبطة بالخلايا الاخرى

  3. Typical architectures :(الهندسة المعمارية النموذجية) • The arrangement of neurons into layers and the connection patterns within and between layers is called the net architecture • ترتيب الخلايا العصبية داخل الطبقات وانماط الارتباط بين الطبقات يسمى هندسة الشبكة المعمارية • Many neural nets have an input layer in which the activation of each unit is equal to an external input signal • معظم الشبكات العصبية تملك طبقة ادخال حيث تفعيل كل وحدة مساوي لاشارة الدخل الخارجية مثال الشكل التالي الشبكة هنا تتألف من وحدات ادخال ووحدات اخراج ووحدة واحدة مخفية (ليست ادخال ولا اخراج )

  4. Typical architectures :(الهندسة المعمارية النموذجية) • Neural nets classified as ( تصنف الشبكات العصبية ) • Single layer (طبقة واحدة ) • Multilayer (متعددة الطبقات ) • In determining the number of layers the input units are not counted as a layer because they perform no computation . • في تحديد عدد الطبقات وحدات الادخال لاتعد كطبقة لانها لاتنجز اي حساب • The number of layers in the net can be defined to be the number of layers of weighted interconnected links between the slabs of neurons • عدد الطبقات في الشبكة يمكن ان يعرف بعدد طبقات خطوط الارتباطات الداخلية الموزونة بين كتل الخلايا العصبية مثال الشكل السابق يتألف من طبقتين

  5. Single layer net • Has one layer of connection weights • تملك طبقة واحدة من اوزان الارتباطات • The units can be distinguished as input units which receive signals from the outside world and output units from which the response of the net can be read • الوحدات يمكن ان توصف كوحدات ادخال التي تستقبل الاشارات من العالم الخارجي ووحدات اخراج وهو استجابة الشبكة الذي يمكن ان تقرأه • In typical single layer net shown in figure the input units are fully connected to output units but are not connected to other input units and output units are not connected to other output units • في الشبكة وحيدة الطبقة النموذجية المبينة بالشكل التالي وحدات الادخال ترتبط بشكل كامل بوحدات الاخراج ولكنها لاتتصل بوحدات ادخال اخرى ووحدات الاخراج لاترتبط بوحدات اخراج اخرى

  6. A Single layer net w11 X1 y1 wi1 w1j wn1 Xi yj wij wnj w1m Xn ym wim wnm One layer of weights output units Input units

  7. Single layer net • For pattern classification each output unit corresponds to a particular category • بالنسبة لنمط التصنيف كل وحدة اخراج تقابل صنف معين • Note : in single layer net the weight for one output unit do not influence the weights for other output units • ملاحظة : في الشبكات وحيدة الطبقة وزن اي وحدة اخراج لاتؤثر على اوزان وحدات اخراج اخرى • For pattern association the same architecture can be used but now the overall pattern of output signals gives the response pattern associated with the input signal that caused it to be produced • بالنسبة لنمط الارتباط نفس الهيكلية يمكن استخدامها ولكن الان جميع الانماط لاشارات الخرج تعطي نمط استجابة مرتبط باشارة الدخل التي كانت سبب انتاجها

  8. Multilayer net • Net with one or more layers or levels of nodes (called hidden units) between the input units and the output units • هي شبكة بطبقة او اكثر من العقد والتي تسمى الوحدات المختفية بين وحدات الدخل ووحدات الخرج • Can solve more complicated problems than can single layer nets • بامكانها ان تحل مشاكل معقدة اكثر من الشبكات وحيدة الطبقة • Training more difficult but some cases more successful • التدريب اكثر تعقيدا فيها ولكن في بعض الحالات اكثر نجاحا

  9. y1 w11 v11 Z1 w21 wp1 v21 vn1 y2 w12 w22 v12 wp2 v22 Z2 vn2 w13 v1p w13 v2p y3 wp3 vnp Zp w1m w2m wpm n ym A multilayer neural net

  10. Setting the weights • The method of setting the values of the weights (training) is an important distinguishing characteristic of different neural nets • طريقة اعداد قيم الاوزان (التدريب ) تعتبرخاصية مميزة هامة لمختلف الشبكات العصبية • Two types of training • Supervised(مشرف ) • Unsupervised(غير مشرف) • There are nets whose weights are fixed without an iterative training process • هناك نوع من الشبكات اوزانها ثابتة بدون عملية تدريب تكرارية • There is a useful correspondence between the type of training that is appropriate and the type of problem we wish to solve • هناك مراسلات مفيدة بين نوع التدريب الملائم ونوع المشكلة التي نريد حلها

  11. Supervised training • Training is accomplished by presenting a sequence of training vectors or patterns each with an associated target output vector . The weights are then adjusted according to a learning algorithm. This process is known as Supervised training • التدريب يكتمل بتقديم سلسلة من التدريبات الموجهة او الانماط مع الناتج المرتبط . الاوزان بعدها تضبط طبقا لخوارزمية التعليم هذه العملية تسمى بالتدريب المشرف عليه • In pattern classification the output is an elements say 1 (if input vector belongs to the category )or -1 (if dose not belong) • في تصنيف الانماط الخرج يكون 1 اذا كان الدخل يعود لصنف ويساوي -1 اذا كان لايعود لصنف • In pattern association if the desired output vector is the same as the input vector the net is an autoassociative memory • في النمط المرتبط إذا كان الخرج المطلوب نفس الدخل الشبكة تكون ذاكرة ترابط آلي

  12. Supervised training • If the output target vector is different from the input vector the net is a heteroassociative memory • إذا كان الخرج الهدف يختلف عن الدخل الشبكة هي ذاكرة • After training an associative memory can recall a stored pattern when it is given an input vector that is sufficiently similar to a vector it has learned • بعد التدريب الذاكرة الترابطية يمكنها استرجاع الانماط المخزنة عندما تعطى مدخل مشابه للمدخل التي تعلمته • The single layer nets (pattern classification nets )and (pattern association nets ) use Supervised training • شبكة الطبقة الوحيدة (شبكات الانماط المصنفة ) و(شبكات الانماط المرتبطة ) تستخدم هذا التدريب

  13. Unsupervised training • Self organizing neural nets group similar input vector together without the use of training data to specify what a typical member of each group • الشبكات العصبية ذاتية التنظيم تجمع مدخلات متشابهة مع بعض بدون استخدام تدريب البيانات لتحديد ماهو العنصر النموذجي لكل مجموعة • A sequence of input vectors is provided but no target vectors are assigned • سلسلة المدخلات الموجهة تجهز ولكن لايوجد هدف موجه مرتبط بها • The net modifies the weights so that the most similar input vectors are assigned to the same output (or cluster) unit • الشبكة تعدل الاوزان لذلك معظم المدخلات الموجهة المتشابهة ترتبط بنفس وحدة الخرج او تجتمع • The neural net will produce an exemplar (representative) vector for each cluster formed • الشبكة العصبية سوف تنتج نموذج (تمثيلي ) لكل شكل مجمع

  14. Fixed weight nets • The weight are set to represent the constraints and the quantity to be maximized or minimized • الوزن يوضع لتمثيل القيود والكمية اللتان ستزيدان او تقلان • Fixed weights are also used in contrast enhancing nets • تستخدم هذه الشبكات في شبكات تحسين المقارنة

  15. Summary of notation • Xi,yj activations of units Xi,Yj , respectively : for input units Xi, xi = input signal for other units Yj yj= f (y-inj) Wij weight on connection from unit Xi to unit Yj الوزن للإتصال بين الخليه المدخله Xi والخليه المخرجه yj beware : some authors use the opposite convention with wji denoting the weight from unit Yj to unit Xi Bias on unit Yj(الانحراف لخلية الخرج ) A bias acts like a weight on a connection from a unit with a constant Activation of 1 (figure 1.11) الانحراف يتصرف كالوزن في الاتصال من الوحدة بوصلة تنشيط ثابتة تساوي الواحد

  16. Summary of notation Net input to unit Yj: = bi + Ʃ xi wij i weight matrix: W={ } from unit i to unit j i: row index; j: column index Threshold for Activation of neuron Yj :

  17. Summary of notation عباره عن مجموعه المدخلات للشبكه Sعباره عن مجموعه التعليم وهي مجموعه المدخلات للشبكه من الإشارات في مرحلة التعليم t عبارة عن مجموعه المخرجات الهدف أي مجموعه الإشارات المخرجه التي من المفترض أن تخرجها بعد أن تنهي مرحلة التعليم .. Change in وهو عباره عن التغير في الوزن wij معدل التعليم The learning rate is used to control the amount of weight adjustment at each step of training يستخدم للتحكم بكمية الوزن المضبوطة في كل خطوة من التدريب

  18. Matrix multiplication method for calculating net inputطريقة ضرب المصفوفة لحساب مدخلات الشبكة • If the connection weights for a neural net are stored in a matrix W={ }, the net input to unit Yj (with no bias on unit j) is simply the dot product of the vectors x=(x1, x2, ……, xn) and Ʃ xi wij = i

  19. Biasالانحراف • A bias can be included by adding a component x0 = 1 to the vector x , i.e. (1,x1,………,xi, …….,xn) • The bias is treated exactly like any other weight i.e w0j = bj • The net input to unit Yj is given by n Ʃ xi wij = i=0 n Ʃ xi wij = w0j + i=1 n = bj Ʃ xi wij + i=1

  20. Architecture • The basic architecture of the simplest possible neural networks that perform pattern classification consists of a layer of input units and a single output unit. • الهيكلية الأساسية لأبسط الشبكات العصبية الممكنة الممثلة في تصنيف النمط تتألف من طبقة وحدات الدخل وطبقة وحيدة للخرج

  21. Neuron with a bias output unit Input units

  22. Biases and Thresholds • A bias acts exactly as a weight on a connection from a unit whose activation is always 1.increasing the bias increase the net input to the unit . If a bias is included , the activation function is typically taken to be • يتصرف الانحراف تماما كوزن في الاتصال من الوحدة حيث تابع تغعيله دائما 1 1 If net ≥ o F(net)= -1 If net < o Where = b + Ʃ xi wi net i

  23. Biases and Thresholds • Some authors do not use a bias weight , but instead use a fixed threshold • For the activation function in that case • بعض المؤلفين لايستخدموا وزن الانحراف ويستخدموا بدلا منه حد العتبة • يكون تابع التفعيل لهذه الحالة كما يلي : 1 If net ≥ F(net)= -1 If net < Where = Ʃ xi wi net • وهي تكافئ تماما استخدام الانحراف

  24. Linear Separability • It a linear decision boundary exist that correctly classifies all the training samples . • هو وجود حد قرار خطي يصنف كل عينات التدريب بدقة • The samples are said to be linearly separable • يقال إن العينات مفصولة بشكل خطي • The linear decision boundary is given by the equation: b + x1.w1+x2.w2 = 0 x2 = -w1 b . X1- w2≠0 w2 w2

  25. Linear Separability • Problems that are not linear separable are sometimes referred to as nonlinearly separable or topologically complex. • المشاكل التي لاتكون مفصولة بشكل خطي يشار لها كمفصولة غير خطيا أو مركب طوبولوجي • If the n training samples are linearly separable by linear decision boundary ,a single-layer feedforward network is capable of correctly classifying the samples .

  26. Linear Separability • Examples : • Logic functions and decision regions (0,1) (1,1) (0,1) (1,1) (0,1) (1,1) 1 1 1 0 0 1 0 0 0 1 0 1 (0,0) (0,0) (1,0) (0,0) (1,0) (1,0) AND OR XOR

  27. Linear Separability • Referring to figure we observe that some common logic functions OR and AND , are linearly separable and XOR is not linearly separable . • من الشكل السابق نلاحظ ان بعض التوابع المنطقية مفصولة خطيا (AND , OR) اما (XOR) غير مفصولة خطيا

  28. Learning Rule(قاعدة التعليم( • Associated with each neural network is a learning rule ,which changes the input functions . • ترتبط بكل شبكة عصبية قاعدة تعليم تغير بتوابع الدخل • Normally the learning rule defines how to change the weights in response to given input / output pairs • عادة تعرف قاعدة التعليم كيف تتغير الاوزان في استجابة لمدخل معطى او مخرج

  29. Hebb’s Rule • More than 50 years ago ,Donald O Hebb theorized that biological associative memory lies in the synaptic connections between nerve cells . • من خمسين سنة فسر العالم هيب ان الذاكرة الترابطية الحيوية تكمن في الوصلات العصبية بين الخلايا العصبية • He thought that the process of learning and memory storage involved changes in the strength with which nerve signals are transmitted across individual synapses . • فكر بأن عملية التعليم وتخزين الذاكرة يتضمن التغيير في شدة الاشارات العصبية المرسلة عبر وصلات عصبية فردية

  30. Hebb’s Rule • Hebb’s Rule states that pairs of neurons which are active simultaneously becomes stronger by weight changes. • قاعدة هيب حددت ان ازواج الخلايا العصبية النشيطة تصبح بشكل اني اقوى بتغير الوزن • Hebb’s Rule : the learning rule that states that the synaptic weight changes are proportional to the product of the synaptic activities of both the sending and receiving cells: • قاعدة التعليم التي حددت ان تغير وزن الوصلة العصبة نسبي لنشاطات الوصلات العصبية لكل الخلايا المرسلة والمستقبلة

  31. Hebb’s Rule . . = Where is the learning rate is the input is the output of the receiving neuron

  32. Algorithm :Hebb net (supervised) learning algorithm • Step0 . initialize weights and bias • Step1 . per each training sample s:t do steps 2 – 4 • Step2 . Set activations of input units : xi = si • STEP3 . Set activations of output units : y = t • Step4. update weight and bias : wi (new) = wi(old) + xi. y b (new) = b (old) + y

  33. Application • Bias types of input are not explicitly used in the original formulation of Hebb learning . • انواع الانحرافات للدخل لم تستخدم بشكل واضح في الصيغة الاصلية لتعليم هيب • Logic functions Examples: a Hebb net for the AND function : binary inputs and target input y=target (x1, x2, 1) (1, 1, 1) 1 (1, 0, 1) 0 (0, 1, 1) 0 (0, 0, 1) 0 bias unit

  34. Logic functions • For each training input :target , the weight change is the product of the input vector and the target value i.e. t = x1t = x2t = The new weights are the sum of the previous weights and the weight change . Only one iteration through the training vectors is required . The weight updates for the first input are as follows : input Target Weight changes Weights (x1, x2, 1) ( ) (w1 w2 b) (0 0 0) (1, 1, 1) 1 (1 1 1 ) (1 1 1)

  35. Logic functions • The separating line becomes x2 = - x1 – 1 • The graph presented in figure 2.7 shows that the response of the net will now be correct for the first input pattern . Presenting the second ,third and fourth training input shows that because the target value is 0 , no learning occurs . Thus using binary target values prevents the net from learning any pattern for which the target is “ off” :

  36. Figure 2.7 decision boundary for binary AND function using Hebb rule after first training pair x2 0 + 0 0 x1

  37. Logic functions (x1, x2, 1) (Δw1 Δw2 Δb) (w1 w2 b) (1, 0, 1) 0 (0 0 0 ) (1 1 1) (0, 1, 1) 0 (0 0 0) (1 1 1) (0, 0, 1) 0 (0 0 0) (1 1 1) Weight changes input Target Weights

  38. Logic functions • Example 2.6 Hebb net for the AND function : binary inputs, bipolar targets input Target (x1, x2, 1) (1, 1, 1) 1 (1, 0, 1) -1 (0, 1, 1) -1 (0, 0, 1) -1

  39. Logic functions • Presenting the first input including a value of 1 for the third component yields the following: input Target Weight changes Weights (x1, x2, 1) ( ) (w1 w2 b) (0 0 0) (1, 1, 1) 1 (1 1 1 ) (1 1 1) The separating line becomes x2 = - x1 – 1

  40. Logic functions • Figure 2.8 shows the response of the net will now be correct for the first input pattern. • Presenting the second ,third and fourth training patterns shows that learning continues for each of these patterns (since the target value is now -1 rather than 0 as in example 2.5)

  41. x2 - + - - x1 Figure 2.7 decision boundary for AND function using Hebb rule after first training pair (binary inputs , bipolar targets )

  42. Logic functions Weight changes input Target Weights (x1, x2, 1) (Δw1 Δw2 Δb) (w1 w2 b) (1, 0, 1) -1 (-1 0 -1 ) (0 1 0) (0, 1, 1) -1 (0 -1 -1) (0 0 -1) (0, 0, 1) -1 (0 0 -1) (0 0 -2) However these weights do not provide the correct response for the first input pattern

  43. Logic functions • The choice of training patterns can play a significant role in determining which problems can be solved using the Hebb rule . • الاختيار لتدريب الانماط يمكن ان يلعب دور هام في تقرير اي المشاكل يمكن حلها باستخدام قاعدة هيب • The next example shows that the AND function can be solved if we modify its representation to express the inputs as well as the targets in bipolar form • المثال التالي يظهر ان تابع AND يمكن ان يحل اذا عدلنا تمثيله لاظهار المدخلات مثل الهدف في شكل قطبي

  44. Logic functions • Bipolar representation of the inputs and targets allows modification of a weight when the input unit and target value are both “on” at the same time and when they are both “of” at the same time . • التمثيل القطبي للمدخلات والاهداف يسمح بتعديل الوزن عندما تكون قيم وحدة الدخل والهدف كلاهما on في نفس الوقت وعندما يكونوا off في نفس الوقت • The algorithm is the same as that just given expect that now all units will learn whenever there is an error in the output • الخوارزمية هي نفسها المعطاة من قبل نتوقع الان ان كل الوحدات سوف تتعلم عندما يكون هناك خطأ في الناتج

  45. Logic functions • Example 2.7 Hebb net for the AND function : bipolar inputs and targets input Target (x1, x2, 1) (1, 1, 1) 1 (1, -1, 1) -1 (-1, 1, 1) -1 (-1, -1, 1) -1

  46. Logic functions • Presenting the first input including a value of 1 for the third component yields the following: Target input Weights Weight changes (x1, x2, 1) ( ) (w1 w2 b) (0 0 0) (1, 1, 1) 1 (1 1 1 ) (1 1 1) The separating line becomes x2 = - x1 – 1

  47. Logic functions • Figure 2.9 shows the response of the net will now be correct for the first input point (and also by the way for the input point (-1,-1) ) . Presenting the second input vector and target results in the following situation:

  48. Figure 2.9 decision boundary for AND function using Hebb rule after first training pair (bipolar inputs , bipolar targets ) x2 - + x1 - -

  49. Logic functions input Target Weight changes Weights (x1, x2, 1) ( ) (w1 w2 b) (1 1 1) (1, -1, 1) -1 (-1 1 -1 ) (0 2 0) The separating line becomes x2 = 0

  50. Logic functions • Figure 2.10 shows the response of the net will now be correct for the first two input point (1,1) and (1,-1) and also for input point (-1,-1) • Presenting the third input vector and target yields the following :

More Related