I'm trying to create a simple network with perceptions and it doesn't seem to be working. I was wondering if someone could correct my mistakes. Thanks!
#include<iostream>
#include<cstdlib>
using namespace std;
int pWeights[] = {0,0};
int Classify(int pInput, int pThreshold, int i, int Bias){
int classOut;
if( pInput*pWeights[i] + Bias >= pThreshold ){
classOut = 1;
}else if(pInput*pWeights[i] + Bias < pThreshold){
classOut = -1;
}
return classOut;
}
int main()
{
int Bias = 1;
int i;
int dOutput[] = {1,0};
int pInputs[] = {1,2};
int pClass1 = Classify(pInputs[0],0,0,Bias);
int pClass2 = Classify(pInputs[1],0,1,Bias);
do
{
if(pClass1 != dOutput[0]){
pWeights[0] = pWeights[0] + ((dOutput[0] - pClass1) * pInputs[0]);
pWeights[1] = pWeights[1] + ((dOutput[1] - pClass2) * pInputs[1]);
}else if(pClass2 != dOutput[1]){
pWeights[0] = pWeights[0] + ((dOutput[0] - pClass1) * pInputs[0]);
pWeights[1] = pWeights[1] + ((dOutput[1] - pClass2) * pInputs[1]);
}
cout << pWeights[0] << endl;
cout << pWeights[1] << endl;
}while(pClass1 != dOutput[0] || pClass2 != dOutput[1]);
system("PAUSE");
return 0;
}