Difference between revisions of "Sigmoid"

m
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:Math Functions]]
 
[[Category:Math Functions]]
 +
[[Category:Functions that operate on complex numbers]]
  
''New to [[Analytica 4.5]]''
 
  
= Sigmoid(x) =
+
== Sigmoid(x) ==
  
 
The [[Sigmoid]] function is  
 
The [[Sigmoid]] function is  
 
:<math>Sigmoid(x) = {1\over{1+\exp(-x)}}</math>
 
:<math>Sigmoid(x) = {1\over{1+\exp(-x)}}</math>
  
[[image:SigmoidGraph.png]]
+
:[[image:SigmoidGraph.png]]
  
The [[Sigmoid]] function goes by several other names including the ''logistic function'', the ''inverse logit function'', and the ''expit'' function.
+
The [[Sigmoid]] function goes by several other names including the ''logistic function'', the ''inverse logit function'', and the ''expit'' function.
  
There are other functions that are also ''sigmoidal'' in shape, most notably the [[ArcTan]] and [[Tanh]] functions. These other sigmoidal fucntions differ in their asymptotic values.  The [[Sigmoid]](x) function goes to 0 as x goes to <math>-\infty</math> and to 1 as x goes to <math>+\infty</math>.
+
There are other functions that are also ''sigmoidal'' in shape, most notably the [[ArcTan]] and [[Tanh]] functions. These other sigmoidal fucntions differ in their asymptotic values.  The [[Sigmoid]](x) function goes to 0 as «x» goes to <math>-\infty</math> and to 1 as «x» goes to <math>+\infty</math>.
  
The inverse of the [[Sigmoid]] function is the [[Logit]] function.
+
The inverse of the [[Sigmoid]] function is the [[Logit]] function (aka log-odds function). Hence, [[Sigmoid]] returns the probability value that corresponds to a given log-odds.
  
= Library =
+
== Library ==
 +
Advanced Math Functions
  
Advanced Math Functions
+
== Uses ==
 +
Since the [[Logit]] function is the ''link function'' in generalized linear regression that results in [[LogisticRegression|logistic regression]], the [[Sigmoid]] function is used to apply the coefficients of [[LogisticRegression|logistic regression]] to make predictions.  So if ''c'' are the coefficients returned by the [[LogisticRegression]] function, where ''c'' is a vector indexed by «K», and ''x'' is a new data point (also indexed by «K»), then the predicted probability for ''x'' is computed using:
 +
:<code>Sigmoid(Sum(c*x, K))</code>
 +
 
 +
== Notes ==
 +
=== dSigmoid ===
  
= Uses =
+
You can use the following [[User-Defined Function]] to compute the derivative of the [[Sigmoid]] function:
 +
:Function dSigmoid(x) := <code>0.25 / [[Cosh]](90*x/[[Pi]])^2</code>
  
Since the [[Logit]] function is the ''link function'' in generalized linear regression that results in [[LogisticRegression|logistic regression]], the [[Sigmoid]] function is used to apply the coefficients of [[LogisticRegression|logistic regression]] to make predictions. So if ''c'' are the coefficients returned by the [[LogisticRegression]] function, where ''c'' is a vector indexed by ''K'', and x is a new data point (also indexed by ''K''), then the predicted probability for ''x'' is computed using:
+
=== Relation to Tanh ===
:<code>[[Sigmoid]]( [[Sum]]( c*x, K ) )</code>
+
[[Sigmoid]]() varies from 0 to 1. A related function is [[Tanh]](), which goes from -1 to 1, but is on a different x-axis scale. The following equivalence holds (recall that in Analytica, the [[Tanh]]() function expects its parameter to be in degrees).
 +
::<code>2*[[Sigmoid]](x)-1 = [[Tanh]](x*90/[[Pi]])</code>
  
= See Also =
+
==History==
 +
[[Sigmoid]] was introduced as a built-in in [[Analytica 4.5]], superseding the earlier [[InvLogit]] function that was part of the add-on [[media:Generalized Regression.ana|Generalized Regression library]].
  
* [[Logit]](x)
+
== See Also ==
* [[LogisticRegression]](x)
+
* [[Logit]]
 +
* [[LogisticRegression]]
 +
* [[Regression]]
 +
* [[Tanh]], [[Degrees]]

Latest revision as of 19:40, 8 March 2023


Sigmoid(x)

The Sigmoid function is

[math]\displaystyle{ Sigmoid(x) = {1\over{1+\exp(-x)}} }[/math]
SigmoidGraph.png

The Sigmoid function goes by several other names including the logistic function, the inverse logit function, and the expit function.

There are other functions that are also sigmoidal in shape, most notably the ArcTan and Tanh functions. These other sigmoidal fucntions differ in their asymptotic values. The Sigmoid(x) function goes to 0 as «x» goes to [math]\displaystyle{ -\infty }[/math] and to 1 as «x» goes to [math]\displaystyle{ +\infty }[/math].

The inverse of the Sigmoid function is the Logit function (aka log-odds function). Hence, Sigmoid returns the probability value that corresponds to a given log-odds.

Library

Advanced Math Functions

Uses

Since the Logit function is the link function in generalized linear regression that results in logistic regression, the Sigmoid function is used to apply the coefficients of logistic regression to make predictions. So if c are the coefficients returned by the LogisticRegression function, where c is a vector indexed by «K», and x is a new data point (also indexed by «K»), then the predicted probability for x is computed using:

Sigmoid(Sum(c*x, K))

Notes

dSigmoid

You can use the following User-Defined Function to compute the derivative of the Sigmoid function:

Function dSigmoid(x) := 0.25 / Cosh(90*x/Pi)^2

Relation to Tanh

Sigmoid() varies from 0 to 1. A related function is Tanh(), which goes from -1 to 1, but is on a different x-axis scale. The following equivalence holds (recall that in Analytica, the Tanh() function expects its parameter to be in degrees).

2*Sigmoid(x)-1 = Tanh(x*90/Pi)

History

Sigmoid was introduced as a built-in in Analytica 4.5, superseding the earlier InvLogit function that was part of the add-on Generalized Regression library.

See Also

Comments


You are not allowed to post comments.