OwlCyberSecurity - MANAGER
Edit File: statistics.cpython-311.opt-1.pyc
� �����/�gY������������������������v����U�d�Z�g�d�ZddlZddlZddlZddlZddlmZ�ddlm Z �ddl mZmZ�ddl mZmZ�ddlmZmZmZmZmZmZmZmZ�dd lmZ�dd lmZ�ddlmZmZmZ��ed������������Z �G�d ��de!������������Z"d��Z#d?d�Z$d��Z%d��Z&d��Z'd��Z(d@d�Z)de*de*de*fd�Z+dej,��������j-��������z��dz���Z.e*e/d<���de*de*de0fd�Z1de*de*de fd�Z2d ��Z3d?d!�Z4d"��Z5d?d#�Z6d$��Z7d%��Z8d&��Z9dAd(�Z:d)��Z;d*��Z<d+d,d-�d.�Z=d?d/�Z>d?d0�Z?d?d1�Z@d?d2�ZAd3��ZBd4��ZCd5��ZD�ed6d7������������ZEd8d9�d:�ZFd;��ZG �dd<lHmGZG�n#�eI$�r�Y�nw�xY�w�G�d=��d>������������ZJdS�)Ba� �� Basic statistics module. This module provides functions for calculating statistics of data, including averages, variance, and standard deviation. Calculating averages -------------------- ================== ================================================== Function Description ================== ================================================== mean Arithmetic mean (average) of data. fmean Fast, floating point arithmetic mean. geometric_mean Geometric mean of data. harmonic_mean Harmonic mean of data. median Median (middle value) of data. median_low Low median of data. median_high High median of data. median_grouped Median, or 50th percentile, of grouped data. mode Mode (most common value) of data. multimode List of modes (most common values of data). quantiles Divide data into intervals with equal probability. ================== ================================================== Calculate the arithmetic mean ("the average") of data: >>> mean([-1.0, 2.5, 3.25, 5.75]) 2.625 Calculate the standard median of discrete data: >>> median([2, 3, 4, 5]) 3.5 Calculate the median, or 50th percentile, of data grouped into class intervals centred on the data values provided. E.g. if your data points are rounded to the nearest whole number: >>> median_grouped([2, 2, 3, 3, 3, 4]) #doctest: +ELLIPSIS 2.8333333333... This should be interpreted in this way: you have two data points in the class interval 1.5-2.5, three data points in the class interval 2.5-3.5, and one in the class interval 3.5-4.5. The median of these data points is 2.8333... Calculating variability or spread --------------------------------- ================== ============================================= Function Description ================== ============================================= pvariance Population variance of data. variance Sample variance of data. pstdev Population standard deviation of data. stdev Sample standard deviation of data. ================== ============================================= Calculate the standard deviation of sample data: >>> stdev([2.5, 3.25, 5.5, 11.25, 11.75]) #doctest: +ELLIPSIS 4.38961843444... If you have previously calculated the mean, you can pass it as the optional second argument to the four "spread" functions to avoid recalculating it: >>> data = [1, 2, 2, 4, 4, 4, 5, 6] >>> mu = mean(data) >>> pvariance(data, mu) 2.5 Statistics for relations between two inputs ------------------------------------------- ================== ==================================================== Function Description ================== ==================================================== covariance Sample covariance for two variables. correlation Pearson's correlation coefficient for two variables. linear_regression Intercept and slope for simple linear regression. ================== ==================================================== Calculate covariance, Pearson's correlation, and simple linear regression for two inputs: >>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9] >>> y = [1, 2, 3, 1, 2, 3, 1, 2, 3] >>> covariance(x, y) 0.75 >>> correlation(x, y) #doctest: +ELLIPSIS 0.31622776601... >>> linear_regression(x, y) #doctest: LinearRegression(slope=0.1, intercept=1.5) Exceptions ---------- A single exception is defined: StatisticsError is a subclass of ValueError. )� NormalDist�StatisticsError�correlation� covariance�fmean�geometric_mean� harmonic_mean�linear_regression�mean�median�median_grouped�median_high� median_low�mode� multimode�pstdev� pvariance� quantiles�stdev�variance�����N��Fraction)�Decimal)�groupby�repeat)�bisect_left�bisect_right)�hypot�sqrt�fabs�exp�erf�tau�log�fsum)�reduce)�mul)�Counter� namedtuple�defaultdict��������@c�������������������������e�Zd�ZdS�)r���N)�__name__� __module__�__qualname__��������1/opt/alt/python311/lib64/python3.11/statistics.pyr���r�������s���������������Dr1���r���c����������������������d}t������������������������}|j��������}i�}|j��������}t����������|�t����������������������D�]B\��}}�||�������������t����������t����������|������������D�]\��}} |dz ��}�|| d������������|z���|| <�����Cd|v�r |d���������} n+t����������d��|�����������������������������������D���������������������������} t����������t����������|t����������������������}|| |fS�)a���_sum(data) -> (type, sum, count) Return a high-precision sum of the given numeric data as a fraction, together with the type to be converted to and the count of items. Examples -------- >>> _sum([3, 2.25, 4.5, -0.5, 0.25]) (<class 'float'>, Fraction(19, 2), 5) Some sources of round-off error will be avoided: # Built-in sum returns zero. >>> _sum([1e50, 1, -1e50] * 1000) (<class 'float'>, Fraction(1000, 1), 3000) Fractions and Decimals are also supported: >>> from fractions import Fraction as F >>> _sum([F(2, 3), F(7, 5), F(1, 4), F(5, 6)]) (<class 'fractions.Fraction'>, Fraction(63, 20), 4) >>> from decimal import Decimal as D >>> data = [D("0.1375"), D("0.2108"), D("0.3061"), D("0.0419")] >>> _sum(data) (<class 'decimal.Decimal'>, Fraction(6963, 10000), 4) Mixed types are currently treated as an error, except that int is allowed. r�������Nc��������������3����<���K����|�]\��}}t����������||������������V����d�S��Nr�����.0�d�ns��� r2���� <genexpr>z_sum.<locals>.<genexpr>����s.����������@�@�t�q�!�H�Q��N�N�@�@�@�@�@�@r1���)�set�add�getr����type�map�_exact_ratio�sum�itemsr&����_coerce�int)�data�count�types� types_add�partials�partials_get�typ�valuesr:���r9����total�Ts��� r2����_sumrP�������s�������@� �E��E�E�E�� �I��H��<�L��t�T�*�*��1��1���V�� �#������f�-�-�� 1�� 1�D�A�q��Q�J�E�&�,�q�!�,�,�q�0�H�Q�K�K� 1���x�����������@�@�x�~�~�/?�/?�@�@�@�@�@���w��s�#�#�A� �u�e��r1���c���������������������������&t������������fd�|�D���������������������������\��}}}||�|fS�d}t������������������������}|j��������}t����������t����������������������}t����������t����������������������}t����������|�t����������������������D�]S\��} } �|| �������������t����������t����������| ������������D�]-\��}�|dz ��}|�xx���������|z ��cc<���|�xx���������||z��z ��cc<����.�T|st����������d������������x}�nxd|v�r|d���������x}�nit����������d��|�����������������������������������D���������������������������}t����������d��|�����������������������������������D���������������������������} || z��||z��z ��|z��}||z���t����������t����������|t����������������������}||�|fS�)a3��Return the exact mean and sum of square deviations of sequence data. Calculations are done in a single pass, allowing the input to be an iterator. If given *c* is used the mean; otherwise, it is calculated from the data. Use the *c* argument with care, as it can lead to garbage results. Nc��������������3����,����K����|�]}|�z ��x��z��V����d�S�r6���r0���)r8����x�cr9���s��� ��r2���r;���z_ss.<locals>.<genexpr>����s0�����������<�<�!�1�q�5�j�a�A�-�<�<�<�<�<�<r1���r���r4���c��������������3����<���K����|�]\��}}t����������||������������V����d�S�r6���r���r7���s��� r2���r;���z_ss.<locals>.<genexpr>����s.����������@�@�D�A�q��!�Q���@�@�@�@�@�@r1���c��������������3����B���K����|�]\��}}t����������|||z��������������V����d�S�r6���r���r7���s��� r2���r;���z_ss.<locals>.<genexpr>����s4����������D�D�t�q�!�(�1�a��c�"�"�D�D�D�D�D�Dr1���)rP���r<���r=���r*���rE���r���r?���r@���rA���r���rB���rC���r&���rD���)rF���rT���rO����ssdrG���rH���rI����sx_partials�sxx_partialsrL���rM���r:����sx�sxxr9���s��� ` @r2����_ssr\�������s��������� �}��<�<�<�<�<�t�<�<�<�<�<� ��3���3��5�!�!� �E��E�E�E�� �I��c�"�"�K��s�#�#�L��t�T�*�*��%��%���V�� �#������f�-�-�� %�� %�D�A�q��Q�J�E���N�N�N�a��N�N�N���O�O�O�q�1�u�$�O�O�O�O� %���� ��1�+�+���a�a� �� � ���d�#�#��a�a���@�@�K�,=�,=�,?�,?�@�@�@� @� @���D�D�|�/A�/A�/C�/C�D�D�D�D�D����s�{�R�"�W�$��-����J���w��s�#�#�A� �s�A�u��r1���c������������������t����� �|�������������������������������������S�#�t����������$�r�t����������j��������|�������������cY�S�w�xY�wr6���)� is_finite�AttributeError�math�isfinite)rS���s��� r2���� _isfiniterb�������sF������ ��{�{�}�}����� �� �� ��}�Q������ ���s������7�7c�����������������������|�|u�r|�S�|t�����������u�s |t����������u�r|�S�|�t�����������u�r|S�t����������||�������������r|S�t����������|�|������������r|�S�t����������|�t�����������������������r|S�t����������|t�����������������������r|�S�t����������|�t����������������������rt����������|t����������������������r|S�t����������|�t����������������������rt����������|t����������������������r|�S�d}t����������||�j��������|j��������fz���������������)z�Coerce types T and S to a common type, or raise TypeError. Coercion rules are currently an implementation detail. See the CoerceTest test class in test_statistics for details. z"don't know how to coerce %s and %s)rE����bool� issubclassr����float� TypeErrorr-���)rO����S�msgs��� r2���rD���rD������s�������� �A�v�v�q���C�x�x�1��9�9�a�x��C�x�x��(��!�Q���"��(��!�Q���"��(��!�S���$�1�H��!�S���$�1�H��!�X�����:�a��#7�#7������!�U����� �1�h� 7� 7����� .�C� �C�1�:�q�z�2�2� 3� 3�3r1���c����������������������� �|�������������������������������������S�#�t����������$�r�Y�nt����������t����������f$�r�|�dfcY�S�w�xY�w �|�j��������|�j��������fS�#�t����������$�r(�dt ����������|�������������j����������d�}t����������|�������������w�xY�w)z�Return Real number x to exact (numerator, denominator) pair. >>> _exact_ratio(0.25) (1, 4) x is expected to be an int, Fraction, Decimal or float. Nzcan't convert type 'z' to numerator/denominator) �as_integer_ratior_���� OverflowError� ValueError� numerator�denominatorr?���r-���rg���)rS���ri���s��� r2���rA���rA�����s�������<��!�!�#�#�#���� �� �� ����:�&���������4�y�����������Q�]�+�+���������Q�T�!�W�W�%5�Q�Q�Q����n�n�����s������ 9�9�9� A��2A=c����������������������t����������|�������������|u�r|�S�t����������|t����������������������r|�j��������dk����rt����������} ��||�������������S�#�t ����������$�r:�t����������|t����������������������r#�||�j���������������������||�j��������������������z��cY�S���w�xY�w)z&Convert value to given numeric type T.r4���)r?���re���rE���ro���rf���rg���r���rn���)�valuerO���s��� r2����_convertrr���M��s��������E�{�{�a�������!�S�����e�/�1�4�4�����q��x�x�����������a��!�!�� ��1�U�_�%�%���%�*;�(<�(<�<�<�<�<�� ���s���� A��A�B� B�negative valuec��������������#����F���K����|�D�]}|dk�����rt����������|�������������|V����dS�)z7Iterate over values, failing if any are less than zero.r���N)r���)rM����errmsgrS���s��� r2���� _fail_negrv���_��sA���������� �������q�5�5�!�&�)�)�)��������r1���r:����m�returnc������������������N�����t����������j��������|�|z��������������}|||z��|z��|�k����z��S�)zFSquare root of n/m, rounded to the nearest integer using round-to-odd.)r`����isqrt)r:���rw����as��� r2����_integer_sqrt_of_frac_rtor|���g��s.������� � �1��6���A���!��A��� ��r1������������_sqrt_bit_widthc������������������������|�������������������������������������|������������������������������������z ��t����������z ��dz��}|dk����rt����������|�|d|z��z��������������|z��}d}nt����������|�d|z��z��|������������}d|�z��}||z��S�)z1Square root of n/m as a float, correctly rounded.r}���r���r4������)� bit_lengthr���r|���)r:���rw����qrn���ro���s��� r2����_float_sqrt_of_fracr����s��s�������� �����!�,�,�.�.� (�?� :�q�@�A��A�v�v�-�a��a�!�e��<�<��A� ����-�a�2��6�k�1�=�=� ��A�2�g���{�"�"r1���c����������������������|�dk����r|�st����������d������������S�|��|�}}�t����������|�������������t����������|������������z�������������������������������������}|�����������������������������������\��}}|�����������������������������������}|�����������������������������������\��}}d|�z��||z��dz��z��|||z��||z��z���dz��z��k����r|S�|�����������������������������������}|�����������������������������������\��} } d|�z��|| z��dz��z��||| z��| |z��z���dz��z��k�����r|S�|S�)z3Square root of n/m as a Decimal, correctly rounded.r���z0.0����r}���)r���r���rk���� next_plus� next_minus)r:���rw����root�nr�dr�plus�np�dp�minus�nm�dms��� r2����_decimal_sqrt_of_fracr�������s ����� � �A�v�v��� "��5�>�>�!��r�A�2�1���A�J�J�����#�)�)�+�+�D� � "� "� $� $�F�B���>�>���D� � "� "� $� $�F�B���1�u��2���z��A��B���B���� 2�2�2�2����O�O���E� � #� #� %� %�F�B���1�u��2���z��A��B���B���� 2�2�2�2����Kr1���c������������������x�����t����������|�������������\��}}}|dk�����rt����������d�������������t����������||z��|������������S�)a���Return the sample arithmetic mean of data. >>> mean([1, 2, 3, 4, 4]) 2.8 >>> from fractions import Fraction as F >>> mean([F(3, 7), F(1, 21), F(5, 3), F(1, 3)]) Fraction(13, 21) >>> from decimal import Decimal as D >>> mean([D("0.5"), D("0.75"), D("0.625"), D("0.375")]) Decimal('0.5625') If ``data`` is empty, StatisticsError will be raised. r4���z%mean requires at least one data point)rP���r���rr���)rF���rO���rN���r:���s��� r2���r ���r ������sA������ ��t�*�*�K�A�u�a��1�u�u��E�F�F�F��E�A�I�q�!�!�!r1���c������������������������ �t����������|��������������n"#�t����������$�r�d��fd�}�||�������������}�Y�nw�xY�w|�%t����������|�������������}�st����������d�������������|�z��S� �t����������|������������}n.#�t����������$�r!�t ����������|������������}t����������|������������}Y�nw�xY�wt����������t����������t����������|�|������������������������}�|k����rt����������d�������������t����������|������������}|st����������d�������������||z��S�)z�Convert data to floats and compute the arithmetic mean. This runs faster than the mean() function and it always returns a float. If the input dataset is empty, it raises a StatisticsError. >>> fmean([3.5, 4.0, 5.25]) 4.25 r���c��������������3����B����K����t����������|�d�������������D�] \���}|V���� d�S�)Nr4���)�start)� enumerate)�iterablerS���r:���s��� �r2���rG���zfmean.<locals>.count���s<�����������!�(�!�4�4�4�� �� ���1������ �� r1���Nz&fmean requires at least one data pointz(data and weights must be the same lengthzsum of weights must be non-zero)�lenrg���r%���r����listr@���r'���)rF����weightsrG���rN����num_weights�num�denr:���s��� @r2���r���r������s>������ ���I�I����������� �� �� �� �� �� ���u�T�{�{������������T� � ���� L�!�"J�K�K�K��q�y��#��'�l�l������#��#��#��w�-�-���'�l�l����#������s�3��g�&�&� '� '�C��K����H�I�I�I� �w�-�-�C���A��?�@�@�@���9�s������2�2�A-��-(B�Bc����������������������� �t����������t����������t����������t����������|�������������������������������������S�#�t����������$�r�t����������d������������d�w�xY�w)aY��Convert data to floats and compute the geometric mean. Raises a StatisticsError if the input dataset is empty, if it contains a zero, or if it contains a negative value. No special efforts are made to achieve exact results. (However, this may change in the future.) >>> round(geometric_mean([54, 24, 36]), 9) 36.0 zGgeometric mean requires a non-empty dataset containing positive numbersN)r!���r���r@���r$���rm���r���)rF���s��� r2���r���r������s`������G��5��S�$���(�(�)�)�)����G��G��G���<��=��=�BF� G�G���s ����.1��Ac������������������,����t����������|�������������|�u�rt����������|�������������}�d}t����������|�������������}|dk�����rt����������d�������������|dk����rQ|�O|�d���������}t ����������|t ����������j��������t����������f������������r|dk�����rt����������|�������������|S�t����������d�������������|�t����������d|������������}|}nmt����������|������������|u�rt����������|������������}t����������|������������|k����rt����������d�������������t����������d��t����������||������������D���������������������������\��}}} �t����������|�|������������}�t����������d ��t����������||�������������D���������������������������\��}}} n#�t����������$�r�Y�dS�w�xY�w|dk����rt����������d �������������t����������||z��|������������S�)a���Return the harmonic mean of data. The harmonic mean is the reciprocal of the arithmetic mean of the reciprocals of the data. It can be used for averaging ratios or rates, for example speeds. Suppose a car travels 40 km/hr for 5 km and then speeds-up to 60 km/hr for another 5 km. What is the average speed? >>> harmonic_mean([40, 60]) 48.0 Suppose a car travels 40 km/hr for 5 km, and when traffic clears, speeds-up to 60 km/hr for the remaining 30 km of the journey. What is the average speed? >>> harmonic_mean([40, 60], weights=[5, 30]) 56.0 If ``data`` is empty, or any element is less than zero, ``harmonic_mean`` will raise ``StatisticsError``. z.harmonic mean does not support negative valuesr4���z.harmonic_mean requires at least one data pointNr���zunsupported typez*Number of weights does not match data sizec��������������3�������K����|�]}|V����d�S�r6���r0���)r8����ws��� r2���r;���z harmonic_mean.<locals>.<genexpr>��s"���������� G� G�q�� G� G� G� G� G� Gr1���c��������������3����.���K����|�]\��}}|r||z��nd�V����dS�)r���Nr0���)r8���r����rS���s��� r2���r;���z harmonic_mean.<locals>.<genexpr>��s3����������P�P�T�Q���0�q�1�u�u�q�P�P�P�P�P�Pr1���zWeighted sum must be positive)�iterr����r����r���� isinstance�numbers�Realr���rg���r���rP���rv����zip�ZeroDivisionErrorrr���) rF���r����ru���r:���rS����sum_weights�_rO���rN���rG���s ��� r2���r���r������s������.��D�z�z�T����D�z�z�� =�F��D� � �A��1�u�u��N�O�O�O� �a���G�O���G���a�'�,��0�1�1�� 0��1�u�u�%�f�-�-�-��H��.�/�/�/�����A�,�,�������=�=�G�#�#��7�m�m�G��w�<�<�1���!�"N�O�O�O� � G� G�I�g�v�,F�,F� G� G� G�G�G���;�����v�&�&���P�P�S��$�=O�=O�P�P�P�P�P���5�%�%����������q�q�������z�z��=�>�>�>��K�%�'��+�+�+s����!;E�� E+�*E+c������������������������t����������|�������������}�t����������|�������������}|dk����rt����������d�������������|dz��dk����r|�|dz�����������S�|dz��}|�|dz �����������|�|���������z���dz��S�)aB��Return the median (middle value) of numeric data. When the number of data points is odd, return the middle data point. When the number of data points is even, the median is interpolated by taking the average of the two middle values: >>> median([1, 3, 5]) 3 >>> median([1, 3, 5, 7]) 4.0 r����no median for empty datar}���r4�����sortedr����r���)rF���r:����is��� r2���r���r���%��sr��������$�<�<�D��D� � �A��A�v�v��8�9�9�9��1�u��z�z��A��F�|�� ��F���Q��U��d�1�g�%��*�*r1���c�����������������������t����������|�������������}�t����������|�������������}|dk����rt����������d�������������|dz��dk����r|�|dz�����������S�|�|dz��dz �����������S�)a ��Return the low median of numeric data. When the number of data points is odd, the middle value is returned. When it is even, the smaller of the two middle values is returned. >>> median_low([1, 3, 5]) 3 >>> median_low([1, 3, 5, 7]) 3 r���r����r}���r4���r�����rF���r:���s��� r2���r���r���=��s`��������$�<�<�D��D� � �A��A�v�v��8�9�9�9��1�u��z�z��A��F�|���A��F�Q�J��r1���c������������������~�����t����������|�������������}�t����������|�������������}|dk����rt����������d�������������|�|dz�����������S�)a��Return the high median of data. When the number of data points is odd, the middle value is returned. When it is even, the larger of the two middle values is returned. >>> median_high([1, 3, 5]) 3 >>> median_high([1, 3, 5, 7]) 5 r���r����r}���r����r����s��� r2���r ���r ���S��s@��������$�<�<�D��D� � �A��A�v�v��8�9�9�9���Q��<�r1�����������?c������������������t����t����������|�������������}�t����������|�������������}|st����������d�������������|�|dz�����������}t����������|�|������������}t ����������|�||�������������} �t����������|������������}t����������|������������}n#�t����������$�r�t����������d�������������w�xY�w||dz��z ��}|}||z ��}|||dz��|z ��z��|z��z���S�)a���Estimates the median for numeric data binned around the midpoints of consecutive, fixed-width intervals. The *data* can be any iterable of numeric data with each value being exactly the midpoint of a bin. At least one value must be present. The *interval* is width of each bin. For example, demographic information may have been summarized into consecutive ten-year age groups with each group being represented by the 5-year midpoints of the intervals: >>> demographics = Counter({ ... 25: 172, # 20 to 30 years old ... 35: 484, # 30 to 40 years old ... 45: 387, # 40 to 50 years old ... 55: 22, # 50 to 60 years old ... 65: 6, # 60 to 70 years old ... }) The 50th percentile (median) is the 536th person out of the 1071 member cohort. That person is in the 30 to 40 year old age group. The regular median() function would assume that everyone in the tricenarian age group was exactly 35 years old. A more tenable assumption is that the 484 members of that age group are evenly distributed between 30 and 40. For that, we use median_grouped(). >>> data = list(demographics.elements()) >>> median(data) 35 >>> round(median_grouped(data, interval=10), 1) 37.5 The caller is responsible for making sure the data points are separated by exact multiples of *interval*. This is essential for getting a correct result. The function does not check this precondition. Inputs may be any numeric type that can be coerced to a float during the interpolation step. r����r}���)�loz$Value cannot be converted to a floatr+���)r����r����r���r���r���rf���rm���rg���) rF����intervalr:���rS���r�����j�L�cf�fs ��� r2���r���r���f��s�������V��$�<�<�D��D� � �A���:��8�9�9�9�� �Q�!�V��A�� �D�!���A��T�1��#�#�#�A�A���?�?���!�H�H������A��A��A��?�@�@�@�A���� � �H�s�N��A� �B� �A��A��x�1�q�5�2�:�&��*�*�*s����A=��=Bc�����������������������t����������t����������|����������������������������������������������d������������} �|d���������d���������S�#�t����������$�r�t ����������d������������d�w�xY�w)ax��Return the most common data point from discrete or nominal data. ``mode`` assumes discrete data, and returns a single value. This is the standard treatment of the mode as commonly taught in schools: >>> mode([1, 1, 2, 3, 3, 3, 3, 4]) 3 This also works with nominal (non-numeric) data: >>> mode(["red", "blue", "blue", "red", "green", "red", "red"]) 'red' If there are multiple modes with same frequency, return the first one encountered: >>> mode(['red', 'red', 'green', 'blue', 'blue']) 'red' If *data* is empty, ``mode``, raises StatisticsError. r4���r���zno mode for empty dataN)r(���r�����most_common� IndexErrorr���)rF����pairss��� r2���r���r������si������.� �D��J�J���+�+�A�.�.�E�B��Q�x��{�����B��B��B��6�7�7�T�A�B���s ���� ?��Ac�������������������������t����������t����������|�������������������������}|sg�S�t����������|�������������������������������������������������fd�|�����������������������������������D���������������S�)a.��Return a list of the most frequently occurring values. Will return more than one result if there are multiple modes or an empty list if *data* is empty. >>> multimode('aabbbbbbbbcc') ['b'] >>> multimode('aabbbbccddddeeffffgg') ['b', 'd', 'f'] >>> multimode('') [] c������������������&������g�|�] \��}}|�k�����|��S�r0���r0���)r8���rq���rG����maxcounts��� �r2���� <listcomp>zmultimode.<locals>.<listcomp>���s'�������J�J�J�l�e�U���8I�8I�E�8I�8I�8Ir1���)r(���r�����maxrM���rC���)rF����countsr����s��� @r2���r���r������s\���������T�$�Z�Z� � �F����� ��6�=�=�?�?�#�#�H�J�J�J�J�f�l�l�n�n�J�J�J�Jr1���r����� exclusive)r:����methodc���������������������|dk�����rt����������d�������������t����������|�������������}�t����������|�������������}|dk�����rt����������d�������������|dk����rg|dz ��}g�}t����������d|������������D�]M}t ����������||z��|������������\��}}|�|���������||z ��z��|�|dz������������|z��z���|z��} |���������������������| ��������������N|S�|dk����r||dz���}g�}t����������d|������������D�]b}||z��|z��}|dk�����rdn||dz ��k����r|dz ��n|}||z��||z��z ��}|�|dz �����������||z ��z��|�|���������|z��z���|z��} |���������������������| ��������������c|S�t ����������d|���������������)a���Divide *data* into *n* continuous intervals with equal probability. Returns a list of (n - 1) cut points separating the intervals. Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set *n* to 100 for percentiles which gives the 99 cuts points that separate *data* in to 100 equal sized groups. The *data* can be any iterable containing sample. The cut points are linearly interpolated between data points. If *method* is set to *inclusive*, *data* is treated as population data. The minimum value is treated as the 0th percentile and the maximum value is treated as the 100th percentile. r4���zn must be at least 1r}���z"must have at least two data points� inclusiver����zUnknown method: )r���r����r�����range�divmod�appendrm���) rF���r:���r�����ldrw����resultr����r�����delta�interpolateds ��� r2���r���r�����s������ � �1�u�u��4�5�5�5��$�<�<�D� �T���B� �A�v�v��B�C�C�C� ������F�����q�!���� (�� (�A��a�!�e�Q�'�'�H�A�u� ��G�q�5�y�1�D��Q��K�%�4G�G�1�L�L��M�M�,�'�'�'�'�� � ������F�����q�!���� (�� (�A��A��� �A���U�U����B�q�D����1���a�A��a�C�!�A�#�I�E� ��Q��K�1�u�9�5��Q��%��G�1�L�L��M�M�,�'�'�'�'�� � �2��2�2� 3� 3�3r1���c�����������������������t����������|�|������������\��}}}}|dk�����rt����������d�������������t����������||dz ��z��|������������S�)a���Return the sample variance of data. data should be an iterable of Real-valued numbers, with at least two values. The optional argument xbar, if given, should be the mean of the data. If it is missing or None, the mean is automatically calculated. Use this function when your data is a sample from a population. To calculate the variance from the entire population, see ``pvariance``. Examples: >>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5] >>> variance(data) 1.3720238095238095 If you have already calculated the mean of your data, you can pass it as the optional second argument ``xbar`` to avoid recalculating it: >>> m = mean(data) >>> variance(data, m) 1.3720238095238095 This function does not check that ``xbar`` is actually the mean of ``data``. Giving arbitrary values for ``xbar`` may lead to invalid or impossible results. Decimals and Fractions are supported: >>> from decimal import Decimal as D >>> variance([D("27.5"), D("30.25"), D("30.25"), D("34.5"), D("41.75")]) Decimal('31.01875') >>> from fractions import Fraction as F >>> variance([F(1, 6), F(1, 2), F(5, 3)]) Fraction(67, 108) r}���z*variance requires at least two data pointsr4����r\���r���rr���)rF����xbarrO����ssrT���r:���s��� r2���r���r���6��sJ������L��d�D�/�/�K�A�r�1�a��1�u�u��J�K�K�K��B�!�a�%�L�!�$�$�$r1���c������������������|�����t����������|�|������������\��}}}}|dk�����rt����������d�������������t����������||z��|������������S�)a,��Return the population variance of ``data``. data should be a sequence or iterable of Real-valued numbers, with at least one value. The optional argument mu, if given, should be the mean of the data. If it is missing or None, the mean is automatically calculated. Use this function to calculate the variance from the entire population. To estimate the variance from a sample, the ``variance`` function is usually a better choice. Examples: >>> data = [0.0, 0.25, 0.25, 1.25, 1.5, 1.75, 2.75, 3.25] >>> pvariance(data) 1.25 If you have already calculated the mean of the data, you can pass it as the optional second argument to avoid recalculating it: >>> mu = mean(data) >>> pvariance(data, mu) 1.25 Decimals and Fractions are supported: >>> from decimal import Decimal as D >>> pvariance([D("27.5"), D("30.25"), D("30.25"), D("34.5"), D("41.75")]) Decimal('24.815') >>> from fractions import Fraction as F >>> pvariance([F(1, 4), F(5, 4), F(1, 2)]) Fraction(13, 72) r4���z*pvariance requires at least one data pointr����)rF����murO���r����rT���r:���s��� r2���r���r���b��sF������F��d�B�-�-�K�A�r�1�a��1�u�u��J�K�K�K��B��F�A���r1���c�����������������������t����������|�|������������\��}}}}|dk�����rt����������d�������������||dz ��z��}t����������|t����������������������rt ����������|j��������|j��������������������S�t����������|j��������|j��������������������S�)z�Return the square root of the sample variance. See ``variance`` for arguments and other details. >>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75]) 1.0810874155219827 r}����'stdev requires at least two data pointsr4����r\���r���re���r���r����rn���ro���r����)rF���r����rO���r����rT���r:����msss��� r2���r���r������sy��������d�D�/�/�K�A�r�1�a��1�u�u��G�H�H�H� ��A��,�C��!�W����E�$�S�]�C�O�D�D�D��s�}�c�o�>�>�>r1���c������������������������t����������|�|������������\��}}}}|dk�����rt����������d�������������||z��}t����������|t����������������������rt ����������|j��������|j��������������������S�t����������|j��������|j��������������������S�)z�Return the square root of the population variance. See ``pvariance`` for arguments and other details. >>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75]) 0.986893273527251 r4���z'pstdev requires at least one data pointr����)rF���r����rO���r����rT���r:���r����s��� r2���r���r������su��������d�B�-�-�K�A�r�1�a��1�u�u��G�H�H�H� �q�&�C��!�W����E�$�S�]�C�O�D�D�D��s�}�c�o�>�>�>r1���c������������������4����t����������|�������������\��}}}}|dk�����rt����������d�������������||dz ��z��} �t����������|������������t����������|j��������|j��������������������fS�#�t����������$�r1�t����������|������������t����������|������������t����������|������������z��fcY�S�w�xY�w)zFIn one pass, compute the mean and sample standard deviation as floats.r}���r����r4���)r\���r���rf���r����rn���ro���r_���)rF���rO���r����r����r:���r����s��� r2����_mean_stdevr�������s���������Y�Y�N�A�r�4���1�u�u��G�H�H�H� ��A��,�C�4��T�{�{�/�� �s��O�O�O�O����4��4��4��T�{�{�E�$�K�K�%��)�)�3�3�3�3�3�4���s����(A��8B�Bc�����������������>������t����������|�������������}t����������|������������|k����rt����������d�������������|dk�����rt����������d�������������t����������|�������������|z���t����������|������������|z���t������������fd�t����������|�|������������D���������������������������}||dz ��z��S�)ap��Covariance Return the sample covariance of two inputs *x* and *y*. Covariance is a measure of the joint variability of two inputs. >>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9] >>> y = [1, 2, 3, 1, 2, 3, 1, 2, 3] >>> covariance(x, y) 0.75 >>> z = [9, 8, 7, 6, 5, 4, 3, 2, 1] >>> covariance(x, z) -7.5 >>> covariance(z, x) -7.5 zDcovariance requires that both inputs have same number of data pointsr}���z,covariance requires at least two data pointsc��������������3����4����K����|�]\��}}|�z ��|�z ��z��V����d�S�r6���r0����r8����xi�yir�����ybars��� ��r2���r;���zcovariance.<locals>.<genexpr>����4�����������A�A�V�R���T� �b�4�i�(�A�A�A�A�A�Ar1���r4���)r����r���r%���r����)rS����yr:����sxyr����r����s��� @@r2���r���r������s���������"� �A���A� �1�v�v��{�{��d�e�e�e��1�u�u��L�M�M�M���7�7�Q�;�D���7�7�Q�;�D� �A�A�A�A�A�s�1�a�y�y�A�A�A� A� A�C��!�a�%�=�r1���c������������������������t����������|�������������}t����������|������������|k����rt����������d�������������|dk�����rt����������d�������������t����������|�������������|z���t����������|������������|z���t������������fd�t����������|�|������������D���������������������������}t������������fd�|�D���������������������������}t������������fd�|D���������������������������} �|t ����������||z��������������z��S�#�t ����������$�r�t����������d�������������w�xY�w)a��Pearson's correlation coefficient Return the Pearson's correlation coefficient for two inputs. Pearson's correlation coefficient *r* takes values between -1 and +1. It measures the strength and direction of the linear relationship, where +1 means very strong, positive linear relationship, -1 very strong, negative linear relationship, and 0 no linear relationship. >>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9] >>> y = [9, 8, 7, 6, 5, 4, 3, 2, 1] >>> correlation(x, x) 1.0 >>> correlation(x, y) -1.0 zEcorrelation requires that both inputs have same number of data pointsr}���z-correlation requires at least two data pointsc��������������3����4����K����|�]\��}}|�z ��|�z ��z��V����d�S�r6���r0���r����s��� ��r2���r;���zcorrelation.<locals>.<genexpr>���r����r1���c��������������3����,����K����|�]}|�z ��x��z��V����d�S�r6���r0����r8���r����r9���r����s��� ��r2���r;���zcorrelation.<locals>.<genexpr>����0�����������0�0��R�$�Y���!�#�0�0�0�0�0�0r1���c��������������3����,����K����|�]}|�z ��x��z��V����d�S�r6���r0���)r8���r����r9���r����s��� ��r2���r;���zcorrelation.<locals>.<genexpr>���r����r1���z&at least one of the inputs is constant)r����r���r%���r����r���r����) rS���r����r:���r����r[����syyr9���r����r����s ��� @@@r2���r���r������s&��������"� �A���A� �1�v�v��{�{��e�f�f�f��1�u�u��M�N�N�N���7�7�Q�;�D���7�7�Q�;�D� �A�A�A�A�A�s�1�a�y�y�A�A�A� A� A�C� �0�0�0�0�0�a�0�0�0� 0� 0�C� �0�0�0�0�0�a�0�0�0� 0� 0�C�H��T�#��)�_�_�$�$����H��H��H��F�G�G�G�H���s����C&��&D��LinearRegression��slope� interceptF)�proportionalc����������������p���� � ��t����������|�������������}t����������|������������|k����rt����������d�������������|dk�����rt����������d�������������|rAt����������d��t����������|�|������������D���������������������������}t����������d��|�D���������������������������}njt����������|�������������|z��� t����������|������������|z��� t����������� � fd�t����������|�|������������D���������������������������}t������������ fd�|�D���������������������������} �||z��}n#�t����������$�r�t����������d�������������w�xY�w|rd n� |� z��z ��}t����������||� ������������S�)a���Slope and intercept for simple linear regression. Return the slope and intercept of simple linear regression parameters estimated using ordinary least squares. Simple linear regression describes relationship between an independent variable *x* and a dependent variable *y* in terms of a linear function: y = slope * x + intercept + noise where *slope* and *intercept* are the regression parameters that are estimated, and noise represents the variability of the data that was not explained by the linear regression (it is equal to the difference between predicted and actual values of the dependent variable). The parameters are returned as a named tuple. >>> x = [1, 2, 3, 4, 5] >>> noise = NormalDist().samples(5, seed=42) >>> y = [3 * x[i] + 2 + noise[i] for i in range(5)] >>> linear_regression(x, y) #doctest: +ELLIPSIS LinearRegression(slope=3.09078914170..., intercept=1.75684970486...) If *proportional* is true, the independent variable *x* and the dependent variable *y* are assumed to be directly proportional. The data is fit to a line passing through the origin. Since the *intercept* will always be 0.0, the underlying linear function simplifies to: y = slope * x + noise >>> y = [3 * x[i] + noise[i] for i in range(5)] >>> linear_regression(x, y, proportional=True) #doctest: +ELLIPSIS LinearRegression(slope=3.02447542484..., intercept=0.0) zKlinear regression requires that both inputs have same number of data pointsr}���z3linear regression requires at least two data pointsc��������������3����&���K����|�]\��}}||z��V���� d�S�r6���r0���)r8���r����r����s��� r2���r;���z$linear_regression.<locals>.<genexpr>/��s*����������3�3�v�r�2�2��7�3�3�3�3�3�3r1���c��������������3���� ���K����|�] }||z��V���� d�S�r6���r0���)r8���r����s��� r2���r;���z$linear_regression.<locals>.<genexpr>0��s&����������'�'�r�2��7�'�'�'�'�'�'r1���c��������������3����4����K����|�]\��}}|�z ��|�z ��z��V����d�S�r6���r0���r����s��� ��r2���r;���z$linear_regression.<locals>.<genexpr>4��s4�����������E�E���R�B��I�"�t�)�,�E�E�E�E�E�Er1���c��������������3����,����K����|�]}|�z ��x��z��V����d�S�r6���r0���r����s��� ��r2���r;���z$linear_regression.<locals>.<genexpr>5��s0�����������4�4�B��d��N�A�a�'�4�4�4�4�4�4r1���z x is constant���������r����)r����r���r%���r����r����r����)rS���r����r����r:���r����r[���r����r����r9���r����r����s��� @@@r2���r ���r �����sf��������L� �A���A� �1�v�v��{�{��k�l�l�l��1�u�u��S�T�T�T���5��3�3��Q����3�3�3�3�3���'�'�Q�'�'�'�'�'����A�w�w��{���A�w�w��{���E�E�E�E�E�3�q�!�9�9�E�E�E�E�E���4�4�4�4�4�!�4�4�4�4�4��/��c� ������/��/��/��o�.�.�.�/����#�<�������)<�I��%�9�=�=�=�=s����8C>��>Dc����������������������|�dz ��}t����������|������������dk����rpd||z��z ��}d|z��dz���|z��dz���|z��dz���|z��dz���|z��d z���|z��d z���|z��dz���|z��}d|z��d z���|z��dz���|z��dz���|z��dz���|z��dz���|z��dz���|z��dz���}||z��}|||z��z���S�|dk����r|�nd|�z ��}t����������t����������|�������������������������}|dk����r^|dz ��}d|z��dz���|z��dz���|z��dz���|z��dz���|z��dz���|z��dz���|z��dz���}d|z��d z���|z��d!z���|z��d"z���|z��d#z���|z��d$z���|z��d%z���|z��dz���}n]|dz ��}d&|z��d'z���|z��d(z���|z��d)z���|z��d*z���|z��d+z���|z��d,z���|z��d-z���}d.|z��d/z���|z��d0z���|z��d1z���|z��d2z���|z��d3z���|z��d4z���|z��dz���}||z��}|dk�����r|�}|||z��z���S�)5N��������?g333333�?g��Q��?g^�}o)��@g�E.k�R�@g ��Ul�@g*u��>l�@g�N����@g�"]Ξ@gnC���`@gu��@giK��~j�@gv��|E�@g��d�|1�@gfR��r��@g��u.2�@g���~y�@g�n8(E@r����r����g������@g�������?g鬷�ZaI?gg�El�D�?g7\�����?g�uS�S�?g�=�. @gj%b�@g���Hw�@gjR�e�?g�9dh? >g('߿��A?g��~z �?g@�3��?gɅ3��?g3fR�x�?gI�F��l�@g����t��>g*�Y��n�>gESB\T?g�N;A+�?g�UR1��?gE�F���?gP�n��@g&�>���@g����i�<g�@�F�>g�tcI,\�>g�ŝ���I?g*F2�v�?g�C4�?g��O�1�?)r ���r���r$���)�pr�����sigmar�����rr����r����rS���s��� r2����_normal_dist_inv_cdfr����A��s������� �C��A��A�w�w�%����q�1�u���0�1�4�0�1�45�6�0�1�45�6��1�1��56�6��1� 1��56� 6� �1�1� �56�6��1� 1��56� 6��1�1��56�6���1�1�4�0�1�45�6�0�1�45�6��1�1��56�6��1� 1��56� 6� �1�1� �56�6��1� 1��56� 6������ �#�I���Q��Y��� �#�X�X���3��7�A��c�!�f�f�W� � �A��C�x�x� ��G��1�A�5�1�2�56�7�1�2�56�7��2�2��67�7��2� 2��67� 7� �2�2� �67�7��2� 2��67� 7��2�2���2�A�5�1�2�56�7�1�2�56�7��2�2��67�7��2� 2��67� 7� �2�2� �67�7��2� 2��67� 7������� ��G��1�A�5�1�2�56�7�1�2�56�7��2�2��67�7��2� 2��67� 7� �2�2� �67�7��2� 2��67� 7��2�2���3�Q�6�1�2�56�7�1�2�56�7��2�2��67�7��2� 2��67� 7� �2�2� �67�7��2� 2��67� 7������ �c� �A��3�w�w� �B�� ��U���r1���)r����c��������������������*����e�Zd�ZdZddd�Zd$d�Zed����������������Zd d �d�Zd��Z d ��Z d��Zd%d�Zd��Z d��Zed����������������Zed����������������Zed����������������Zed����������������Zed����������������Zd��Zd��Zd��Zd��Zd��Zd��ZeZd��ZeZd��Zd ��Zd!��Z d"��Z!d#��Z"d S�)&r���z(Normal distribution of a random variablez(Arithmetic mean of a normal distributionz+Standard deviation of a normal distribution��_mu�_sigmar����r����c�����������������������|dk�����rt����������d�������������t����������|������������|�_��������t����������|������������|�_��������dS�)zDNormalDist where mu is the mean and sigma is the standard deviation.r����zsigma must be non-negativeN)r���rf���r��r��)�selfr����r����s��� r2����__init__zNormalDist.__init__���s8�������3�;�;�!�">�?�?�?���9�9����E�l�l����r1���c������������������&������|�t����������|��������������S�)z5Make a normal distribution instance from sample data.)r����)�clsrF���s��� r2����from_sampleszNormalDist.from_samples���s��������s�K��%�%�&�&r1���N)�seedc�������������������������|�t�����������j��������nt����������j��������|������������j���������|�j��������|�j��������c�����fd�t����������|������������D���������������S�)z=Generate *n* samples for a given mean and standard deviation.Nc������������������(������g�|�]}������������������S�r0���r0���)r8���r�����gaussr����r����s��� ���r2���r����z&NormalDist.samples.<locals>.<listcomp>���s%�������3�3�3�Q���b�%� � �3�3�3r1���)�randomr���Randomr��r��r����)r��r:���r ��r��r����r����s��� @@@r2����sampleszNormalDist.samples���sV��������� $�����&�-��2E�2E�2K���H�d�k� ��E�3�3�3�3�3�3�%��(�(�3�3�3�3r1���c�����������������������|�j���������|�j���������z��}|st����������d�������������||�j��������z ��}t����������||z��d|z��z��������������t ����������t ����������|z��������������z��S�)z4Probability density function. P(x <= X < x+dx) / dxz$pdf() not defined when sigma is zerog��������)r��r���r��r!���r���r#���)r��rS���r����diffs��� r2����pdfzNormalDist.pdf���s_�������;���,���� J�!�"H�I�I�I��4�8�|���4�$�;�$��/�2�3�3�d�3��>�6J�6J�J�Jr1���c�����������������������|�j���������st����������d�������������ddt����������||�j��������z ��|�j���������t����������z��z��������������z���z��S�)z,Cumulative distribution function. P(X <= x)z$cdf() not defined when sigma is zeror����r����)r��r���r"���r���_SQRT2�r��rS���s��� r2����cdfzNormalDist.cdf���sF�������{�� J�!�"H�I�I�I��c�C��T�X��$�+��2F� G�H�H�H�I�Ir1���c�����������������������|dk����s|dk����rt����������d�������������|�j��������dk����rt����������d�������������t����������||�j��������|�j��������������������S�)aS��Inverse cumulative distribution function. x : P(X <= x) = p Finds the value of the random variable such that the probability of the variable being less than or equal to that value equals the given probability. This function is also called the percent point function or quantile function. r����r����z$p must be in the range 0.0 < p < 1.0z-cdf() not defined when sigma at or below zero)r���r��r����r��)r��r����s��� r2����inv_cdfzNormalDist.inv_cdf���sV������� ��8�8�q�C�x�x�!�"H�I�I�I��;�#���!�"Q�R�R�R�#�A�t�x���=�=�=r1���r����c������������������@�����������fd�t����������d�������������D���������������S�)an��Divide into *n* continuous intervals with equal probability. Returns a list of (n - 1) cut points separating the intervals. Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set *n* to 100 for percentiles which gives the 99 cuts points that separate the normal distribution in to 100 equal sized groups. c������������������@������g�|�]}�����������������������|�z����������������S�r0���)r��)r8���r����r:���r��s��� ��r2���r����z(NormalDist.quantiles.<locals>.<listcomp>���s)�������9�9�9�����Q��U�#�#�9�9�9r1���r4���)r����)r��r:���s���``r2���r���zNormalDist.quantiles���s+���������:�9�9�9�9�U�1�a�[�[�9�9�9�9r1���c����������� ������� ����t����������|t����������������������st����������d�������������|�|}}|j��������|j��������f|j��������|j��������fk�����r||}}|j��������|j��������}}|r|st ����������d�������������||z ��}t����������|j��������|j��������z ��������������}|s%dt����������|d|j��������z��t����������z��z��������������z ��S�|j��������|z��|j��������|z��z ��}|j��������|j��������z��t����������||z��|t����������||z��������������z��z���������������z��} || z���|z��} || z ��|z��}dt����������|���������������������| ������������|���������������������| ������������z ��������������t����������|���������������������|������������|���������������������|������������z ��������������z���z ��S�)a���Compute the overlapping coefficient (OVL) between two normal distributions. Measures the agreement between two normal probability distributions. Returns a value between 0.0 and 1.0 giving the overlapping area in the two underlying probability density functions. >>> N1 = NormalDist(2.4, 1.6) >>> N2 = NormalDist(3.2, 2.0) >>> N1.overlap(N2) 0.8035050657330205 z$Expected another NormalDist instancez(overlap() not defined when sigma is zeror����r+���) r����r���rg���r��r��r���r���r ���r"���r��r���r$���r��)r���other�X�Y�X_var�Y_var�dvr����r{����b�x1�x2s��� r2����overlapzNormalDist.overlap���s������ ��%��,�,�� D��B�C�C�C��U�1�� �H�a�e����!�%�0�0�0��a�q�A��z�1�:�u���� N�E�� N�!�"L�M�M�M� �U�]�� �!�%�!�%�-� � ���� =���R�3���>�F�#:�;�<�<�<�<� �E�E�M�A�E�E�M�)�� �H�q�x��$�r�B�w��c�%�%�-�6H�6H�1H�'H�"I�"I�I���!�e�r�\���!�e�r�\���d�1�5�5��9�9�q�u�u�R�y�y�0�1�1�D����r���Q�U�U�2�Y�Y�9N�4O�4O�O�P�Pr1���c������������������R�����|�j���������st����������d�������������||�j��������z ��|�j���������z��S�)z�Compute the Standard Score. (x - mean) / stdev Describes *x* in terms of the number of standard deviations above or below the mean of the normal distribution. z'zscore() not defined when sigma is zero)r��r���r��r��s��� r2����zscorezNormalDist.zscore���s1��������{�� M�!�"K�L�L�L��D�H����+�+r1���c�����������������������|�j���������S�)z+Arithmetic mean of the normal distribution.�r���r��s��� r2���r ���zNormalDist.mean�����������x�r1���c�����������������������|�j���������S�)z,Return the median of the normal distributionr)��r*��s��� r2���r���zNormalDist.median ��r+��r1���c�����������������������|�j���������S�)z�Return the mode of the normal distribution The mode is the value x where which the probability density function (pdf) takes its maximum value. r)��r*��s��� r2���r���zNormalDist.mode��s��������x�r1���c�����������������������|�j���������S�)z.Standard deviation of the normal distribution.�r��r*��s��� r2���r���zNormalDist.stdev��s��������{�r1���c������������������ �����|�j���������|�j���������z��S�)z!Square of the standard deviation.r/��r*��s��� r2���r���zNormalDist.variance��s��������{�T�[�(�(r1���c������������������������t����������|t����������������������r5t����������|�j��������|j��������z���t����������|�j��������|j��������������������������������S�t����������|�j��������|z���|�j��������������������S�)aj��Add a constant or another NormalDist instance. If *other* is a constant, translate mu by the constant, leaving sigma unchanged. If *other* is a NormalDist, add both the means and the variances. Mathematically, this works only if the two distributions are independent or if they are jointly normally distributed. �r����r���r��r���r���r#��r$��s��� r2����__add__zNormalDist.__add__!���U��������b�*�%�%�� L��b�f�r�v�o�u�R�Y�� �/J�/J�K�K�K��"�&�2�+�r�y�1�1�1r1���c������������������������t����������|t����������������������r5t����������|�j��������|j��������z ��t����������|�j��������|j��������������������������������S�t����������|�j��������|z ��|�j��������������������S�)as��Subtract a constant or another NormalDist instance. If *other* is a constant, translate by the constant mu, leaving sigma unchanged. If *other* is a NormalDist, subtract the means and add the variances. Mathematically, this works only if the two distributions are independent or if they are jointly normally distributed. r2��r3��s��� r2����__sub__zNormalDist.__sub__/��r5��r1���c������������������\�����t����������|�j��������|z��|�j��������t����������|������������z��������������S�)z�Multiply both mu and sigma by a constant. Used for rescaling, perhaps to change measurement units. Sigma is scaled with the absolute value of the constant. �r���r��r��r ���r3��s��� r2����__mul__zNormalDist.__mul__=���'��������"�&�2�+�r�y�4��8�8�';�<�<�<r1���c������������������\�����t����������|�j��������|z��|�j��������t����������|������������z��������������S�)z�Divide both mu and sigma by a constant. Used for rescaling, perhaps to change measurement units. Sigma is scaled with the absolute value of the constant. r9��r3��s��� r2����__truediv__zNormalDist.__truediv__E��r;��r1���c������������������6�����t����������|�j��������|�j��������������������S�)zReturn a copy of the instance.�r���r��r���r#��s��� r2����__pos__zNormalDist.__pos__M��s�������"�&�"�)�,�,�,r1���c������������������8�����t����������|�j���������|�j��������������������S�)z(Negates mu while keeping sigma the same.r?��r@��s��� r2����__neg__zNormalDist.__neg__Q��s�������2�6�'�2�9�-�-�-r1���c�����������������������|�|z ���S�)z<Subtract a NormalDist from a constant or another NormalDist.r0���r3��s��� r2����__rsub__zNormalDist.__rsub__W��s�������b��z�r1���c������������������z�����t����������|t����������������������st����������S�|�j��������|j��������k����o|�j��������|j��������k����S�)zFTwo NormalDist objects are equal if their mu and sigma are both equal.)r����r����NotImplementedr��r��r3��s��� r2����__eq__zNormalDist.__eq__]��s7�������"�j�)�)�� "�!�!��v����:�B�I���$:�:r1���c������������������8�����t����������|�j��������|�j��������f������������S�)zCNormalDist objects hash equal if their mu and sigma are both equal.)�hashr��r��r*��s��� r2����__hash__zNormalDist.__hash__c��s�������T�X�t�{�+�,�,�,r1���c������������������P�����t����������|�������������j����������d|�j���������d|�j���������d�S�)Nz(mu=z, sigma=�))r?���r-���r��r��r*��s��� r2����__repr__zNormalDist.__repr__g��s.�������t�*�*�%�O�O�4�8�O�O�t�{�O�O�O�Or1���c�����������������������|�j���������|�j��������fS�r6���r���r*��s��� r2����__getstate__zNormalDist.__getstate__j��s�������x���$�$r1���c������������������$�����|\��|�_���������|�_��������d�S�r6���r���)r���states��� r2����__setstate__zNormalDist.__setstate__m��s������ %����$�+�+�+r1���)r����r����)r����)#r-���r.���r/����__doc__� __slots__r���classmethodr��r��r��r��r��r���r%��r'���propertyr ���r���r���r���r���r4��r7��r:��r=��rA��rC���__radd__rE���__rmul__rH��rK��rN��rP��rS��r0���r1���r2���r���r������s0�������������.�.� �:�?����I� #��#��#��#���'��'���[�'��"&��4��4��4��4��4�K��K��K�J��J��J�>��>��>� :�� :�� :�� :� Q�� Q�� Q�D ,�� ,�� ,��������X���������X���������X���������X����)��)���X�)�2��2��2�2��2��2�=��=��=�=��=��=�-��-��-�.��.��.���H��������H�;��;��;�-��-��-�P��P��P�%��%��%�&��&��&��&��&r1���r���r6���)rs���)r����)KrT���__all__r`���r����r ���sys� fractionsr����decimalr���� itertoolsr���r����bisectr���r���r���r���r ���r!���r"���r#���r$���r%���� functoolsr&����operatorr'����collectionsr(���r)���r*���r��rm���r���rP���r\���rb���rD���rA���rr���rv���rE���r|���� float_info�mant_digr����__annotations__rf���r����r����r ���r���r���r���r���r���r ���r���r���r���r���r���r���r���r���r����r���r���r����r ���r�����_statistics�ImportErrorr���r0���r1���r2����<module>rh�����s�����h��h��h�T������.����������� � � � �� � � � ��������������������������%��%��%��%��%��%��%��%��,��,��,��,��,��,��,��,��<��<��<��<��<��<��<��<��<��<��<��<��<��<��<��<��<��<��<��<��������������������������8��8��8��8��8��8��8��8��8��8� ��c���� �� �� �� �� �j�� �� �� �3��3��3�l&��&��&��&�R �� �� �4��4��4�>+��+��+�\�����$�������������������������3�>�2�2�Q�6����6��6��6� #�3�� #�3�� #�5�� #�� #�� #�� #��S���S���W���������<"��"��"�,#��#��#��#�LG��G��G�&5,��5,��5,��5,�p+��+��+�0 �� �� �,�����&E+��E+��E+��E+�PB��B��B�<K��K��K�r��;��(4��(4��(4��(4��(4�b)%��)%��)%��)%�X&��&��&��&�R?��?��?��?�$?��?��?��?�$ 4�� 4�� 4�(�����8H��H��H�B��:�0�2H�I�I����05��8>��8>��8>��8>��8>�|G��G��G�V �0�0�0�0�0�0�0���� �� �� ��D� ����\&��\&��\&��\&��\&��\&��\&��\&��\&��\&s����D!��!D)�(D)