Share your repls and programming experiences

← Back to all posts
Perceptron Neural Network in BASIC
h
AnnaMcGuiness (0)

I was bored so I decided to try to create a perceptron neural network in the BASIC programming language.

For those who do not know, a perceptron is a basic (no pun intended) type of Binary Classifier NN which determines whether or not an the inputted information is from a certain class of objects. In the case of this NN, the two different classes are "Contains a '1'" and "Does not contain a '1.'"

While determining whether or not a set of two numbers has a 1 can easily be done with a simple "If/Else" statement, this program does so without ever directly checking if there is a "1" in the set, as it instead compares the inputted set to other "training" sets which have been provided in order to try to decide which class the set belongs to. Furthermore, this type of NN is quite a bit easier to create with the limited tool set available in such a deprecated language as BASIC than many other more complicated algorithms.

To use the program, enter 1 number, either 1 or 0 and press enter. Then, enter another number, either 1 or 0, and press enter again. The program will then return what it believes is the correct class.