관리-도구
편집 파일: test_regression.cpython-37.pyc
B ��Fd � @ sz d dl mZmZmZ d dlZd dlmZmZmZm Z m Z d dlmZ d dl mZ d dlZG dd� de�Zedkrve� dS ) � )�division�absolute_import�print_functionN)�TestCase�run_module_suite�assert_�assert_array_equal� assert_raises)�random)�longc @ sd e Zd Zdd� Zdd� Zdd� Zdd� Zd d � Zdd� Zd d� Z dd� Z dd� Zdd� Zdd� Z dS )�TestRegressionc C sR xLt �ddd�D ]:}tj�|dd�}tt �|t j k�oFt �|t jk�� qW d S )Ng �g @� � �2 )�np�linspacer �mtrand�vonmisesr �all�pi)�self�mu�r� r ��/builddir/build/BUILDROOT/alt-python37-numpy-1.13.3-8.el8.x86_64/opt/alt/python37/lib64/python3.7/site-packages/numpy/random/tests/test_regression.py�test_VonMises_range s z"TestRegression.test_VonMises_rangec C s� t t�tjjddddd�dk �� t t�tjjddddd�dk�� dg}tjd k}|rltjd krl|�d� x |D ]}t tjj|� dk� qrW d S )N� � � � )�size� r )i�� i�� i�� l �win32)l ���l ���l ���) r r r r �hypergeometric�sys�maxsize�platform�append)r �argsZ is_64bits�argr r r �test_hypergeometric_range s "" z(TestRegression.test_hypergeometric_rangec C s| d}t j�d� t jjd|d�}t �|dk�t|� }d| }t|dk|� t �|dk�t|� }d | }t|d k |� d S )Ni� r g�������?)r r z"Frequency was %f, should be > 0.45g�������?� z"Frequency was %f, should be < 0.23gq= ףp�?)r r �seed� logseries�sum�floatr )r �NZrvsnZfreq�msgr r r �test_logseries_convergence# s z)TestRegression.test_logseries_convergencec C sB t j�d� t j�d�}t j�d� t j�td��}t||� d S )Ni� � )r r r, �permutationr r )r �a�br r r �test_permutation_longs3 s z%TestRegression.test_permutation_longsc C sz xtdddd gdddd gdddd gdddd ggD ]D}t j�d� t|�}t�|� t||d |d |d |d g� q.W d S ) Nr r+ r )r r )r+ r+ )r r i90 r )r r r, �list�shuffler )r �tZshuffledr r r �test_shuffle_mixed_dimension: s z+TestRegression.test_shuffle_mixed_dimensionc C st t j�� }t �ddddddddddg �}xFtd�D ]:}t j�|� |�d � t|jd d t �d �d d�|� q2W d S ) Nr � � r+ r � r! r i� r g $@)r �p) r r �RandomState�array�ranger, r �choice�ones)r �m�res�ir r r �test_call_within_randomstateE s z+TestRegression.test_call_within_randomstatec C sX t jjdgdggdd� t jjdgdggt �d�d� t jjdgdggt �d�d� d S )Nr r )r )r r �multivariate_normal�int_�int64)r r r r �#test_multivariate_normal_size_typesO s z2TestRegression.test_multivariate_normal_size_typesc C s: t j�d� t jjdddd�}tt �t �|�� d� d S )Ni��Ig-C��6?�d )r zNans in np.random.beta)r r r, �betar �any�isnan)r �xr r r �test_beta_small_parametersW s z)TestRegression.test_beta_small_parametersc C s� t j�d� dddg}dddg}xbt jt jt jfD ]N}t j||d�t|� }t jj||d�}t ||k� t tt jj||d d� q2W d S ) Ni� r r+ r r! )�dtype)r? g�������?)r r r, �float16�float32�float64rA r. rC r r � ValueError)r r5 �counts�dtZprobs�cr r r �"test_choice_sum_of_probs_tolerance^ s z1TestRegression.test_choice_sum_of_probs_tolerancec C sL t j�d� t �ddg�}xtd�D ]}t j�|� q$W dd l}|�� d S )Ni� r5 A� aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarM r )r r r, rA rB r9 �gc�collect)r r5 �_r\ r r r �1test_shuffle_of_array_of_different_length_stringsk s z@TestRegression.test_shuffle_of_array_of_different_length_stringsc C sX t j�d� t �t �d�t �d�g�}xtd�D ]}t j�|� q0W dd l}|�� d S )Ni� r r! i� r ) r r r, rA �arangerB r9 r\ r] )r r5 r^ r\ r r r � test_shuffle_of_array_of_objectsz s z/TestRegression.test_shuffle_of_array_of_objectsN)�__name__� __module__�__qualname__r r* r2 r7 r; rH rL rR r[ r_ ra r r r r r s r �__main__)� __future__r r r r$ Z numpy.testingr r r r r �numpyr �numpy.compatr r r rb r r r r �<module> s }