Over the centuries and throughout my travels I’ve come to rely on my compass and a good map to point me in the right direction for my next adventure.
Sometimes my adventure led me to treasures in mysteriously exotic & remote locations, while other times I found myself among friendly and awfully generous cannibals who wanted to invite me to dinner… of course, it’s always best to politely decline such invitations because if anything I certainly live by the rule:
“If I’m on the carte du jour as flambé, I’ll skip the buffet and run away because I’m no entrée!”
Hmmm, come to think of it, that might be the best piece advice I’ve ever given on this blog and if you agree consider supporting me through Patreon! 😉
In any case, despite the occasional fears I’ve held over the last few millennia over potentially becoming someones late-night heartburn, I’ve kinda always known that no matter how bad things got while exploring, I’d be okay because beyond a good compass and a fragmented (then taped back together) map with a sweet X scrawled in blood somewhere on it… I possess a secret tool that all the great explorers down through the ages have relied upon and today, I’m going to share it with you!
But… before I do, here’s today’s wallpaper!
From Allan Quatermain to Amerigo Vespucci, Erik the Red to Captain Nemo and even Jill of the Jungle… all notable explorers have relied on an enchanted automaton totem called “Pathfinder Stones”.
The stones are first consecrated with the live blood of a dead turnip and when brought into close proximity of their owner and a target on a map, will glow to show a path from where you are to where your desired destination is.
The cool/interesting thing about FANN.js is that it uses asm.js to make the compiled FANN library available inside a web browser.
What this means is that a working version of Pathfinder is now online for you to play with (link blow) however…
There are two fairly large downsides to deploying with FANN.js instead of PHP-FANN: You cannot save the ANN after training. You cannot load a previously trained ANN. These limitations mean that Pathfinder must be trained once every time the page loads and this does limit the size and complexity of ANN’s that are deployable using FANN.js. The thing is it may still be possible to save the ANN by using the supported FANN lib methods/functions like I did when I built the FANN-Neural-Network-Visualizer to manually query the ANN object and then format/export the necessary information as a string/plain text because the FANN ANN.net save file format seemingly isn’t all that different from an .INI file (though I am uncertain if this is universal in all language implementations of FANN) and it’s something I plan on playing around with in the future.
Far be it for me to be the barer of fake news… turns out… it actually helps to read the documentation thoroughly and not just skim it and then do a search for keywords! 😛
FANN.js actually DOES have a save function but it doesn’t follow the FANN Lib reference manual of “save_…” convention and instead implements a JS Object.export().
I understand why they did that… and it does kinda make sense in the mixed up JS world but… it still holds to my “anti-wheel” digression argument that you haven’t read about yet.
Having said that… I promise to ritually self-flagellate by Gothic torch light using the sharp side of a motherboard!
I really should have done a better job of reading the docs!
Why use FANN.js over PHP-FANN
Far be it for me to ever sing the praises of JS over PHP however in order to deply a neural network using PHP you have to have a server and the ability to compile & install PHP extensions and that costs money whereas GitHub Pages is free to me and to you but it doesn’t support the more robust server architecture that PHP requires so using FANN.js allows me to deploy my bots and AI in a way that let’s you actually use them instead of just reading about them.
All things being equal, I would still recommend the PHP version of FANN however the JS version does work and with a little improvement could become a viable deployment option!
So, in the future I intend to see if I can’t use FANN.js + WebGL shaders to make FANN training faster (no promises) and then hopefully export the ANN.net file so that we can use/deploy the GPU trained ANN in a PHP environment.
Play Stump the Neural Network
So the online version of the Pathfinder network learns/re-trains from scratch every time the page loads and as such it can’t spend unlimited amounts of time training which is normally not a concern because even if your 1000 layer celebrity deep fake porn ANN takes 100 CPU years to train (i.e. 1 CPU = 100 years, 100 CPU = 1 year etc… ) it isn’t a major concern because likely you are buying your compute from Jeff Bezos or Bill Gates and they have plenty of underutilized computers laying around waiting for you to rent a few FLOPS.
This is easier understood if I just show you.
Given this input
Note that diagonal steps are valid so this path is technically valid but the path is far less efficient than the straight line between the two points that a human would draw/walk.
Reload the page (not required unless you are playing with this idea) and try again…
A different Path was found.
Neither was optimal but a path was found and more cells than necessary were visited.
Here’s some additional examples:
Pathfinder ANN Output
I believe that’s called the sidestep slide!
Pathfinder ANN Output
I mean… it’s not the path I would have chosen but it made it! 😛
If you’d like to try your hand at stumping my Pathfinder you can checkout the live demo here:
Pathfinder Online: geekgirljoy.github.io/Pathfinder_Neural_Network/
You can download all the code (for free) here:
Pathfinder Code on GitHub: https://github.com/geekgirljoy/Pathfinder_Neural_Network
And with that, have a great week everyone.
If you like my coding projects, art, bizarre opinions and writing style… consider supporting me through Patreon.
But if all you can do is Like, Share, Comment and Subscribe… well that’s cool too!