o
    \ip                  	   @   s  d dl Zd dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZmZ d dlmZ dd gd d	gd	d	gd	d	ggZg d
Zg dZejdejdeejg ejdddgejdddgejdddgdd Zd2ddZdd ZdZd d! Zejd"d#ed$fgd%d& Zejd'ded	 gd(d) Zejd*ed+fd,gd-d. Zejd/ded	 gd0d1 ZdS )3    N)stats)LogisticRegression)	LinearSVC)l1_min_c)bounded_rand_int_wrapset_seed_wrap)CSR_CONTAINERS   )r   r
   r
   r
   )   r
   r   r   zIignore:.*'liblinear' solver for multiclass classification is deprecated.*X_containerlosssquared_hingelogY_labeltwo-classesmulti-classintercept_labelno-interceptfit-interceptc           	      C   sN   t td}ddidddd}| t}|| }|| }t|||fi | d S )N)r   r   fit_interceptFT
   )r   intercept_scaling)r   r   )Y1Y2dense_Xcheck_l1_min_c)	r   r   r   r   Ys
interceptsXYintercept_params r"   ~/var/www/www-root/data/www/176.119.141.140/sports-predictor/venv/lib/python3.10/site-packages/sklearn/svm/tests/test_bounds.pytest_l1_min_c   s   
r$   T      ?c                 C   s   t | ||||d}tdddtddddd| }||_||_||_|| | t|j	d	k
 s4J t|jd	k
 s@J |d
 |_|| | t|j	d	k sat|jd	k scJ d S d S )N)r   r   r   l1	liblinear)penaltysolverr   F)r   r(   dual)r   r   r   g)\(?)r   r   r   r   r   Cfitnpasarraycoef_all
intercept_any)r   yr   r   r   min_cclfr"   r"   r#   r   '   s*   
	
4r   c                  C   sR   ddgddgg} ddg}t t t| | W d    d S 1 s"w   Y  d S )Nr   r
   )pytestraises
ValueErrorr   )r   r3   r"   r"   r#   test_ill_posed_min_cB   s
   "r9   l    c                      sF   dd t dD  tdd  D sJ t fdd D r!J dS )a  Test that bounded_rand_int_wrap without seeding respects the range

    Note this test should pass either if executed alone, or in conjunctions
    with other tests that call set_seed explicit in any order: it checks
    invariants on the RNG instead of specific values.
    c                 S   s   g | ]}t d qS )d   r   .0_r"   r"   r#   
<listcomp>S       z(test_newrand_default.<locals>.<listcomp>r   c                 s   s(    | ]}d |  kodk n  V  qdS )r   r:   Nr"   r=   xr"   r"   r#   	<genexpr>T   s   & z'test_newrand_default.<locals>.<genexpr>c                 3   s    | ]	}| d  kV  qdS )r   Nr"   rA   	generatedr"   r#   rC   U   s    N)ranger0   r"   r"   rD   r#   test_newrand_defaultL   s   rG   zseed, expected)r   6   	   c                 C   s    t |  td}||ksJ dS )z3Test that `set_seed` produces deterministic resultsr:   N)r   r   )seedexpectedrE   r"   r"   r#   test_newrand_set_seedX   s   rL   rJ   c                 C   8   t t t|  W d   dS 1 sw   Y  dS )z=Test that `set_seed_wrap` is defined for unsigned 32bits intsN)r6   r7   OverflowErrorr   )rJ   r"   r"   r#   test_newrand_set_seed_overflow`      
"rO   zrange_, n_ptsi'  )r:      c                    s   t d d}g }tjd d}t|D ]} fddt|D }t||j}||j qtjddd}t||j}	|	jdksJJ d	|	j d
tj	|dd}
|
dks]J d|
 ddS )z;Test that `bounded_rand_int` follows a uniform distribution*   r:   r   )locscalec                    s   g | ]}t  qS r"   r;   r<   range_r"   r#   r?   s   r@   z1test_newrand_bounded_rand_int.<locals>.<listcomp>r
   g?zNull hypothesis rejected: generated random numbers are not uniform. Details: the (meta) p-value of the test of uniform distribution of p-values is z which is not > 0.05r   )qzlNull hypothesis rejected: generated random numbers are not uniform. Details: lower 10th quantile p-value of z not > 0.05.N)
r   r   uniformrF   kstestcdfappendpvaluer-   
percentile)rV   n_ptsn_iterks_pvalsuniform_distr>   sampleresuniform_p_vals_dist	res_pvalsmin_10pct_pvalr"   rU   r#   test_newrand_bounded_rand_intg   s*   
rg   rV   c                 C   rM   )zETest that `bounded_rand_int_wrap` is defined for unsigned 32bits intsN)r6   r7   rN   r   rU   r"   r"   r#   $test_newrand_bounded_rand_int_limits   rP   rh   )Tr%   ) numpyr-   r6   scipyr   sklearn.linear_modelr   sklearn.svmr   sklearn.svm._boundsr   sklearn.svm._newrandr   r   sklearn.utils.fixesr   r   r   r   markfilterwarningsparametrizearrayr$   r   r9   _MAX_UNSIGNED_INTrG   rL   rO   rg   rh   r"   r"   r"   r#   <module>   s>    



'