4 ms·
Show HN: Single neuron neural network written in COBOL
- atum47 6y agoHi everyone, I made this a while ago just for fun. Perceptron was one of the first algorithms I wrote back in college when I was taking machine learning classes. So I thought how cool would be to write something fairly modern (not really) like a neural network using old tech like cobol. Hope you like it.
- ryan_j_naughton 6y agoInterestingly, perceptrons and Cobol are almost the same age. "The perceptron algorithm was invented in 1958"[1] "COBOL was designed in 1959 by CODASYL and was partly based on the programming language FLOW-MATIC designed by Grace Hopper."[2] [1] https://en.wikipedia.org/wiki/Perceptron https://en.wikipedia.org/wiki/Perceptron [2] https://en.wikipedia.org/wiki/COBOL https://en.wikipedia.org/wiki/COBOL
- atum47 6y agoyeah, when I was writing the comment I remember my teacher telling us that neural networks were invented a long time ago and now (2017 when I took the class) they were coming back. that's why I wrote (not really)
- im3w1l 6y agoWhen classifying it's often a good idea to feed the prediction into a sigmoid-function. I have never seen cobol code before, only heard about it so thanks for posting some. What do rows like "01 ERR PIC S99V9999." mean?
- atum47 6y agoERR is the name of my variable "error" S indicates that this value is signed 99 is two digits V is a decimal separator and the other 9999 are 4 decimal places http://www.csis.ul.ie/cobol/course/DataDeclaration.htm http://www.csis.ul.ie/cobol/course/DataDeclaration.htm
- jecel 6y agoAnd the 01 at the start of the line is the level number as explained in the link. It is how Cobol declared nested records, which Fortran and Algol lacked but became popular through PL/I, Pascal and C.
- bbunix 6y agoI think 01 line number ERR what you think it means PIC S99V9999 is like a printf format for the number field
- __palo_alto__ 6y agoI think the perceptron algorithm does not include a sigmoid, just a stepwise activation. https://en.wikipedia.org/wiki/Perceptron https://en.wikipedia.org/wiki/Perceptron
- pjmlp 6y agoCobol can be actually quite modern. https://www.microfocus.com/en-us/products/visual-cobol/features https://www.microfocus.com/en-us/products/visual-cobol/featu...
- canjobear 6y agoThis is really cool! It's great to see a simple but nontrivial program to get a feel for how a language like this works. Reading through and knowing no COBOL, it looks like this is logistic regression on four input features.
- klipt 6y agoSo COBOL has no array concept, you have to name every input feature FEAT1, FEAT2 etc? Ouch. I can see why the language is dying out.
- rovr138 6y agoThere are "tables" in COBOL. My COBOL is rusty, but I know that it can be done. This is cool nonetheless.
- atum47 6y agothank you, glad you liked it
- atum47 6y agoyeah, please don't take this code like is good COBOL code, haha, I learned it just for this experiment.
- klyrs 6y agoI was taken with how readable it is, personally. I'd say "like python but next level" but I know at least that much history.
- forgotpwd16 6y agoWhat resources you used to learn?
- atum47 6y agojust Google
- zengid 6y agoThere are arrays, or tables, which I like to think of as being what an array of structs would be in C: https://www.mainframestechhelp.com/tutorials/cobol/cobol-array.htm https://www.mainframestechhelp.com/tutorials/cobol/cobol-arr... Also, cobol will probably never completely die. No enterprise is going to pay to rewrite systems that have been their backbone for decades. (Disclosure: I work in Logistics industry, and we have a lot of cobol that isn't going anywhere.)