numpy.random.Generator.logistic

方法

random.Generator.logistic(loc=0.0, scale=1.0, size=None)

从物流配送中抽取样本。

从具有指定参数、loc(位置或平均值,也包括中位数)和scale(>0)的逻辑分布中提取样本。

参数
loc浮点数或类似浮点数的数组,可选

分布的参数。默认值为0。

scale浮点数或类似浮点数的数组,可选

分布的参数。必须为非负。默认值为1。

sizeint或int的元组,可选

输出形状。如果给定的形状是,例如, (m, n, k) 然后 m * n * k 取样。如果尺寸是 None (默认),如果 locscale 都是标量。否则, np.broadcast(loc, scale).size 取样。

返回
outndarray或scalar

从参数化物流分布中提取样本。

参见

scipy.stats.logistic

概率密度函数、分布或累积密度函数等。

笔记

逻辑分布的概率密度是

System Message: WARNING/2 (p(x)=p(x)=\frac e^-(x-\mu)/s s(1+e^-(x-\mu)/s)^2,)

latex exited with error [stdout] This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2018-12-01> (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2018/09/03 v1.4i Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/share/texlive/texmf-dist/tex/latex/anyfontsize/anyfontsize.sty) (/usr/share/texlive/texmf-dist/tex/latex/tools/bm.sty) (./math.aux) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd) ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Missing { inserted. <to be read again> } l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character , (U+FF0C) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Missing } inserted. <inserted text> } l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Missing { inserted. <to be read again> } l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Package inputenc Error: Unicode character , (U+FF0C) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} ! Missing } inserted. <inserted text> } l.14 ... s(1+e^-(x-\mu)/s)^2,\end{split} [1] (./math.aux) ) (see the transcript file for additional information) Output written on math.dvi (1 page, 520 bytes). Transcript written on math.log.

在哪里? \mu =位置和 s =比例尺。

在极端值问题中,逻辑分布可以作为Gumbel分布的混合,在流行病学中,以及由国际象棋联合会(FID)使用,在ELO排名系统中,假设每个玩家的表现是一个逻辑分布的随机变量。

工具书类

1

Reiss,R.-D.和Thomas M.(2001),“保险、金融、水文和其他领域的极值统计分析”,Birkhauser Verlag,巴塞尔,第132-133页。

2

物流配送〉,选自MathWorld——Wolfram网络资源。http://mathworld.wolfram.com/logisticdistribution.html

3

维基百科,“物流配送”,https://en.wikipedia.org/wiki/logistic_distribution

实例

从分发中抽取样本:

>>> loc, scale = 10, 1
>>> s = np.random.default_rng().logistic(loc, scale, 10000)
>>> import matplotlib.pyplot as plt
>>> count, bins, ignored = plt.hist(s, bins=50)

#按分布绘制

>>> def logist(x, loc, scale):
...     return np.exp((loc-x)/scale)/(scale*(1+np.exp((loc-x)/scale))**2)
>>> lgst_val = logist(bins, loc, scale)
>>> plt.plot(bins, lgst_val * count.max() / lgst_val.max())
>>> plt.show()
../../../_images/numpy-random-Generator-logistic-1.png