Ai Dreams Forum

Member's Experiments & Projects => AI Programming => Topic started by: Dee on February 20, 2020, 03:39:37 am

Title: A single neuron in Bash script
Post by: Dee on February 20, 2020, 03:39:37 am

I created this single neuron in Bash, lots of fun with this ML in Bash; so funny.  :2funny:


Bash doesn't do floating-point calculation so I needed help from Perl, the rest is Bash script.


It is super slow, Perl function calls are in Lisp style and each math op is done with creating a new Perl process.


Colab link: https://colab.research.google.com/drive/1KRjliLlp_zccfzcyFjFE2qWezRKWsOgo
Title: Re: A single neuron in Bash script
Post by: infurl on February 20, 2020, 04:05:23 am
Haha it sounds like you have too much time on your hands. :D

The usual method of performing calculations on the command line "expr" doesn't support floating point, that's true, but you could probably get better performance if you used "dc" instead, unless you really don't like reverse polish notation.
Code
dc -e '2 k 12.34 34.12 + p'
46.46
Title: Re: A single neuron in Bash script
Post by: Dee on February 20, 2020, 05:35:48 am
Haha it sounds like you have too much time on your hands. :D

The usual method of performing calculations on the command line "expr" doesn't support floating point, that's true, but you could probably get better performance if you used "dc" instead, unless you really don't like reverse polish notation.
Code
dc -e '2 k 12.34 34.12 + p'
46.46
yeah, that dc is faster, tks.


infix, postfix, prefix are all ok :)