math.functions: add logit function and a test.
sigmoid is known as expit in scipywindows-drag
parent
d70148e365
commit
3f0ff53369
|
@ -268,6 +268,7 @@ CONSTANT: log10-factorial-1000 0x1.40f3593ed6f8ep11
|
|||
{ t } [ 3 15 roots [ 15 ^ 3 .01 ~ ] all? ] unit-test
|
||||
|
||||
{ .5 } [ 0 sigmoid ] unit-test
|
||||
{ t } [ 0 [ sigmoid logit ] keep .000001 ~ ] unit-test
|
||||
|
||||
{ 1 } [ 12 signum ] unit-test
|
||||
{ -1 } [ -5.0 signum ] unit-test
|
||||
|
|
|
@ -434,8 +434,12 @@ M: float round-to-odd [ (round-to-odd?) ] (float-round) ;
|
|||
[ recip 2pi * 0 swap complex boa e^ ]
|
||||
[ <iota> [ ^ * ] 2with map ] tri ;
|
||||
|
||||
! expit
|
||||
: sigmoid ( x -- y ) neg e^ 1 + recip ; inline
|
||||
|
||||
: logit ( x -- y ) [ ] [ 1 swap - ] bi /f log ; inline
|
||||
|
||||
|
||||
GENERIC: signum ( x -- y )
|
||||
|
||||
M: real signum sgn ;
|
||||
|
|
Loading…
Reference in New Issue