Announcements | Last Post | |
---|---|---|
SoC Curricula | 09/30/2017 01:08PM | |
Demarcation or scoping of examinations and assessment | 02/13/2017 07:59AM | |
School of Computing Short Learning Programmes | 11/24/2014 08:37AM | |
Unisa contact information | 07/28/2011 01:28PM |
Example paper - Solution needed September 25, 2007 03:11AM |
Registered: 17 years ago Posts: 26 Rating: 0 |
Re: Example paper - Solution needed September 25, 2007 11:38AM |
Registered: 18 years ago Posts: 4 Rating: 0 |
Re: Example paper - Solution needed September 26, 2007 12:49AM |
Registered: 17 years ago Posts: 26 Rating: 0 |
Re: Example paper - Solution needed September 26, 2007 03:30PM |
Registered: 18 years ago Posts: 13 Rating: 0 |
Re: Example paper - Solution needed September 26, 2007 04:35PM |
Registered: 16 years ago Posts: 9 Rating: 0 |
Re: Example paper - Solution needed September 27, 2007 07:55AM |
Registered: 18 years ago Posts: 3,015 Rating: 5 |
Anonymous User
Re: Example paper - Solution needed September 27, 2007 01:08PM |
Rating: 0 |
Re: Example paper - Solution needed September 27, 2007 02:20PM |
Registered: 16 years ago Posts: 9 Rating: 0 |
Anonymous User
Re: Example paper - Solution needed September 27, 2007 02:31PM |
Rating: 0 |
Re: Example paper - Solution needed September 28, 2007 05:52PM |
Registered: 18 years ago Posts: 1,682 Rating: 0 |
,= ,-_-. =. ((_/)o o(\_)) `-'(. .)`-' \_/http://ilanpillemer.com
Re: Example paper - Solution needed September 28, 2007 06:24PM |
Registered: 17 years ago Posts: 125 Rating: 0 |
Re: Example paper - Solution needed September 29, 2007 03:40PM |
Registered: 16 years ago Posts: 9 Rating: 0 |
Re: Example paper - Solution needed September 29, 2007 11:04PM |
Registered: 18 years ago Posts: 1,682 Rating: 0 |
,= ,-_-. =. ((_/)o o(\_)) `-'(. .)`-' \_/http://ilanpillemer.com
Re: Example paper - Solution needed September 30, 2007 06:31AM |
Registered: 18 years ago Posts: 13 Rating: 0 |
Re: Example paper - Solution needed September 30, 2007 01:31PM |
Registered: 18 years ago Posts: 1,682 Rating: 0 |
,= ,-_-. =. ((_/)o o(\_)) `-'(. .)`-' \_/http://ilanpillemer.com
Re: Example paper - Solution needed September 30, 2007 02:32PM |
Registered: 18 years ago Posts: 1,682 Rating: 0 |
,= ,-_-. =. ((_/)o o(\_)) `-'(. .)`-' \_/http://ilanpillemer.com
Re: Example paper - Solution needed September 30, 2007 03:22PM |
Registered: 18 years ago Posts: 13 Rating: 0 |
Re: Example paper - Solution needed September 30, 2007 04:06PM |
Registered: 18 years ago Posts: 1,682 Rating: 0 |
,= ,-_-. =. ((_/)o o(\_)) `-'(. .)`-' \_/http://ilanpillemer.com
Re: Example paper - Solution needed October 01, 2007 11:52AM |
Registered: 18 years ago Posts: 1,682 Rating: 0 |
,= ,-_-. =. ((_/)o o(\_)) `-'(. .)`-' \_/http://ilanpillemer.com
Re: Example paper - Solution needed October 01, 2007 12:22PM |
Registered: 18 years ago Posts: 13 Rating: 0 |
Re: Example paper - Solution needed October 01, 2007 01:31PM |
Registered: 18 years ago Posts: 1,682 Rating: 0 |
//Program to illustrate the perceptron training rule #include <iostream> #include <cstdlib> #include <ctime> #include <cmath> using namespace std; int main() { float w [4]; //array to hold perceptron weights float t, o; const double eta = 1; int i; int count = 0; bool correct = 0; //define and initialize training data int train [4] [4] = { 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1 }; int x0, x1, x2, x3; //will hold the inputs float weightsum, deltaw1, deltaw2, deltaw3; //initialize random number generator srand((unsigned)(time(0))); rand(); //set bias x0 = 1; //w[0] = fabs((float)(rand())/(32767/2)-1); w[0] = -1; for ( i = 1; i < 4; ++i) // w = (float)(rand())/(32767/2) - 1; w = 0; cout << "INITIAL WEIGHTS" << endl << "---------------" << endl; cout << "w0 = " << w[0] << endl; cout << "w1 = " << w[1] << endl; cout << "w2 = " << w[2] << endl; cout << "w3 = " << w[3] << endl; //implement perceptron training rule as long as training examples are //classified incorrectly while(!correct) { correct = 1; count++; for (i = 0; i < 4; ++i) { x1 = train[0]; //input for x1 x2 = train[1]; //input for x2 x3 = train[2]; //find weighted sum of inputs and threshold values weightsum = x0 * w[0] + x1 * w[1] + x2 * w[2] + x3 * w[3]; //determine output of perceptron if (weightsum > 0) o = 1; else o = 0; cout << "training set no " << i + 1; cout << " o = " << o; //determine true ouput t = train[3]; cout << " d = " << t << endl; //if the ouput is incorrect adjust the weights. if (o != t) { deltaw1 = eta * (t - o) * x1; w[1] = w[1] + deltaw1; deltaw2 = eta * (t - o) * x2; w[2] = w[2] + deltaw2; deltaw3 = eta * (t - o) * x3; w[3] = w[3] + deltaw3; correct = 0; cout << endl << endl; cout << "NEW WEIGHTS" << endl << "-------------" << endl; cout << "w0 = " << w[0] << endl; cout << "w1 = " << w[1] << endl; cout << "w2 = " << w[2] << endl; cout << "w3 = " << w[3] << endl; } } } //OUTPUT cout << endl << endl; cout << "FINAL WEIGHTS" << endl << "-------------" << endl; cout << "w0 = " << w[0] << endl; cout << "w1 = " << w[1] << endl; cout << "w2 = " << w[2] << endl; cout << "w3 = " << w[3] << endl; cout << "The delta rules were invoked " << count << " times"<<endl; return 0; }
INITIAL WEIGHTS --------------- w0 = -1 w1 = 0 w2 = 0 w3 = 0 training set no 1 o = 0 d = 0 training set no 2 o = 0 d = 1 NEW WEIGHTS ------------- w0 = -1 w1 = 1 w2 = 0 w3 = 0 training set no 3 o = 0 d = 0 training set no 4 o = 0 d = 1 NEW WEIGHTS ------------- w0 = -1 w1 = 2 w2 = 1 w3 = 1 training set no 1 o = 0 d = 0 training set no 2 o = 1 d = 1 training set no 3 o = 0 d = 0 training set no 4 o = 1 d = 1 FINAL WEIGHTS ------------- w0 = -1 w1 = 2 w2 = 1 w3 = 1 The delta rules were invoked 2 times
,= ,-_-. =. ((_/)o o(\_)) `-'(. .)`-' \_/http://ilanpillemer.com
Re: Example paper - Solution needed October 01, 2007 07:32PM |
Registered: 17 years ago Posts: 26 Rating: 0 |
Anonymous User
Re: Example paper - Solution needed October 01, 2007 08:39PM |
Rating: 0 |
Re: Example paper - Solution needed October 01, 2007 10:21PM |
Registered: 18 years ago Posts: 3,015 Rating: 5 |
Re: Example paper - Solution needed October 02, 2007 02:27AM |
Registered: 17 years ago Posts: 26 Rating: 0 |
Re: Example paper - Solution needed October 02, 2007 05:35AM |
Registered: 18 years ago Posts: 13 Rating: 0 |
Re: Example paper - Solution needed October 02, 2007 08:36AM |
Registered: 18 years ago Posts: 1,682 Rating: 0 |
,= ,-_-. =. ((_/)o o(\_)) `-'(. .)`-' \_/http://ilanpillemer.com
Re: Example paper - Solution needed October 02, 2007 08:47AM |
Registered: 18 years ago Posts: 13 Rating: 0 |
Re: Example paper - Solution needed October 02, 2007 09:23AM |
Registered: 18 years ago Posts: 1,682 Rating: 0 |
,= ,-_-. =. ((_/)o o(\_)) `-'(. .)`-' \_/http://ilanpillemer.com
Re: Example paper - Solution needed October 02, 2007 11:15AM |
Registered: 18 years ago Posts: 69 Rating: 0 |