U
    }h                     @   s   d dl Zd dlZd dlmZmZmZ d dlmZ d dl	m
Z
 d ddddgd dddd	gddddd ggZd
ggd Zdd Zdd Zejjeed kdddd Zdd ZdS )    N)
bsr_matrix
csc_matrix
csr_matrix)VarianceThreshold)assert_array_equal               g$b@
   c               	   C   s   t tt tt tt fD ]*} t | }tddddg|jdd qt	t
 t ddddgg W 5 Q R X t	t
 t ddgddgg W 5 Q R X d S )Nr   r   r	   r
   Tindicesr   )datar   r   r   r   fitr   get_supportpytestraises
ValueError)Xsel r   [/tmp/pip-unpacked-wheel-ig1s1lm8/sklearn/feature_selection/tests/test_variance_threshold.pytest_zero_variance   s     r   c                  C   s<   t tt fD ]*} tdd| } tt df| jkstqd S )Ng?)	thresholdr   )r   r   r   Zfit_transformlenshapeAssertionError)r   r   r   r   test_variance_threshold   s    r   zRThis test is not valid for this platform, as it relies on numerical instabilities.)reasonc               
   C   sL   t tt tt tt fD ].} d}tjt|d t |  W 5 Q R X qd S )Nz4No feature in X meets the variance threshold 0.00000)match)	data2r   r   r   r   r   r   r   r   )r   msgr   r   r   'test_zero_variance_floating_point_error!   s    r#   c                  C   sr   t jtt jd} t j| d< t j| d d df< | t| t| t| fD ](}t 	|}t
dddg|jdd qDd S )	N)Zdtype)r   r   r   r   r	   r
   Tr   )nparrayr   Zfloat64nanr   r   r   r   r   r   r   )Zarrr   r   r   r   r   test_variance_nan4   s    
r'   )Znumpyr$   r   Zscipy.sparser   r   r   Zsklearn.feature_selectionr   Zsklearn.utils._testingr   r   r!   r   r   markZskipifvarr#   r'   r   r   r   r   <module>   s   (
