正在加载图片...
-7- Let's look at the values that might be stored on one row of this table,for example,row 5: 0 y ny 3 4 5 row 5 3 个 8 11 14 The value at sa[5][2]is 8,which tells us that S-unit 5 connects to A-unit 8.Taken as a whole,this row tells us that S-unit 5 connects to A-units 3,7,8,11,14,and 15.Clearly with a table like this we can specify all of the S-to-A connections. Now we just need another table to specify the connection from the A-units to the R-units.Since these are weighted connections,we will take a slightly different approach.We will use another table, called aR that has as many columns as there are R-units(4 in our case).aR[i]]is the weight of the connection from A-unit i to R-unit j.This table will be 16 x 4 in size,and a row might look like this (the data type is double): 0 2 row 10 1.20.80.0 1.4 Suppose the sum of the inputs to A-unit 10 is x,and x>=THRESHOLD.Then A-unit 10 sends a value of 1.2 x to R-unit 0,0.8 x to R-unit 1,0.o to R-unit 2 (the weight is zero),and 1.4* x to R-unit 3.Note:the weights are allowed to be negative. The processing at the R-units is easy:we just find the one with the largest total,and resolve ties any way we want to. Here is the declaration of the tables and some arrays you will need: int sAIN SUNITS][N S TO A]; double aR[N AUNITS][N RUNITS]; int s[N SUNITS]; int a[N AUNITS]; double r[N RUNITS]; The first two lines declare the connection tables,as described above.The array s is the stimulus, and the arrays a and give you a place to accumulate the sums for the A-units and R-units.Your job is to write three functions that simulate the operation of the perceptron: void FiresToA(int s[],int sA[][N_S_TO A],int a[]); void FireAToR(int a[],double aR[][N RUNITS],double r[]); int classifyPattern(double r[]);– 7 – Let’s look at the values that might be stored on one row of this table, for example, row 5: The value at sA[5][2] is 8, which tells us that S-unit 5 connects to A-unit 8. Taken as a whole, this row tells us that S-unit 5 connects to A-units 3, 7, 8, 11, 14, and 15. Clearly with a table like this we can specify all of the S-to-A connections. Now we just need another table to specify the connection from the A-units to the R-units. Since these are weighted connections, we will take a slightly different approach. We will use another table, called aR that has as many columns as there are R-units (4 in our case). aR[i][j] is the weight of the connection from A-unit i to R-unit j. This table will be 16 x 4 in size, and a row might look like this (the data type is double): Suppose the sum of the inputs to A-unit 10 is x, and x >= THRESHOLD. Then A-unit 10 sends a value of 1.2 * x to R-unit 0, 0.8 * x to R-unit 1, 0.0 to R-unit 2 (the weight is zero), and 1.4 * x to R-unit 3. Note: the weights are allowed to be negative. The processing at the R-units is easy: we just find the one with the largest total, and resolve ties any way we want to. Here is the declaration of the tables and some arrays you will need: int sA[N_SUNITS][N_S_TO_A]; double aR[N_AUNITS][N_RUNITS]; int s[N_SUNITS]; int a[N_AUNITS]; double r[N_RUNITS]; The first two lines declare the connection tables, as described above. The array s is the stimulus, and the arrays a and r give you a place to accumulate the sums for the A-units and R-units. Your job is to write three functions that simulate the operation of the perceptron: void FireSToA(int s[], int sA[][N_S_TO_A], int a[]); void FireAToR(int a[], double aR[][N_RUNITS], double r[]); int ClassifyPattern(double r[]); 3 7 8 11 14 15 row 5 0 1 2 3 4 5 row 10 1.2 0.8 0.0 1.4 0 1 2 3
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有