Skip to content

Instantly share code, notes, and snippets.

View joe-bro-1's full-sized avatar
🤖
Coding...

joseph b. joe-bro-1

🤖
Coding...
View GitHub Profile
//
// Created for MyWeather
// by Stewart Lynch on 2024-02-24
//
// Follow me on Mastodon: @[email protected]
// Follow me on Threads: @StewartLynch (https://www.threads.net)
// Follow me on X: https://x.com/StewartLynch
// Follow me on LinkedIn: https://linkedin.com/in/StewartLynch
// Subscribe on YouTube: https://youTube.com/@StewartLynch
// Buy me a ko-fi: https://ko-fi.com/StewartLynch
@cyphunk
cyphunk / softmax.js
Last active June 4, 2024 18:19 — forked from vladimir-ivanov/softmax.js
softmax function implementation in js
// Fork & examples for the one-line version by @vladimir-ivanov:
//let softmax = (arr) => (index) => Math.exp(arr[index]) / arr.map(y => Math.exp(y)).reduce((a, b) => a + b);
//
// Also see comments for improvements
function softmax(arr) {
return arr.map(function(value,index) {
return Math.exp(value) / arr.map( function(y /*value*/){ return Math.exp(y) } ).reduce( function(a,b){ return a+b })
})
}