]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/doc/html/math_toolkit/dist_ref/dists/logistic_dist.html
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / math / doc / html / math_toolkit / dist_ref / dists / logistic_dist.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Logistic Distribution</title>
5 <link rel="stylesheet" href="../../../math.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
7 <link rel="home" href="../../../index.html" title="Math Toolkit 2.5.1">
8 <link rel="up" href="../dists.html" title="Distributions">
9 <link rel="prev" href="laplace_dist.html" title="Laplace Distribution">
10 <link rel="next" href="lognormal_dist.html" title="Log Normal Distribution">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="laplace_dist.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../dists.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="lognormal_dist.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h4 class="title">
27 <a name="math_toolkit.dist_ref.dists.logistic_dist"></a><a class="link" href="logistic_dist.html" title="Logistic Distribution">Logistic
28 Distribution</a>
29 </h4></div></div></div>
30 <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">distributions</span><span class="special">/</span><span class="identifier">logistic</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></pre>
31 <pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">math</span><span class="special">{</span>
32
33 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">RealType</span> <span class="special">=</span> <span class="keyword">double</span><span class="special">,</span>
34 <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a> <span class="special">=</span> <a class="link" href="../../pol_ref/pol_ref_ref.html" title="Policy Class Reference">policies::policy&lt;&gt;</a> <span class="special">&gt;</span>
35 <span class="keyword">class</span> <span class="identifier">logistic_distribution</span><span class="special">;</span>
36
37 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">RealType</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Policy</span><span class="special">&gt;</span>
38 <span class="keyword">class</span> <span class="identifier">logistic_distribution</span>
39 <span class="special">{</span>
40 <span class="keyword">public</span><span class="special">:</span>
41 <span class="keyword">typedef</span> <span class="identifier">RealType</span> <span class="identifier">value_type</span><span class="special">;</span>
42 <span class="keyword">typedef</span> <span class="identifier">Policy</span> <span class="identifier">policy_type</span><span class="special">;</span>
43 <span class="comment">// Construct:</span>
44 <span class="identifier">logistic_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">location</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">scale</span> <span class="special">=</span> <span class="number">1</span><span class="special">);</span>
45 <span class="comment">// Accessors:</span>
46 <span class="identifier">RealType</span> <span class="identifier">location</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> <span class="comment">// location.</span>
47 <span class="identifier">RealType</span> <span class="identifier">scale</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> <span class="comment">// scale.</span>
48
49 <span class="special">};</span>
50
51 <span class="keyword">typedef</span> <span class="identifier">logistic_distribution</span><span class="special">&lt;&gt;</span> <span class="identifier">logistic</span><span class="special">;</span>
52
53 <span class="special">}}</span> <span class="comment">// namespaces</span>
54 </pre>
55 <p>
56 The logistic distribution is a continous probability distribution. It has
57 two parameters - location and scale. The cumulative distribution function
58 of the logistic distribution appears in logistic regression and feedforward
59 neural networks. Among other applications, United State Chess Federation
60 and FIDE use it to calculate chess ratings.
61 </p>
62 <p>
63 The following graph shows how the distribution changes as the parameters
64 change:
65 </p>
66 <p>
67 <span class="inlinemediaobject"><img src="../../../../graphs/logistic_pdf.svg" align="middle"></span>
68 </p>
69 <h5>
70 <a name="math_toolkit.dist_ref.dists.logistic_dist.h0"></a>
71 <span class="phrase"><a name="math_toolkit.dist_ref.dists.logistic_dist.member_functions"></a></span><a class="link" href="logistic_dist.html#math_toolkit.dist_ref.dists.logistic_dist.member_functions">Member
72 Functions</a>
73 </h5>
74 <pre class="programlisting"><span class="identifier">logistic_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">u</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">s</span> <span class="special">=</span> <span class="number">1</span><span class="special">);</span>
75 </pre>
76 <p>
77 Constructs a logistic distribution with location <span class="emphasis"><em>u</em></span>
78 and scale <span class="emphasis"><em>s</em></span>.
79 </p>
80 <p>
81 Requires <code class="computeroutput"><span class="identifier">scale</span> <span class="special">&gt;</span>
82 <span class="number">0</span></code>, otherwise a <a class="link" href="../../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
83 is raised.
84 </p>
85 <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">location</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
86 </pre>
87 <p>
88 Returns the location of this distribution.
89 </p>
90 <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">scale</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
91 </pre>
92 <p>
93 Returns the scale of this distribution.
94 </p>
95 <h5>
96 <a name="math_toolkit.dist_ref.dists.logistic_dist.h1"></a>
97 <span class="phrase"><a name="math_toolkit.dist_ref.dists.logistic_dist.non_member_accessors"></a></span><a class="link" href="logistic_dist.html#math_toolkit.dist_ref.dists.logistic_dist.non_member_accessors">Non-member
98 Accessors</a>
99 </h5>
100 <p>
101 All the <a class="link" href="../nmp.html" title="Non-Member Properties">usual non-member accessor
102 functions</a> that are generic to all distributions are supported:
103 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution Function</a>,
104 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function</a>,
105 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.quantile">Quantile</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.hazard">Hazard Function</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.chf">Cumulative Hazard Function</a>,
106 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.mean">mean</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.median">median</a>,
107 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.mode">mode</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.variance">variance</a>,
108 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation</a>,
109 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.skewness">skewness</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.kurtosis">kurtosis</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.kurtosis_excess">kurtosis_excess</a>,
110 <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.range">range</a> and <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.support">support</a>.
111 </p>
112 <p>
113 The domain of the random variable is [-[max_value], +[min_value]]. However,
114 the pdf and cdf support inputs of +&#8734; and -&#8734;
115 as special cases if RealType permits.
116 </p>
117 <p>
118 At <code class="computeroutput"><span class="identifier">p</span><span class="special">=</span><span class="number">1</span></code> and <code class="computeroutput"><span class="identifier">p</span><span class="special">=</span><span class="number">0</span></code>, the quantile
119 function returns the result of +<a class="link" href="../../error_handling.html#math_toolkit.error_handling.overflow_error">overflow_error</a>
120 and -<a class="link" href="../../error_handling.html#math_toolkit.error_handling.overflow_error">overflow_error</a>,
121 while the complement quantile function returns the result of -<a class="link" href="../../error_handling.html#math_toolkit.error_handling.overflow_error">overflow_error</a>
122 and +<a class="link" href="../../error_handling.html#math_toolkit.error_handling.overflow_error">overflow_error</a>
123 respectively.
124 </p>
125 <h5>
126 <a name="math_toolkit.dist_ref.dists.logistic_dist.h2"></a>
127 <span class="phrase"><a name="math_toolkit.dist_ref.dists.logistic_dist.accuracy"></a></span><a class="link" href="logistic_dist.html#math_toolkit.dist_ref.dists.logistic_dist.accuracy">Accuracy</a>
128 </h5>
129 <p>
130 The logistic distribution is implemented in terms of the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">exp</span></code> and the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">log</span></code>
131 functions, so its accuracy is related to the accurate implementations of
132 those functions on a given platform. When calculating the quantile with
133 a non-zero <span class="emphasis"><em>position</em></span> parameter catastrophic cancellation
134 errors can occur: in such cases, only a low <span class="emphasis"><em>absolute error</em></span>
135 can be guaranteed.
136 </p>
137 <h5>
138 <a name="math_toolkit.dist_ref.dists.logistic_dist.h3"></a>
139 <span class="phrase"><a name="math_toolkit.dist_ref.dists.logistic_dist.implementation"></a></span><a class="link" href="logistic_dist.html#math_toolkit.dist_ref.dists.logistic_dist.implementation">Implementation</a>
140 </h5>
141 <div class="informaltable"><table class="table">
142 <colgroup>
143 <col>
144 <col>
145 </colgroup>
146 <thead><tr>
147 <th>
148 <p>
149 Function
150 </p>
151 </th>
152 <th>
153 <p>
154 Implementation Notes
155 </p>
156 </th>
157 </tr></thead>
158 <tbody>
159 <tr>
160 <td>
161 <p>
162 pdf
163 </p>
164 </td>
165 <td>
166 <p>
167 Using the relation: pdf = e<sup>-(x-u)/s</sup> / (s*(1+e<sup>-(x-u)/s</sup>)<sup>2</sup>)
168 </p>
169 </td>
170 </tr>
171 <tr>
172 <td>
173 <p>
174 cdf
175 </p>
176 </td>
177 <td>
178 <p>
179 Using the relation: p = 1/(1+e<sup>-(x-u)/s</sup>)
180 </p>
181 </td>
182 </tr>
183 <tr>
184 <td>
185 <p>
186 cdf complement
187 </p>
188 </td>
189 <td>
190 <p>
191 Using the relation: q = 1/(1+e<sup>(x-u)/s</sup>)
192 </p>
193 </td>
194 </tr>
195 <tr>
196 <td>
197 <p>
198 quantile
199 </p>
200 </td>
201 <td>
202 <p>
203 Using the relation: x = u - s*log(1/p-1)
204 </p>
205 </td>
206 </tr>
207 <tr>
208 <td>
209 <p>
210 quantile from the complement
211 </p>
212 </td>
213 <td>
214 <p>
215 Using the relation: x = u + s*log(p/1-p)
216 </p>
217 </td>
218 </tr>
219 <tr>
220 <td>
221 <p>
222 mean
223 </p>
224 </td>
225 <td>
226 <p>
227 u
228 </p>
229 </td>
230 </tr>
231 <tr>
232 <td>
233 <p>
234 mode
235 </p>
236 </td>
237 <td>
238 <p>
239 The same as the mean.
240 </p>
241 </td>
242 </tr>
243 <tr>
244 <td>
245 <p>
246 skewness
247 </p>
248 </td>
249 <td>
250 <p>
251 0
252 </p>
253 </td>
254 </tr>
255 <tr>
256 <td>
257 <p>
258 kurtosis excess
259 </p>
260 </td>
261 <td>
262 <p>
263 6/5
264 </p>
265 </td>
266 </tr>
267 <tr>
268 <td>
269 <p>
270 variance
271 </p>
272 </td>
273 <td>
274 <p>
275 (&#960;*s)<sup>2</sup> / 3
276 </p>
277 </td>
278 </tr>
279 </tbody>
280 </table></div>
281 </div>
282 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
283 <td align="left"></td>
284 <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
285 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
286 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
287 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
288 Distributed under the Boost Software License, Version 1.0. (See accompanying
289 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
290 </p>
291 </div></td>
292 </tr></table>
293 <hr>
294 <div class="spirit-nav">
295 <a accesskey="p" href="laplace_dist.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../dists.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="lognormal_dist.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
296 </div>
297 </body>
298 </html>