function softMax()

Post Reply
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

function softMax()

Post by Antonio Linares »

function softMax() returns an array of probabilities from an array of numeric values

https://deepai.org/machine-learning-glo ... tmax-layer

https://github.com/ujhuyz0110/notes/blo ... adient.pdf

Code: Select all

function Main()

   local aValues := { 8, 5, 1 } 
   local aResults := softMax( aValues )
   local nVal

   for each nVal in aResults
      ? nVal
   next

return nil

function softMax( aValues )

   local nSum := 0, nVal, aResults := Array( Len( aValues ) )

   for each nVal in aValues
      nSum += exp( nVal )
   next

   for each nVal in aValues
      aResults[ nVal:__enumIndex ] = exp( nVal ) / nSum
   next

return aResults
Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply