403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/scipy/stats/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/scipy/stats/tests/__pycache__/test_entropy.cpython-311.pyc
�

d�c,���ddlZddlmZmZddlmZmZmZddlZddlm	Z
ddlmZGd�d��Z
Gd�d��ZdS)	�N)�assert_equal�assert_allclose)�assert_�assert_almost_equal�assert_array_almost_equal)�raisesc�h�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZdS)�TestEntropyc��gd�}gd�}tj||��}tj||��}td|k��t|dk��dS)N)��?皙�����?�333333�?)皙�����?g�?g�������?�)�stats�entropyr)�self�pk�qk�eself�edoubles     �@/usr/lib/python3/dist-packages/scipy/stats/tests/test_entropy.py�test_entropy_positivez!TestEntropy.test_entropy_positivesb��
�_�_��
�
�
���
�b�"�%�%���-��B�'�'����u�������3�������c��tjdt��}tj|d���}tt
|dz
��dk��tjdt��}d|dd�<tj||��}tj||d���}tt
||ztjd��z
��dk��dS)N�g@��baseg@g�h㈵��>�)�np�ones�floatrrr�abs�log)rr�Sr�S2s     r�test_entropy_basezTestEntropy.test_entropy_bases���
�W�R��
�
���M�"�2�&�&�&����A��F���e�#�$�$�$�
�W�R��
�
����2�A�2���M�"�b�!�!��
�]�2�r��
+�
+�
+����A�b�D�2�6�"�:�:�%�&�&��.�/�/�/�/�/rc�R�ttjgd���dd���dS)N)r��g ��R^�?�)�decimal)rrr)rs r�test_entropy_zerozTestEntropy.test_entropy_zero"s9���E�M�)�)�)�4�4�6I�$&�	(�	(�	(�	(�	(�	(rc�|�ddgddgddgg}ddgddgddgg}ttj||��ddg��dS)Nrr
�333333�?rrgN!�0��?���2���?�rrr�rrrs   r�test_entropy_2dzTestEntropy.test_entropy_2d'sd���C�j�3��*�s�C�j�
1���C�j�3��*�s�C�j�
1��!�%�-��B�"7�"7�#,�j�"9�	;�	;�	;�	;�	;rc���ddgddgddgg}ddgddgddgg}ttj||��tjdg��d|dd<ttj||��d	dg��dS)
Nrr
r/rrrr0rg�^fT�F�?)rrrr �infr2s   r�test_entropy_2d_zeroz TestEntropy.test_entropy_2d_zero-s����C�j�3��*�s�C�j�
1���C�j�3��*�s�C�j�
1��!�%�-��B�"7�"7�#%�6�:�"6�	8�	8�	8���1��a��!�%�-��B�"7�"7�#-�z�":�	<�	<�	<�	<�	<rc�h�ddgddgddgg}ttj|d���gd���dS)	Nrr
r/rrr)��axis)���R^�?r:gD%��+�?r1�rrs  r�$test_entropy_base_2d_nondefault_axisz0TestEntropy.test_entropy_base_2d_nondefault_axis7sU���C�j�3��*�s�C�j�
1��!�%�-���";�";�";�"F�"F�"F�	H�	H�	H�	H�	Hrc��ddgddgddgg}ddgddgddgg}ttj||d���gd���dS)	Nrr
r/rrr)r8)�.c}��?r>g�a���X�?r1r2s   r�test_entropy_2d_nondefault_axisz+TestEntropy.test_entropy_2d_nondefault_axis<so���C�j�3��*�s�C�j�
1���C�j�3��*�s�C�j�
1��!�%�-��B�Q�"?�"?�"?�"@�"@�"@�	B�	B�	B�	B�	Brc�n�ddgddgddgg}ddgddgg}tttj||��dS)Nrr
r/rr)�
assert_raises�
ValueErrorrrr2s   r�test_entropy_raises_value_errorz+TestEntropy.test_entropy_raises_value_errorBsH���C�j�3��*�s�C�j�
1���C�j�3��*�
%���j�%�-��R�8�8�8�8�8rc��ddgddgddgg}ttj|d���tj|����dS�Nrr
r/rrrr8r1r;s  r�1test_base_entropy_with_axis_0_is_equal_to_defaultz=TestEntropy.test_base_entropy_with_axis_0_is_equal_to_defaultGsT���C�j�3��*�s�C�j�
1��!�%�-���";�";�";�"'�-��"3�"3�	5�	5�	5�	5�	5rc��ddgddgddgg}ddgddgddgg}ttj||d���tj||����dSrEr1r2s   r�,test_entropy_with_axis_0_is_equal_to_defaultz8TestEntropy.test_entropy_with_axis_0_is_equal_to_defaultLsp���C�j�3��*�s�C�j�
1���C�j�3��*�s�C�j�
1��!�%�-��B�Q�"?�"?�"?�"'�-��B�"7�"7�	9�	9�	9�	9�	9rc��tjddgddgddgg��}ttj|j��jtj|d�����dS�Nrr
r/rrr)r8�r �arrayrrr�Tr;s  r�test_base_entropy_transposedz(TestEntropy.test_base_entropy_transposedRsc��
�X��S�z�C��:��S�z�:�
;�
;��!�%�-���"5�"5�"7�"'�-���";�";�";�	=�	=�	=�	=�	=rc��tjddgddgddgg��}tjddgddgddgg��}ttj|j|j��jtj||d�����dSrJrKr2s   r�test_entropy_transposedz#TestEntropy.test_entropy_transposedWs���
�X��S�z�C��:��S�z�:�
;�
;��
�X��S�z�C��:��S�z�:�
;�
;��!�%�-���b�d�";�";�"=�"'�-��B�Q�"?�"?�"?�	A�	A�	A�	A�	Arc��tj�d��tj�d��}tj�dd��}tj||d���}t|dtj||d����t|dtj||d����dS)Nr�r*r)���r8)r �random�randrrr)r�x�y�ress    r�test_entropy_broadcastingz%TestEntropy.test_entropy_broadcasting]s���
�	���q�����I�N�N�1�����I�N�N�1�a� � ���m�A�q�r�*�*�*���S��V�U�]�1�a��d�3�3�4�4�4��S��V�U�]�1�a��d�3�3�4�4�4�4�4rc��tj�ddd��}tj�dd��}d}tjt
|���5t
j||��ddd��dS#1swxYwYdS)N�
r)r+�r*z+shape mismatch: objects cannot be broadcast��match�r rTrU�pytestrrBrr)rrVrW�messages    r�test_entropy_shape_mismatchz'TestEntropy.test_entropy_shape_mismatches����I�N�N�2�q�"�%�%���I�N�N�2�q�!�!��?��
�]�:�W�
5�
5�
5�	 �	 ��M�!�Q����	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 �	 �	 s�B�B�	Bc���tj�d��}d}tjt
|���5t
j|d���ddd��dS#1swxYwYdS)Nr[z!`base` must be a positive number.r]���rr_�rrVras   r�test_input_validationz!TestEntropy.test_input_validationls����I�N�N�2����5��
�]�:�W�
5�
5�
5�	&�	&��M�!�"�%�%�%�%�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&�	&�	&s�A!�!A%�(A%N)�__name__�
__module__�__qualname__rr'r-r3r6r<r?rCrFrHrNrPrYrbrf�rrr
r

s������� � � �	0�	0�	0�(�(�(�
;�;�;�<�<�<�H�H�H�
B�B�B�9�9�9�
5�5�5�
9�9�9�=�=�=�
A�A�A�5�5�5� � � �&�&�&�&�&rr
c���eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	e
j�dgd	���d
���Z
ddd
dd�Ze
j�dee�������d���Zddddd�Ze
j�dee�������d���Ze
j�dgd���d���ZdS)�TestDifferentialEntropyz�
    Vasicek results are compared with the R package vsgoftest.

    # library(vsgoftest)
    #
    # samp <- c(<values>)
    # entropy.estimate(x = samp, window = <window_length>)

    c�b�tj�d��}|�d��}t	j|d���}t
|dd���t	j|dd�	��}t
|d
d���t	j|dd�	��}t
|dd���dS)
Nr�d�vasicek��method�d�{�?���ư>��rtolr))�
window_lengthrq���h���?r�À%��?�r rT�RandomState�standard_normalr�differential_entropyr�r�random_state�valuesrs    r�!test_differential_entropy_vasicekz9TestDifferentialEntropy.test_differential_entropy_vasicek~s����y�,�,�Q�/�/���-�-�c�2�2���,�V�I�F�F�F������5�5�5�5��,�V�1�4=�?�?�?������5�5�5�5��,�V�1�4=�?�?�?������5�5�5�5�5�5rc�t�tj�d��}|�d��}t	j|dd���}t
|gd�d���t	j|ddd�	��}t
|gd
�d���t	j|ddd�	��}t
|gd�d���dS)
Nr�rRrnr)ro)r9rq)rrg��.�x�?gOjM��?rsrt)r9rvrq)rwg\�����?g�:��?r)rxgp��j�?g80�Qd��?ryr}s    r�4test_differential_entropy_vasicek_2d_nondefault_axiszLTestDifferentialEntropy.test_differential_entropy_vasicek_2d_nondefault_axis�s���y�,�,�Q�/�/���-�-�h�7�7���,�V�!�I�N�N�N����*�*�*��	
�	
�	
�	
��,�V�!�1�4=�?�?�?����*�*�*��	
�	
�	
�	
��,�V�!�1�4=�?�?�?����*�*�*��	
�	
�	
�	
�	
�	
rc�\�tj�d��}|�d��}d}|jd}dd|dz|hD]^}|�||���}t
t|���5tj	||d�	��ddd��n#1swxYwY�_dS)
Nrr�zhWindow length \({window_length}\) must be positive and less than half the sample size \({sample_size}\).r)rSr*)rv�sample_sizer])rvr9)
r rTrzr{�shape�formatrArBrr|)rr~r�	error_strr�rv�formatted_error_strs       r�,test_differential_entropy_raises_value_errorzDTestDifferentialEntropy.test_differential_entropy_raises_value_error�s���y�,�,�Q�/�/���-�-�h�7�7��
<�	�
�l�1�o�� �!�[�!�^�[�A�	�	�M�"+�"2�"2�+�'�#3�#�#��
�z�1D�E�E�E�
�
��*��"/������
�
�
�
�
�
�
�
�
�
�
����
�
�
�
��	�	s�<B � B$	�'B$	c���tj�d��}|�d��}t	j|d���}t	j|��}t
||��dS)Nr)rnrRr8ry)rr~rr�default_entropys     r�>test_base_differential_entropy_with_axis_0_is_equal_to_defaultzVTestDifferentialEntropy.test_base_differential_entropy_with_axis_0_is_equal_to_default�se���y�,�,�Q�/�/���-�-�h�7�7���,�V�!�<�<�<���4�V�<�<�����1�1�1�1�1rc���tj�d��}|�d��}t	tj|j��jtj|d�����dS)Nrr�r)r8)r rTrzr{rrr|rM)rr~rs   r�)test_base_differential_entropy_transposedzATestDifferentialEntropy.test_base_differential_entropy_transposed�sl���y�,�,�Q�/�/���-�-�h�7�7����&�v�x�0�0�2��&�v�A�6�6�6�	
�	
�	
�	
�	
rc�r�tj�d��}d}tjt
|���5t
j|d���ddd��n#1swxYwYd}tjt
|���5t
j|d���ddd��dS#1swxYwYdS)	Nr[z+`base` must be a positive number or `None`.r]rdrz`method` must be one of...z	ekki-ekkirp)r rTrUr`rrBrr|res   rrfz-TestDifferentialEntropy.test_input_validation�s0���I�N�N�2����?��
�]�:�W�
5�
5�
5�	3�	3��&�q�r�2�2�2�2�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3�/��
�]�:�W�
5�
5�
5�	>�	>��&�q��=�=�=�=�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>����	>�	>�	>�	>�	>�	>s#�A � A$�'A$�B,�,B0�3B0rq)ro�van es�ebrahimi�correac���|dkrdnd}tj�|d���}tj���}tj||���}t||d���dS)	Nr��'i@Br��sizer~rp�{�G�zt?rt)r�norm�rvsrr|r)rrq�nr��expectedrXs      r�test_consistencyz(TestDifferentialEntropy.test_consistency�sq���x�'�'�E�E�W���j�n�n�!�!�n�4�4���:�%�%�'�'���(��V�<�<�<����X�E�2�2�2�2�2�2r)g��MbX�?灕C�l�?)g�A`��"�?g)\��(�?)gH�z�G�?gy�&1��?)g����Mb�?r�)ror�r�r�zmethod, expectedc��d\}}}|\}}tj�||fd���}tj���}	tj|||d���}
tt
jt
j|
|	z
dz����|d���tt
j	|
��|d	���dS�
N)r��2�rr�rS)rvrqr9r*r�)�atolg����Mb`?)
rr�r�rr|rr �sqrt�mean�std�rrqr��repsr��m�
rmse_expected�std_expectedr��true_entropyrXs           r�test_norm_rmse_stdz*TestDifferentialEntropy.test_norm_rmse_std�s���"�
��a��&.�#�
�|��j�n�n�4��)�!�n�<�<���z�)�)�+�+���(��A�06�R�A�A�A��������|�);�a�(?� @� @�A�A�%�E�	3�	3�	3�	3����s���\��>�>�>�>�>�>r)g�E����?�l���?)g���x��?g�O��n�?)gףp=
��?g�~j�t�?)g���S�?r�c��d\}}}|\}}tj�||fd���}tj���}	tj|||d���}
tt
jt
j|
|	z
dz����|d���tt
j	|
��|d	���dSr�)
r�exponr�rr|rr r�r�r�r�s           r�test_expon_rmse_stdz+TestDifferentialEntropy.test_expon_rmse_stds���"�
��a��&.�#�
�|��k�o�o�D�!�9�1�o�=�=���{�*�*�,�,���(��A�06�R�A�A�A��������|�);�a�(?� @� @�A�A�%�E�	3�	3�	3�	3����s���\��>�>�>�>�>�>rz	n, method))rr�)r+r�)i�roc��tj�|fd���}tj|��}tj||���}||ksJ�dS)Nrr�rp)rr�r�r|)rr�rqr��res1�res2s      r�test_method_autoz(TestDifferentialEntropy.test_method_autosS���j�n�n�1�$�Q�n�7�7���)�#�.�.���)�#�f�=�=�=���t�|�|�|�|�|�|rN)rgrhri�__doc__r�r�r�r�r�rfr`�mark�parametrizer��norm_rmse_std_cases�list�itemsr��expon_rmse_std_casesr�r�rjrrrlrlss���������6�6�6� 
�
�
�6���22�2�2�
�
�
�	>�	>�	>��[���X�(>�(>�(>�?�?�3�3�?�?�3�'5�%3�%3�'5�	����[���/�!�T�"5�";�";�"=�"=�>�>�@�@�?�?�@�@�?� (6�&4�&4�(6�	����[���/�!�T�"6�"<�"<�">�">�?�?�A�A�?�?�A�A�?��[���[�+>�+>�+>�?�?���?�?���rrl)�numpyr �
numpy.testingrrrrrr`rrA�scipy.statsrr
rlrjrr�<module>r�s�������7�7�7�7�7�7�7�7�6�6�6�6�6�6�6�6�6�6��
�
�
�*�*�*�*�*�*�������c&�c&�c&�c&�c&�c&�c&�c&�Ll�l�l�l�l�l�l�l�l�lr

Youez - 2016 - github.com/yon3zu
LinuXploit