o
    \i0
                     @   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
mZ d dlmZ e ZedZeejjd  Zee eje Zeje ZG dd	 d	Zejd
eejg dd Zdd Zdd Zdd ZdS )    N)	load_iris)
Perceptron)check_random_state)assert_allcloseassert_array_almost_equal)CSR_CONTAINERS   c                   @   s.   e Zd ZdddZdd Zdd Zdd	 Zd
S )MyPerceptron   c                 C   s
   || _ d S Nn_iter)selfr    r   /var/www/www-root/data/www/176.119.141.140/sports-predictor/venv/lib/python3.10/site-packages/sklearn/linear_model/tests/test_perceptron.py__init__   s   
zMyPerceptron.__init__c                 C   s   |j \}}tj|tjd| _d| _t| jD ],}t|D ]%}| || d || krA|  j|| ||  7  _|  j|| 7  _qqd S )N)dtypeg        r   )	shapenpzerosfloat64wbranger   predict)r   Xy	n_samples
n_featurestir   r   r   fit   s   
zMyPerceptron.fitc                 C   s   t || j| j S r   )r   dotr   r   r   r   r   r   r   project!   s   zMyPerceptron.projectc                 C   s   t |}t | |S r   )r   
atleast_2dsignr$   r#   r   r   r   r   $   s   
zMyPerceptron.predictN)r
   )__name__
__module____qualname__r   r!   r$   r   r   r   r   r   r	      s
    
r	   	containerc                 C   s>   | t }tdd dd}||t ||t}|dksJ d S )Nd   F)max_itertolshufflegffffff?)r   r   r!   r   score)r*   dataclfr/   r   r   r   test_perceptron_accuracy)   s
   r2   c                  C   sZ   t  } d| t dk< tdd}|t|  tddd d}|t|  t|j|j	  d S )Nr
      r   F)r,   r.   r-   )
r   copyr	   r!   r   r   r   r   coef_ravel)y_binclf1clf2r   r   r   test_perceptron_correctness2   s   
r;   c               	   C   sL   t dd} dD ]}tt t| | W d    n1 sw   Y  qd S )Nr+   )r,   )predict_probapredict_log_proba)r   pytestraisesAttributeErrorgetattr)r1   methr   r   r   test_undefined_methods?   s   
rC   c                  C   s   t ddd} | tt t ddd}|tt | tt|ttks&J t ddtt}t dddtt}t|j|j t ddtt}t dddtt}t|j|j d	S )
z?Check that `l1_ratio` has an impact when `penalty='elasticnet'`r   
elasticnet)l1_ratiopenaltyg333333?l1)rF   r
   l2N)r   r!   r   r   r/   r   r6   )r9   r:   clf_l1clf_elasticnetclf_l2r   r   r   test_perceptron_l1_ratioF   s   rL   ) numpyr   r>   sklearn.datasetsr   sklearn.linear_modelr   sklearn.utilsr   sklearn.utils._testingr   r   sklearn.utils.fixesr   irisrandom_statearanger0   r   indicesr.   r   targetr   r	   markparametrizearrayr2   r;   rC   rL   r   r   r   r   <module>   s&    



