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]] | ||
− | |||
− | = 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 | + | 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 | ||
− | + | == 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 === | ||
− | = | + | 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> | ||
− | + | === Relation to Tanh === | |
− | :<code>[[Sigmoid]]( [[ | + | [[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> | ||
− | = | + | ==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]] | + | == See Also == |
− | * [[LogisticRegression]] | + | * [[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]
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:
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).
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.
Enable comment auto-refresher