Math E and function Sigmoid()

Math E and function Sigmoid()

Postby Antonio Linares » Fri Jun 30, 2017 5:03 pm

https://www.lemoda.net/c/maths-constants/

Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   MsgInfo( Math_E() )

return nil

#pragma BEGINDUMP

#include <hbapi.h>
#include <math.h>

HB_FUNC( MATH_E )
{
   hb_retnd( M_E );
}

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 35263
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Math E and function Sigmoid()

Postby Antonio Linares » Sat Jul 01, 2017 4:43 am

function Sigmoid( nValue )

return 1 / ( 1 + Math_E() ^ ( -nValue / 1 ) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 35263
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Math E and function Sigmoid()

Postby Antonio Linares » Sat Jul 01, 2017 4:59 am

Sigmoid demo:

sigmoid.prg
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local n

   for n = 1 to 20
      MsgInfo( Sigmoid( If( n % 2 == 0, -1, 1 ) * nRandom() / nRandom() ) )
   next  
 
return nil

function Sigmoid( nValue )

return 1 / ( 1 + Math_E() ^ ( -nValue / 1 ) )

#pragma BEGINDUMP

#include <hbapi.h>
#include <math.h>

HB_FUNC( MATH_E )
{
   hb_retnd( M_E );
}

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 35263
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Math E and function Sigmoid()

Postby Antonio Linares » Sat Jul 01, 2017 5:03 am

https://en.wikipedia.org/wiki/Sigmoid_function

A wide variety of sigmoid functions have been used as the activation function of artificial neurons


Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 35263
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Math E and function Sigmoid()

Postby Enrico Maria Giordano » Sat Jul 01, 2017 7:47 am

Antonio Linares wrote:function Sigmoid( nValue )

return 1 / ( 1 + Math_E() ^ ( -nValue / 1 ) )


Simplified:

Code: Select all  Expand view
return 1 / ( 1 + Math_E()  ^ -nValue )


EMG
User avatar
Enrico Maria Giordano
 
Posts: 6658
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Math E and function Sigmoid()

Postby Antonio Linares » Sat Jul 01, 2017 7:57 am

thanks :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 35263
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to Utilities / Utilidades

Who is online

Users browsing this forum: No registered users and 1 guest