@@ -552,7 +552,7 @@ cdef class RandomGenerator:
552
552
array([[[ True, True],
553
553
[ True, True]],
554
554
[[ True, True],
555
- [ True, True]]], dtype=bool )
555
+ [ True, True]]])
556
556
557
557
"""
558
558
cdef np .npy_intp n
@@ -959,7 +959,7 @@ cdef class RandomGenerator:
959
959
probability density function:
960
960
961
961
>>> import matplotlib.pyplot as plt
962
- >>> count, bins, ignored = plt.hist(s, 15, normed =True)
962
+ >>> count, bins, ignored = plt.hist(s, 15, density =True)
963
963
>>> plt.plot(bins, np.ones_like(bins), linewidth=2, color='r')
964
964
>>> plt.show()
965
965
"""
@@ -1059,7 +1059,7 @@ cdef class RandomGenerator:
1059
1059
argument is provided.
1060
1060
1061
1061
This is a convenience function. If you want an interface that takes a
1062
- tuple as the first argument, use `numpy.random. standard_normal` instead.
1062
+ tuple as the first argument, use `standard_normal` instead.
1063
1063
1064
1064
Parameters
1065
1065
----------
@@ -1080,7 +1080,7 @@ cdef class RandomGenerator:
1080
1080
1081
1081
See Also
1082
1082
--------
1083
- random. standard_normal : Similar, but takes a tuple as its argument.
1083
+ standard_normal : Similar, but takes a tuple as its argument.
1084
1084
1085
1085
Notes
1086
1086
-----
@@ -1141,7 +1141,7 @@ cdef class RandomGenerator:
1141
1141
1142
1142
See Also
1143
1143
--------
1144
- random. randint : Similar to `random_integers`, only for the half-open
1144
+ randint : Similar to `random_integers`, only for the half-open
1145
1145
interval [`low`, `high`), and 0 is the lowest value if `high` is
1146
1146
omitted.
1147
1147
@@ -1179,7 +1179,7 @@ cdef class RandomGenerator:
1179
1179
Display results as a histogram:
1180
1180
1181
1181
>>> import matplotlib.pyplot as plt
1182
- >>> count, bins, ignored = plt.hist(dsums, 11, normed =True)
1182
+ >>> count, bins, ignored = plt.hist(dsums, 11, density =True)
1183
1183
>>> plt.show()
1184
1184
1185
1185
"""
@@ -1329,7 +1329,7 @@ cdef class RandomGenerator:
1329
1329
the probability density function:
1330
1330
1331
1331
>>> import matplotlib.pyplot as plt
1332
- >>> count, bins, ignored = plt.hist(s, 30, normed =True)
1332
+ >>> count, bins, ignored = plt.hist(s, 30, density =True)
1333
1333
>>> plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) *
1334
1334
... np.exp( - (bins - mu)**2 / (2 * sigma**2) ),
1335
1335
... linewidth=2, color='r')
@@ -1573,7 +1573,7 @@ cdef class RandomGenerator:
1573
1573
1574
1574
>>> import matplotlib.pyplot as plt
1575
1575
>>> import scipy.special as sps
1576
- >>> count, bins, ignored = plt.hist(s, 50, normed =True)
1576
+ >>> count, bins, ignored = plt.hist(s, 50, density =True)
1577
1577
>>> y = bins**(shape-1) * ((np.exp(-bins/scale))/ \\
1578
1578
... (sps.gamma(shape) * scale**shape))
1579
1579
>>> plt.plot(bins, y, linewidth=2, color='r')
@@ -1660,7 +1660,7 @@ cdef class RandomGenerator:
1660
1660
1661
1661
>>> import matplotlib.pyplot as plt
1662
1662
>>> import scipy.special as sps
1663
- >>> count, bins, ignored = plt.hist(s, 50, normed =True)
1663
+ >>> count, bins, ignored = plt.hist(s, 50, density =True)
1664
1664
>>> y = bins**(shape-1)*(np.exp(-bins/scale) /
1665
1665
... (sps.gamma(shape)*scale**shape))
1666
1666
>>> plt.plot(bins, y, linewidth=2, color='r')
@@ -1819,9 +1819,9 @@ cdef class RandomGenerator:
1819
1819
>>> dfden = 20 # within groups degrees of freedom
1820
1820
>>> nonc = 3.0
1821
1821
>>> nc_vals = randomgen.noncentral_f(dfnum, dfden, nonc, 1000000)
1822
- >>> NF = np.histogram(nc_vals, bins=50, normed =True)
1822
+ >>> NF = np.histogram(nc_vals, bins=50, density =True)
1823
1823
>>> c_vals = randomgen.f(dfnum, dfden, 1000000)
1824
- >>> F = np.histogram(c_vals, bins=50, normed =True)
1824
+ >>> F = np.histogram(c_vals, bins=50, density =True)
1825
1825
>>> plt.plot(F[1][1:], F[0])
1826
1826
>>> plt.plot(NF[1][1:], NF[0])
1827
1827
>>> plt.show()
@@ -1957,17 +1957,17 @@ cdef class RandomGenerator:
1957
1957
1958
1958
>>> import matplotlib.pyplot as plt
1959
1959
>>> values = plt.hist(randomgen.noncentral_chisquare(3, 20, 100000),
1960
- ... bins=200, normed =True)
1960
+ ... bins=200, density =True)
1961
1961
>>> plt.show()
1962
1962
1963
1963
Draw values from a noncentral chisquare with very small noncentrality,
1964
1964
and compare to a chisquare.
1965
1965
1966
1966
>>> plt.figure()
1967
1967
>>> values = plt.hist(randomgen.noncentral_chisquare(3, .0000001, 100000),
1968
- ... bins=np.arange(0., 25, .1), normed =True)
1968
+ ... bins=np.arange(0., 25, .1), density =True)
1969
1969
>>> values2 = plt.hist(randomgen.chisquare(3, 100000),
1970
- ... bins=np.arange(0., 25, .1), normed =True)
1970
+ ... bins=np.arange(0., 25, .1), density =True)
1971
1971
>>> plt.plot(values[1][0:-1], values[0]-values2[0], 'ob')
1972
1972
>>> plt.show()
1973
1973
@@ -1976,7 +1976,7 @@ cdef class RandomGenerator:
1976
1976
1977
1977
>>> plt.figure()
1978
1978
>>> values = plt.hist(randomgen.noncentral_chisquare(3, 20, 100000),
1979
- ... bins=200, normed =True)
1979
+ ... bins=200, density =True)
1980
1980
>>> plt.show()
1981
1981
1982
1982
"""
@@ -2125,7 +2125,7 @@ cdef class RandomGenerator:
2125
2125
2126
2126
>>> t = (np.mean(intake)-7725)/(intake.std(ddof=1)/np.sqrt(len(intake)))
2127
2127
>>> import matplotlib.pyplot as plt
2128
- >>> h = plt.hist(s, bins=100, normed =True)
2128
+ >>> h = plt.hist(s, bins=100, density =True)
2129
2129
2130
2130
For a one-sided t-test, how far out in the distribution does the t
2131
2131
statistic appear?
@@ -2214,7 +2214,7 @@ cdef class RandomGenerator:
2214
2214
2215
2215
>>> import matplotlib.pyplot as plt
2216
2216
>>> from scipy.special import i0
2217
- >>> plt.hist(s, 50, normed =True)
2217
+ >>> plt.hist(s, 50, density =True)
2218
2218
>>> x = np.linspace(-np.pi, np.pi, num=51)
2219
2219
>>> y = np.exp(kappa*np.cos(x-mu))/(2*np.pi*i0(kappa))
2220
2220
>>> plt.plot(x, y, linewidth=2, color='r')
@@ -2313,7 +2313,7 @@ cdef class RandomGenerator:
2313
2313
density function:
2314
2314
2315
2315
>>> import matplotlib.pyplot as plt
2316
- >>> count, bins, _ = plt.hist(s, 100, normed =True)
2316
+ >>> count, bins, _ = plt.hist(s, 100, density =True)
2317
2317
>>> fit = a*m**a / bins**(a+1)
2318
2318
>>> plt.plot(bins, max(count)*fit/max(fit), linewidth=2, color='r')
2319
2319
>>> plt.show()
@@ -2502,17 +2502,17 @@ cdef class RandomGenerator:
2502
2502
>>> powpdf = stats.powerlaw.pdf(xx,5)
2503
2503
2504
2504
>>> plt.figure()
2505
- >>> plt.hist(rvs, bins=50, normed =True)
2505
+ >>> plt.hist(rvs, bins=50, density =True)
2506
2506
>>> plt.plot(xx,powpdf,'r-')
2507
2507
>>> plt.title('randomgen.power(5)')
2508
2508
2509
2509
>>> plt.figure()
2510
- >>> plt.hist(1./(1.+rvsp), bins=50, normed =True)
2510
+ >>> plt.hist(1./(1.+rvsp), bins=50, density =True)
2511
2511
>>> plt.plot(xx,powpdf,'r-')
2512
2512
>>> plt.title('inverse of 1 + randomgen.pareto(5)')
2513
2513
2514
2514
>>> plt.figure()
2515
- >>> plt.hist(1./(1.+rvsp), bins=50, normed =True)
2515
+ >>> plt.hist(1./(1.+rvsp), bins=50, density =True)
2516
2516
>>> plt.plot(xx,powpdf,'r-')
2517
2517
>>> plt.title('inverse of stats.pareto(5)')
2518
2518
@@ -2589,7 +2589,7 @@ cdef class RandomGenerator:
2589
2589
the probability density function:
2590
2590
2591
2591
>>> import matplotlib.pyplot as plt
2592
- >>> count, bins, ignored = plt.hist(s, 30, normed =True)
2592
+ >>> count, bins, ignored = plt.hist(s, 30, density =True)
2593
2593
>>> x = np.arange(-8., 8., .01)
2594
2594
>>> pdf = np.exp(-abs(x-loc)/scale)/(2.*scale)
2595
2595
>>> plt.plot(x, pdf)
@@ -2691,7 +2691,7 @@ cdef class RandomGenerator:
2691
2691
the probability density function:
2692
2692
2693
2693
>>> import matplotlib.pyplot as plt
2694
- >>> count, bins, ignored = plt.hist(s, 30, normed =True)
2694
+ >>> count, bins, ignored = plt.hist(s, 30, density =True)
2695
2695
>>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta)
2696
2696
... * np.exp( -np.exp( -(bins - mu) /beta) ),
2697
2697
... linewidth=2, color='r')
@@ -2706,7 +2706,7 @@ cdef class RandomGenerator:
2706
2706
... a = randomgen.normal(mu, beta, 1000)
2707
2707
... means.append(a.mean())
2708
2708
... maxima.append(a.max())
2709
- >>> count, bins, ignored = plt.hist(maxima, 30, normed =True)
2709
+ >>> count, bins, ignored = plt.hist(maxima, 30, density =True)
2710
2710
>>> beta = np.std(maxima) * np.sqrt(6) / np.pi
2711
2711
>>> mu = np.mean(maxima) - 0.57721*beta
2712
2712
>>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta)
@@ -2873,7 +2873,7 @@ cdef class RandomGenerator:
2873
2873
the probability density function:
2874
2874
2875
2875
>>> import matplotlib.pyplot as plt
2876
- >>> count, bins, ignored = plt.hist(s, 100, normed =True, align='mid')
2876
+ >>> count, bins, ignored = plt.hist(s, 100, density =True, align='mid')
2877
2877
2878
2878
>>> x = np.linspace(min(bins), max(bins), 10000)
2879
2879
>>> pdf = (np.exp(-(np.log(x) - mu)**2 / (2 * sigma**2))
@@ -2895,7 +2895,7 @@ cdef class RandomGenerator:
2895
2895
... b.append(np.product(a))
2896
2896
2897
2897
>>> b = np.array(b) / np.min(b) # scale values to be positive
2898
- >>> count, bins, ignored = plt.hist(b, 100, normed =True, align='mid')
2898
+ >>> count, bins, ignored = plt.hist(b, 100, density =True, align='mid')
2899
2899
>>> sigma = np.std(np.log(b))
2900
2900
>>> mu = np.mean(np.log(b))
2901
2901
@@ -2958,7 +2958,7 @@ cdef class RandomGenerator:
2958
2958
--------
2959
2959
Draw values from the distribution and plot the histogram
2960
2960
2961
- >>> values = hist(randomgen.rayleigh(3, 100000), bins=200, normed =True)
2961
+ >>> values = hist(randomgen.rayleigh(3, 100000), bins=200, density =True)
2962
2962
2963
2963
Wave heights tend to follow a Rayleigh distribution. If the mean wave
2964
2964
height is 1 meter, what fraction of waves are likely to be larger than 3
@@ -3038,7 +3038,7 @@ cdef class RandomGenerator:
3038
3038
Draw values from the distribution and plot the histogram:
3039
3039
3040
3040
>>> import matplotlib.pyplot as plt
3041
- >>> h = plt.hist(randomgen.wald(3, 2, 100000), bins=200, normed =True)
3041
+ >>> h = plt.hist(randomgen.wald(3, 2, 100000), bins=200, density =True)
3042
3042
>>> plt.show()
3043
3043
3044
3044
"""
@@ -3106,7 +3106,7 @@ cdef class RandomGenerator:
3106
3106
3107
3107
>>> import matplotlib.pyplot as plt
3108
3108
>>> h = plt.hist(randomgen.triangular(-3, 0, 8, 100000), bins=200,
3109
- ... normed =True)
3109
+ ... density =True)
3110
3110
>>> plt.show()
3111
3111
3112
3112
"""
@@ -3297,7 +3297,7 @@ cdef class RandomGenerator:
3297
3297
Draw samples from a negative binomial distribution.
3298
3298
3299
3299
Samples are drawn from a negative binomial distribution with specified
3300
- parameters, `n` trials and `p` probability of success where `n` is an
3300
+ parameters, `n` trials and `p` probability of failure where `n` is an
3301
3301
integer > 0 and `p` is in the interval [0, 1].
3302
3302
3303
3303
Parameters
@@ -3317,20 +3317,19 @@ cdef class RandomGenerator:
3317
3317
-------
3318
3318
out : ndarray or scalar
3319
3319
Drawn samples from the parameterized negative binomial distribution,
3320
- where each sample is equal to N, the number of trials it took to
3321
- achieve n - 1 successes, N - (n - 1) failures, and a success on the,
3322
- (N + n)th trial.
3320
+ where each sample is equal to N, the number of successes that
3321
+ occurred before n failures, and a failure on the (N + n)th trial.
3323
3322
3324
3323
Notes
3325
3324
-----
3326
3325
The probability density for the negative binomial distribution is
3327
3326
3328
- .. math:: P(N;n,p) = \\ binom{N+n-1}{n-1 }p^{n}(1-p)^{N},
3327
+ .. math:: P(N;n,p) = \\ binom{N+n-1}{N }p^{n}(1-p)^{N},
3329
3328
3330
- where :math:`n-1 ` is the number of successes, :math:`p` is the
3331
- probability of success , and :math:`N+n-1 ` is the number of trials.
3332
- The negative binomial distribution gives the probability of n-1
3333
- successes and N failures in N+n-1 trials, and success on the (N+n)th
3329
+ where :math:`n` is the number of successes, :math:`p` is the
3330
+ probability of failure , and :math:`N+n` is the number of trials.
3331
+ The negative binomial distribution gives the probability of n
3332
+ successes and N failures in N+n trials, and a success on the (N+n)th
3334
3333
trial.
3335
3334
3336
3335
If one throws a die repeatedly until the third time a "1" appears,
@@ -3355,7 +3354,7 @@ cdef class RandomGenerator:
3355
3354
for each successive well, that is what is the probability of a
3356
3355
single success after drilling 5 wells, after 6 wells, etc.?
3357
3356
3358
- >>> s = randomgen. negative_binomial(1, 0.1 , 100000)
3357
+ >>> s = np.random. negative_binomial(1, 0.9 , 100000)
3359
3358
>>> for i in range(1, 11):
3360
3359
... probability = sum(s<i) / 100000.
3361
3360
... print i, "wells drilled, probability of one success =", probability
@@ -3424,7 +3423,7 @@ cdef class RandomGenerator:
3424
3423
Display histogram of the sample:
3425
3424
3426
3425
>>> import matplotlib.pyplot as plt
3427
- >>> count, bins, ignored = plt.hist(s, 14, normed =True)
3426
+ >>> count, bins, ignored = plt.hist(s, 14, density =True)
3428
3427
>>> plt.show()
3429
3428
3430
3429
Draw each 100 values for lambda 100 and 500:
@@ -3504,7 +3503,7 @@ cdef class RandomGenerator:
3504
3503
3505
3504
Truncate s values at 50 so plot is interesting:
3506
3505
3507
- >>> count, bins, ignored = plt.hist(s[s<50], 50, normed =True)
3506
+ >>> count, bins, ignored = plt.hist(s[s<50], 50, density =True)
3508
3507
>>> x = np.arange(1., 50.)
3509
3508
>>> y = x**(-a) / special.zetac(a)
3510
3509
>>> plt.plot(x, y/max(y), linewidth=2, color='r')
@@ -3906,7 +3905,7 @@ cdef class RandomGenerator:
3906
3905
#
3907
3906
# Also check that cov is positive-semidefinite. If so, the u.T and v
3908
3907
# matrices should be equal up to roundoff error if cov is
3909
- # symmetrical and the singular value of the corresponding row is
3908
+ # symmetric and the singular value of the corresponding row is
3910
3909
# not zero. We continue to use the SVD rather than Cholesky in
3911
3910
# order to preserve current outputs. Note that symmetry has not
3912
3911
# been checked.
0 commit comments