This is my first attempt at a neural network, is this even close to a single input output perceptron?
Code:#include <iostream.h> #include <stdlib.h> #include <time.h> float floatrandom(float lowerbound, float upperbound) { return ((float)rand() / RAND_MAX) * (upperbound - lowerbound) + lowerbound; } int main() { int threshold = 0; srand ( time(NULL) ); float weight = floatrandom( 0, 10 ); int input; double activation = 0; double change = 0; while (1) { cin >> input; // acquire input activation = weight * input; // to fire or not to fire if ( activation >= threshold ) { cout << "FIRE!!" << endl; change = input * ( 5 - activation ); weight = change + weight; } else if ( activation <= threshold ) { cout << "HOLD YOUR FIRE!!" << endl; change = input * ( 5 - activation ); weight = change + weight; } } return 0; }