
    sg                        d Z ddlZddlmZmZ ddlmZ ddlmZm	Z	 ddl
ZddlZddlmZmZmZmZmZ ddlmZ dd	lmZmZ dd
lmZ ddlmZ ddlmZmZm Z m!Z!m"Z" ddl#m$Z$m%Z%m&Z& ddl'm(Z( ddl)m*Z* ddl+m,Z,m-Z-m.Z. ddl/m0Z0 ddl1m2Z2m3Z3 ddl4m5Z5m6Z6m7Z7 ddl8m9Z9m:Z: ddgZ;d Z< G d dee      Z= G d dee=      Z> G d dee=      Z?y) zMulti-layer Perceptron    N)ABCMetaabstractmethod)chain)IntegralReal   )BaseEstimatorClassifierMixinRegressorMixin_fit_contextis_classifier)ConvergenceWarning)accuracy_scorer2_score)train_test_split)LabelBinarizer)_safe_indexingcheck_random_statecolumn_or_1dgen_batchesshuffle)IntervalOptions
StrOptions)safe_sparse_dot)available_if)_check_partial_fit_first_calltype_of_targetunique_labels)_check_optimize_result)check_is_fittedvalidate_data   )ACTIVATIONSDERIVATIVESLOSS_FUNCTIONS)AdamOptimizerSGDOptimizersgdadamc                 t    t        j                  | |z   D cg c]  }|j                          c}      S c c}w )z)Pack the parameters into a single vector.)nphstackravel)coefs_intercepts_ls      `/var/www/html/venv/lib/python3.12/site-packages/sklearn/neural_network/_multilayer_perceptron.py_packr3   0   s*    99+)=>Aaggi>??>s   5c                      e Zd ZU dZi dd eeddd      gd eh d	      gd
 eh d      gd eeddd      gd edh       eeddd      gd eh d      gd eeddd      gd eeddd      gd eeddd      gddgddgd eeddd      gddgddgd eeddd      gddgddg eeddd      g eeddd      g eeddd      g eeddd      g eeddd       eee	j                  h      g eeddd      gd Zeed!<   ed"        Zd# Zd$ Zd4d&Zd' Zd( Zd) Zd* Zd+ Zd5d,Zd- Zd. Zd/ Z ed%0      d1        Zd2 Zd3 Zy)6BaseMultilayerPerceptronzBase class for MLP classification and regression.

    Warning: This class should not be used directly.
    Use derived classes instead.

    .. versionadded:: 0.18
    hidden_layer_sizesz
array-liker#   Nleft)closed
activation>   relutanhidentitylogisticsolver>   r)   r*   lbfgsalphar   
batch_sizeautolearning_rate>   adaptiveconstant
invscalinglearning_rate_initneitherpower_tmax_iterr   booleanrandom_statetolverbose
warm_startmomentumbothnesterovs_momentumearly_stopping)validation_fractionbeta_1beta_2epsilonn_iter_no_changemax_fun_parameter_constraintsc                 T   || _         || _        || _        || _        || _        || _        || _        |	| _        |
| _        || _	        || _
        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        y N)r9   r>   r@   rA   rC   rG   rI   rJ   lossr6   r   rL   rM   rN   rO   rP   rR   rS   rT   rU   rV   rW   rX   rY   )selfr6   r9   r>   r@   rA   rC   rG   rI   rJ   r]   r   rL   rM   rN   rO   rP   rR   rS   rT   rU   rV   rW   rX   rY   s                            r2   __init__z!BaseMultilayerPerceptron.__init__a   s    8 %
$*"4 	"4($ "4,#6  0    c                     t        | j                  dz
        D ]_  }| j                  |   \  }}}t        j                  ||| |      | j
                  |<   | j                  |   \  }}||| | j                  |<   a y)z?Extract the coefficients and intercepts from packed_parameters.r#   N)range	n_layers__coef_indptrr,   reshaper/   _intercept_indptrr0   )r^   packed_parametersistartendshapes         r2   _unpackz BaseMultilayerPerceptron._unpack   s    t~~)* 	?A $ 1 1! 4E3ZZ(9%(DeLDKKN//2JE3"3E#">DQ	?r`   c                 n   t         | j                     }t        | j                  dz
        D ]e  }t	        ||   | j
                  |         ||dz   <   ||dz   xx   | j                  |   z  cc<   |dz   | j                  dz
  k7  sX |||dz             g t         | j                     } ||dz             |S )a,  Perform a forward pass on the network by computing the values
        of the neurons in the hidden layers and the output layer.

        Parameters
        ----------
        activations : list, length = n_layers - 1
            The ith element of the list holds the values of the ith layer.
        r#   )r$   r9   rb   rc   r   r/   r0   out_activation_)r^   activationshidden_activationrh   output_activations        r2   _forward_passz&BaseMultilayerPerceptron._forward_pass   s     (8t~~)* 	6A!0QQ!PKAA$"2"21"55 A4>>A-.!+a!e"45	6 ((<(<=+a!e,-r`   Tc                 R   |rt        | |ddgd      }|}t        | j                     }t        | j                  dz
        D ]H  }t        || j                  |         }|| j                  |   z  }|| j                  dz
  k7  sA ||       J t        | j                     } ||       |S )a[  Predict using the trained model

        This is the same as _forward_pass but does not record the activations
        of all layers and only returns the last layer's activation.

        Parameters
        ----------
        X : {array-like, sparse matrix} of shape (n_samples, n_features)
            The input data.

        check_input : bool, default=True
            Perform input data validation or not.

        Returns
        -------
        y_pred : ndarray of shape (n_samples,) or (n_samples, n_outputs)
            The decision function of the samples for each class in the model.
        csrcscF)accept_sparseresetr#   r   )	r"   r$   r9   rb   rc   r   r/   r0   rn   )r^   Xcheck_inputr9   rp   rh   rq   s          r2   _forward_pass_fastz+BaseMultilayerPerceptron._forward_pass_fast   s    & dAeU^5QA 
 (8t~~)* 	.A(T[[^DJ$**1--JDNNQ&&!*-		.
 ((<(<=*%r`   c                     t        ||   j                  ||         ||<   ||xx   | j                  | j                  |   z  z  cc<   ||xx   |z  cc<   t	        j
                  ||   d      ||<   y)zCompute the gradient of loss with respect to coefs and intercept for
        specified layer.

        This function does backpropagation for the specified one layer.
        r   N)r   Tr@   r/   r,   mean)r^   layer	n_samplesro   deltas
coef_gradsintercept_gradss          r2   _compute_loss_gradz+BaseMultilayerPerceptron._compute_loss_grad   so     ,K,>,@,@&-P
55TZZ$++e*<<<5Y&!#!:r`   c                 x    | j                  |       | j                  ||||||      \  }}}t        ||      }	||	fS )aR  Compute the MLP loss function and its corresponding derivatives
        with respect to the different parameters given in the initialization.

        Returned gradients are packed in a single vector so it can be used
        in lbfgs

        Parameters
        ----------
        packed_coef_inter : ndarray
            A vector comprising the flattened coefficients and intercepts.

        X : {array-like, sparse matrix} of shape (n_samples, n_features)
            The input data.

        y : ndarray of shape (n_samples,)
            The target values.

        activations : list, length = n_layers - 1
            The ith element of the list holds the values of the ith layer.

        deltas : list, length = n_layers - 1
            The ith element of the list holds the difference between the
            activations of the i + 1 layer and the backpropagated error.
            More specifically, deltas are gradients of loss with respect to z
            in each layer, where z = wx + b is the value of a particular layer
            before passing through the activation function

        coef_grads : list, length = n_layers - 1
            The ith element contains the amount of change used to update the
            coefficient parameters of the ith layer in an iteration.

        intercept_grads : list, length = n_layers - 1
            The ith element contains the amount of change used to update the
            intercept parameters of the ith layer in an iteration.

        Returns
        -------
        loss : float
        grad : array-like, shape (number of nodes of all layers,)
        )rl   	_backpropr3   )
r^   packed_coef_interrx   yro   r   r   r   r]   grads
             r2   _loss_grad_lbfgsz)BaseMultilayerPerceptron._loss_grad_lbfgs   sL    V 	&',0NNq+vz?-
)j/ Z1Tzr`   c           	         |j                   d   }| j                  |      }| j                  }|dk(  r| j                  dk(  rd}t	        |   ||d         }	d}
| j
                  D ]+  }|j                         }|
t        j                  ||      z  }
- |	d| j                  z  |
z  |z  z  }	| j                  dz
  }|d   |z
  ||<   | j                  ||||||       t        | j                     }t        | j                  dz
  dd      D ]Y  }t        ||   | j
                  |   j                         ||dz
  <    |||   ||dz
            | j                  |dz
  |||||       [ |	||fS )	a  Compute the MLP loss function and its corresponding derivatives
        with respect to each parameter: weights and bias vectors.

        Parameters
        ----------
        X : {array-like, sparse matrix} of shape (n_samples, n_features)
            The input data.

        y : ndarray of shape (n_samples,)
            The target values.

        activations : list, length = n_layers - 1
             The ith element of the list holds the values of the ith layer.

        deltas : list, length = n_layers - 1
            The ith element of the list holds the difference between the
            activations of the i + 1 layer and the backpropagated error.
            More specifically, deltas are gradients of loss with respect to z
            in each layer, where z = wx + b is the value of a particular layer
            before passing through the activation function

        coef_grads : list, length = n_layers - 1
            The ith element contains the amount of change used to update the
            coefficient parameters of the ith layer in an iteration.

        intercept_grads : list, length = n_layers - 1
            The ith element contains the amount of change used to update the
            intercept parameters of the ith layer in an iteration.

        Returns
        -------
        loss : float
        coef_grads : list, length = n_layers - 1
        intercept_grads : list, length = n_layers - 1
        r   log_lossr=   binary_log_loss      ?r   r#   )rk   rr   r]   rn   r&   r/   r.   r,   dotr@   rc   r   r%   r9   rb   r   r|   )r^   rx   r   ro   r   r   r   r   loss_func_namer]   valuesslastinplace_derivativerh   s                  r2   r   z"BaseMultilayerPerceptron._backprop  s   H GGAJ	 ((5 Z'D,@,@J,N.Nn-aRA 	#A	AbffQl"F	# 	tzz!V+i77 ~~! #2*t 	)[&*o	
 )9t~~)1b1 	A+F1It{{1~7G7GHF1q5M{1~va!e}=##Ay+vz?		 Z00r`   c                    d| _         d| _        |j                  d   | _        t	        |      | _        t        |       sd| _        n(| j                  j                  dk(  rd| _        nd| _        g | _
        g | _        t        | j
                  dz
        D ]W  }| j                  ||   ||dz      |      \  }}| j                  j                  |       | j                  j                  |       Y | j                  D cg c]  }|j                          c}| _        | j                  D cg c]  }|j                          c}| _        | j$                  t&        v rcg | _        d| _        | j,                  r%g | _        t0        j2                   | _        d | _        y t0        j2                  | _        d | _        d | _        y y c c}w c c}w )Nr   r#   r<   
multiclasssoftmaxr=   )n_iter_t_rk   
n_outputs_lenrc   r   rn   _label_binarizery_type_r/   r0   rb   
_init_coefappendcopy_best_coefs_best_interceptsr>   _STOCHASTIC_SOLVERSloss_curve__no_improvement_countrS   validation_scores_r,   infbest_validation_score_
best_loss_)r^   r   layer_unitsdtyperh   	coef_initintercept_initcs           r2   _initializez$BaseMultilayerPerceptron._initializel  s    ''!* [) T"#-D ""**l:#,D  $.D  t~~)* 	4A(,AAE 2E)%I~ KKy)##N3	4 /3kk:AFFH:373C3C Da D;;--!D)*D&""*,'/1vvg+"&"$&&*.'.2+ . ; Ds   <F>)Gc                 .   d}| j                   dk(  rd}t        j                  |||z   z        }| j                  j	                  | |||f      }| j                  j	                  | ||      }|j                  |d      }|j                  |d      }||fS )Ng      @r=   g       @F)r   )r9   r,   sqrt_random_stateuniformastype)r^   fan_infan_outr   factor
init_boundr   r   s           r2   r   z#BaseMultilayerPerceptron._init_coef  s     ??j(FWWVv'789
 &&..Kfg%6
	 ++33ZKWU$$U$7	'..u5.A.((r`   c           
         | j                   }t        |d      s|g}t        |      }t        j                  t        j
                  |      dk        rt        d|z        t        | d       xs | j                   xr | }| j                  ||||      \  }}|j                  \  }}|j                  dk(  r|j                  d      }|j                  d   | _        |g|z   | j                  gz   }t        | j                        | _        |r| j!                  |||j"                         |gd gt%        |      dz
  z  z   }	d gt%        |	      dz
  z  }
t'        |d d |dd        D cg c](  \  }}t        j(                  ||f|j"                  	      * }}}|dd  D cg c]#  }t        j(                  ||j"                  	      % }}| j*                  t,        v r| j/                  |||	|
||||       n&| j*                  d
k(  r| j1                  |||	|
|||       t3        | j4                  | j6                        }t9        d |D              st        d      | S c c}}w c c}w )N__iter__r   z'hidden_layer_sizes must be > 0, got %s.r/   )rw   r#   )r   r#   r   r   r?   c              3   b   K   | ]'  }t        j                  |      j                          ) y wr\   )r,   isfiniteall).0ws     r2   	<genexpr>z0BaseMultilayerPerceptron._fit.<locals>.<genexpr>  s!     9A2;;q>%%'9s   -/zrSolver produced non-finite parameter weights. The input data may contain large values and need to be preprocessed.)r6   hasattrlistr,   anyarray
ValueErrorrO   _validate_inputrk   ndimre   r   r   rL   r   r   r   r   zipemptyr>   r   _fit_stochastic
_fit_lbfgsr   r/   r0   r   )r^   rx   r   incrementalr6   
first_passr   
n_featuresr   ro   r   	n_fan_in_
n_fan_out_r   r   weightss                   r2   _fitzBaseMultilayerPerceptron._fit  s   !44):6"4!5!"4566"((-.!349<NN  !x00 
3O 	 ##Aq+Z#H1 !	: 66Q;		'"A''!*!l%774??:KK 00A0ABQQWW5 cTFc+&6&:;;3{+a/0 *-["-={12)O
%	: HHi,AGG<

 
 CNab/
4>BHHZqww/
 

 ;;--  	 [[G#OO1k6:
 T%5%56999E 
 I


s   &-I(Ic                    g | _         g | _        d}t        | j                  dz
        D ]9  }	||	   ||	dz      }}
||
|z  z   }| j                   j	                  |||
|ff       |}; t        | j                  dz
        D ],  }	|||	dz      z   }| j                  j	                  ||f       |}. t        | j                  | j                        }| j                  du s| j                  dk\  rd}nd}t        j                  j                  | j                  |dd| j                  | j                  || j                  d||||||f      }t!        d|| j                        | _        |j$                  | _        | j)                  |j*                         y )	Nr   r#   Tr   zL-BFGS-B)maxfunmaxiteriprintgtol)methodjacoptionsargsr?   )rd   rf   rb   rc   r   r3   r/   r0   rN   scipyoptimizeminimizer   rY   rJ   rM   r    r   funloss_rl   x)r^   rx   r   ro   r   r   r   r   ri   rh   n_fan_in	n_fan_outrj   r   r   opt_ress                   r2   r   z#BaseMultilayerPerceptron._fit_lbfgs  s    !# t~~)* 	A"-a.+a!e2DiH8i/0C$$eS8Y2G%HIE	 t~~)* 	A+a!e,,C""))5#,7E	 "$++t/?/?@<<44<<1#4FF..))!!,,== 	 QVZI * 
 .gwN[[
WYYr`   c	           
      t	   | j                   | j                  z   }	|rt        | d      s| j                  dk(  rHt	        |	| j
                  | j                  | j                  | j                  | j                        | _
        nK| j                  dk(  r<t        |	| j
                  | j                  | j                  | j                        | _
        | j                  r|rt!        d      | j                  }
|
rrt#        |       xr | j$                  dk(  }|r|nd }t'        ||| j(                  | j*                  |      \  }}}}t#        |       r | j,                  j/                  |      }nd }d }|j0                  d   }t3        j4                  |t6              }| j8                  d	k(  rt;        d
|      }nE| j8                  |kD  rt=        j>                  d       t3        j@                  | j8                  d|      }	 d| _!        tE        | jF                        D ]]  }| jH                  rtI        || j(                        }d}tK        ||      D ]  }| jH                  rtM        |||         }|||      }n
||   }||   }||d<   | jO                  ||||||      \  }}}|||jP                  |jR                  z
  z  z  }||z   }| j                  jU                  |	|        | xjB                  dz  c_!        ||j0                  d   z  | _+        | xjX                  |z  c_,        | jZ                  j]                  | jV                         | j^                  r$ta        d| jB                  | jV                  fz         | jc                  |
||       | j                  je                  | jX                         | jf                  | jh                  kD  rj|
rd| jj                  | jh                  fz  }nd| jj                  | jh                  fz  }| j                  jm                  || j^                        }|r nPd| _3        |r nE| jB                  | jF                  k(  s7t=        j>                  d| jF                  z  tn               ` |
r#| jr                  | _         | jt                  | _        y y # tp        $ r t=        j>                  d       Y Fw xY w)N
_optimizerr)   r*   z0partial_fit does not support early_stopping=Truer#   )rL   	test_sizestratifyr   r   rB      zRGot `batch_size` less than 1 or larger than sample size. It is going to be clipped)rL   g        zIteration %d, loss = %.8fzLValidation score did not improve more than tol=%f for %d consecutive epochs.zITraining loss did not improve more than tol=%f for %d consecutive epochs.z`Stochastic Optimizer: Maximum iterations (%d) reached and the optimization hasn't converged yet.zTraining interrupted by user.);r/   r0   r   r>   r(   rG   rC   rP   rR   rI   r   r'   rU   rV   rW   rS   r   r   r   r   r   rT   r   inverse_transformrk   r,   arangeintrA   minwarningswarnclipr   rb   rJ   r   r   r   r   stopri   update_paramsr   r   r   r   rN   print_update_no_improvement_countiteration_endsr   rX   rM   trigger_stoppingr   KeyboardInterruptr   r   )r^   rx   r   ro   r   r   r   r   r   paramsrS   should_stratifyr   X_valy_valr   
sample_idxrA   itaccumulated_lossbatch_sliceX_batchy_batch
batch_lossgradsmsgis_stoppings                              r2   r   z(BaseMultilayerPerceptron._fit_stochastic&  s\    t///'$"={{e#".++&&MM++LL# &"/++KKKKLL# ;OPP,,+D1Jdoo6JO+qH!1!//22!"Aua T"--??FEEGGAJ	YYy4
??f$S),J*= !Y?JS	;DLDMM* O<< ")$BTBT!UJ#& #.y*#E AK||"0J{4K"L"#J{$;"<"#K."#K.%,KN>Bnn#"'?;J
O %
#((;+<+<<) $
 '8EOO11&%@/A2 !-
:
9$  ''

3<<5tzz8RRS 11.%O ..tww7--0E0EE &@#xx)>)>?@ :#xx)>)>?@  #'//"B"B3"UK"562<<4==0MMM--( +	UOf **DK#44D  ! 	;MM9:	;s   3IR *R R76R7c                 (   |r| j                  ||      }| j                  j                  |       | j                  rt	        d| j                  d   z         | j                  d   }|| j
                  | j                  z   k  r| xj                  dz  c_        nd| _        || j
                  kD  rb|| _        | j                  D cg c]  }|j                          c}| _
        | j                  D cg c]  }|j                          c}| _        y y | j                  d   | j                  | j                  z
  kD  r| xj                  dz  c_        nd| _        | j                  d   | j                  k  r| j                  d   | _        y y c c}w c c}w )NzValidation score: %fr   r#   r   )_scorer   r   rN   r   r   rM   r   r/   r   r   r0   r   r   r   )r^   rS   r   r   	val_scorelast_valid_scorer   rh   s           r2   r   z5BaseMultilayerPerceptron._update_no_improvement_count  sU   E51I##**95||,t/F/Fr/JJK  $66r:4#>#>#IJ**a/*-.*$"="==.>+6:kk#BAFFH#B ;?;K;K(La(L% >
 #doo&@@**a/*-.*#doo5"&"2"22"6 6 $C(Ls   F
1Fprefer_skip_nested_validationc                 *    | j                  ||d      S )a  Fit the model to data matrix X and target(s) y.

        Parameters
        ----------
        X : ndarray or sparse matrix of shape (n_samples, n_features)
            The input data.

        y : ndarray of shape (n_samples,) or (n_samples, n_outputs)
            The target values (class labels in classification, real numbers in
            regression).

        Returns
        -------
        self : object
            Returns a trained MLP model.
        Fr   r   r^   rx   r   s      r2   fitzBaseMultilayerPerceptron.fit  s    $ yyA5y11r`   c                 X    | j                   t        vrt        d| j                   z        y)NzNpartial_fit is only available for stochastic optimizers. %s is not stochastic.T)r>   r   AttributeError)r^   s    r2   _check_solverz&BaseMultilayerPerceptron._check_solver  s3    ;;11 57;{{C  r`   c                     | j                  |d      }t        j                  |      j                         s#t        j                  |      j                         rt        j
                  S  |||      S )z.Private score method without input validation.Fry   )_predictr,   isnanr   isinfnan)r^   rx   r   score_functiony_preds        r2   _score_with_functionz-BaseMultilayerPerceptron._score_with_function  sU     qe488F!RXXf%5%9%9%;66Ma((r`   T)F) __name__
__module____qualname____doc__r   r   r   r   r   r,   r   rZ   dict__annotations__r   r_   rl   rr   rz   r   r   r   r   r   r   r   r   r   r   r  r  r   r`   r2   r5   r5   5   s   !$Xq$v6
!$
 	z"JKL!$ 	:678!$ 	(4D89!$ 	x Xq$v6
!$ 	*%KLM!$ 	xaiHI!$ 	HT1d6:;!$ 	Xh4?@!$  	I;!!$" 	(#!$$ 	q$v67%!$& 	I;'!$( 	yk)!$* 	XdAq89+!$, 	yk-!$. 	9+/!$0 !)q!F CDD!Qv67D!Qv67T1d9=>Xq$v6D266(#
 Xq$v>?A!$D !F 2 2h?2#J;0dM1^,3\)"JX- ^Y5v7> 52 62&)r`   r5   )	metaclassc                        e Zd ZdZ	 	 ddddddddd	d
ddddd	dddddddd fdZd Zd ZddZ fdZ e	d        e
d	      d d              Zd Zd Z fdZ xZS )!MLPClassifiera+  Multi-layer Perceptron classifier.

    This model optimizes the log-loss function using LBFGS or stochastic
    gradient descent.

    .. versionadded:: 0.18

    Parameters
    ----------
    hidden_layer_sizes : array-like of shape(n_layers - 2,), default=(100,)
        The ith element represents the number of neurons in the ith
        hidden layer.

    activation : {'identity', 'logistic', 'tanh', 'relu'}, default='relu'
        Activation function for the hidden layer.

        - 'identity', no-op activation, useful to implement linear bottleneck,
          returns f(x) = x

        - 'logistic', the logistic sigmoid function,
          returns f(x) = 1 / (1 + exp(-x)).

        - 'tanh', the hyperbolic tan function,
          returns f(x) = tanh(x).

        - 'relu', the rectified linear unit function,
          returns f(x) = max(0, x)

    solver : {'lbfgs', 'sgd', 'adam'}, default='adam'
        The solver for weight optimization.

        - 'lbfgs' is an optimizer in the family of quasi-Newton methods.

        - 'sgd' refers to stochastic gradient descent.

        - 'adam' refers to a stochastic gradient-based optimizer proposed
          by Kingma, Diederik, and Jimmy Ba

        For a comparison between Adam optimizer and SGD, see
        :ref:`sphx_glr_auto_examples_neural_networks_plot_mlp_training_curves.py`.

        Note: The default solver 'adam' works pretty well on relatively
        large datasets (with thousands of training samples or more) in terms of
        both training time and validation score.
        For small datasets, however, 'lbfgs' can converge faster and perform
        better.

    alpha : float, default=0.0001
        Strength of the L2 regularization term. The L2 regularization term
        is divided by the sample size when added to the loss.

        For an example usage and visualization of varying regularization, see
        :ref:`sphx_glr_auto_examples_neural_networks_plot_mlp_alpha.py`.

    batch_size : int, default='auto'
        Size of minibatches for stochastic optimizers.
        If the solver is 'lbfgs', the classifier will not use minibatch.
        When set to "auto", `batch_size=min(200, n_samples)`.

    learning_rate : {'constant', 'invscaling', 'adaptive'}, default='constant'
        Learning rate schedule for weight updates.

        - 'constant' is a constant learning rate given by
          'learning_rate_init'.

        - 'invscaling' gradually decreases the learning rate at each
          time step 't' using an inverse scaling exponent of 'power_t'.
          effective_learning_rate = learning_rate_init / pow(t, power_t)

        - 'adaptive' keeps the learning rate constant to
          'learning_rate_init' as long as training loss keeps decreasing.
          Each time two consecutive epochs fail to decrease training loss by at
          least tol, or fail to increase validation score by at least tol if
          'early_stopping' is on, the current learning rate is divided by 5.

        Only used when ``solver='sgd'``.

    learning_rate_init : float, default=0.001
        The initial learning rate used. It controls the step-size
        in updating the weights. Only used when solver='sgd' or 'adam'.

    power_t : float, default=0.5
        The exponent for inverse scaling learning rate.
        It is used in updating effective learning rate when the learning_rate
        is set to 'invscaling'. Only used when solver='sgd'.

    max_iter : int, default=200
        Maximum number of iterations. The solver iterates until convergence
        (determined by 'tol') or this number of iterations. For stochastic
        solvers ('sgd', 'adam'), note that this determines the number of epochs
        (how many times each data point will be used), not the number of
        gradient steps.

    shuffle : bool, default=True
        Whether to shuffle samples in each iteration. Only used when
        solver='sgd' or 'adam'.

    random_state : int, RandomState instance, default=None
        Determines random number generation for weights and bias
        initialization, train-test split if early stopping is used, and batch
        sampling when solver='sgd' or 'adam'.
        Pass an int for reproducible results across multiple function calls.
        See :term:`Glossary <random_state>`.

    tol : float, default=1e-4
        Tolerance for the optimization. When the loss or score is not improving
        by at least ``tol`` for ``n_iter_no_change`` consecutive iterations,
        unless ``learning_rate`` is set to 'adaptive', convergence is
        considered to be reached and training stops.

    verbose : bool, default=False
        Whether to print progress messages to stdout.

    warm_start : bool, default=False
        When set to True, reuse the solution of the previous
        call to fit as initialization, otherwise, just erase the
        previous solution. See :term:`the Glossary <warm_start>`.

    momentum : float, default=0.9
        Momentum for gradient descent update. Should be between 0 and 1. Only
        used when solver='sgd'.

    nesterovs_momentum : bool, default=True
        Whether to use Nesterov's momentum. Only used when solver='sgd' and
        momentum > 0.

    early_stopping : bool, default=False
        Whether to use early stopping to terminate training when validation
        score is not improving. If set to true, it will automatically set
        aside 10% of training data as validation and terminate training when
        validation score is not improving by at least ``tol`` for
        ``n_iter_no_change`` consecutive epochs. The split is stratified,
        except in a multilabel setting.
        If early stopping is False, then the training stops when the training
        loss does not improve by more than tol for n_iter_no_change consecutive
        passes over the training set.
        Only effective when solver='sgd' or 'adam'.

    validation_fraction : float, default=0.1
        The proportion of training data to set aside as validation set for
        early stopping. Must be between 0 and 1.
        Only used if early_stopping is True.

    beta_1 : float, default=0.9
        Exponential decay rate for estimates of first moment vector in adam,
        should be in [0, 1). Only used when solver='adam'.

    beta_2 : float, default=0.999
        Exponential decay rate for estimates of second moment vector in adam,
        should be in [0, 1). Only used when solver='adam'.

    epsilon : float, default=1e-8
        Value for numerical stability in adam. Only used when solver='adam'.

    n_iter_no_change : int, default=10
        Maximum number of epochs to not meet ``tol`` improvement.
        Only effective when solver='sgd' or 'adam'.

        .. versionadded:: 0.20

    max_fun : int, default=15000
        Only used when solver='lbfgs'. Maximum number of loss function calls.
        The solver iterates until convergence (determined by 'tol'), number
        of iterations reaches max_iter, or this number of loss function calls.
        Note that number of loss function calls will be greater than or equal
        to the number of iterations for the `MLPClassifier`.

        .. versionadded:: 0.22

    Attributes
    ----------
    classes_ : ndarray or list of ndarray of shape (n_classes,)
        Class labels for each output.

    loss_ : float
        The current loss computed with the loss function.

    best_loss_ : float or None
        The minimum loss reached by the solver throughout fitting.
        If `early_stopping=True`, this attribute is set to `None`. Refer to
        the `best_validation_score_` fitted attribute instead.

    loss_curve_ : list of shape (`n_iter_`,)
        The ith element in the list represents the loss at the ith iteration.

    validation_scores_ : list of shape (`n_iter_`,) or None
        The score at each iteration on a held-out validation set. The score
        reported is the accuracy score. Only available if `early_stopping=True`,
        otherwise the attribute is set to `None`.

    best_validation_score_ : float or None
        The best validation score (i.e. accuracy score) that triggered the
        early stopping. Only available if `early_stopping=True`, otherwise the
        attribute is set to `None`.

    t_ : int
        The number of training samples seen by the solver during fitting.

    coefs_ : list of shape (n_layers - 1,)
        The ith element in the list represents the weight matrix corresponding
        to layer i.

    intercepts_ : list of shape (n_layers - 1,)
        The ith element in the list represents the bias vector corresponding to
        layer i + 1.

    n_features_in_ : int
        Number of features seen during :term:`fit`.

        .. versionadded:: 0.24

    feature_names_in_ : ndarray of shape (`n_features_in_`,)
        Names of features seen during :term:`fit`. Defined only when `X`
        has feature names that are all strings.

        .. versionadded:: 1.0

    n_iter_ : int
        The number of iterations the solver has run.

    n_layers_ : int
        Number of layers.

    n_outputs_ : int
        Number of outputs.

    out_activation_ : str
        Name of the output activation function.

    See Also
    --------
    MLPRegressor : Multi-layer Perceptron regressor.
    BernoulliRBM : Bernoulli Restricted Boltzmann Machine (RBM).

    Notes
    -----
    MLPClassifier trains iteratively since at each time step
    the partial derivatives of the loss function with respect to the model
    parameters are computed to update the parameters.

    It can also have a regularization term added to the loss function
    that shrinks model parameters to prevent overfitting.

    This implementation works with data represented as dense numpy arrays or
    sparse scipy arrays of floating point values.

    References
    ----------
    Hinton, Geoffrey E. "Connectionist learning procedures."
    Artificial intelligence 40.1 (1989): 185-234.

    Glorot, Xavier, and Yoshua Bengio.
    "Understanding the difficulty of training deep feedforward neural networks."
    International Conference on Artificial Intelligence and Statistics. 2010.

    :arxiv:`He, Kaiming, et al (2015). "Delving deep into rectifiers:
    Surpassing human-level performance on imagenet classification." <1502.01852>`

    :arxiv:`Kingma, Diederik, and Jimmy Ba (2014)
    "Adam: A method for stochastic optimization." <1412.6980>`

    Examples
    --------
    >>> from sklearn.neural_network import MLPClassifier
    >>> from sklearn.datasets import make_classification
    >>> from sklearn.model_selection import train_test_split
    >>> X, y = make_classification(n_samples=100, random_state=1)
    >>> X_train, X_test, y_train, y_test = train_test_split(X, y, stratify=y,
    ...                                                     random_state=1)
    >>> clf = MLPClassifier(random_state=1, max_iter=300).fit(X_train, y_train)
    >>> clf.predict_proba(X_test[:1])
    array([[0.038..., 0.961...]])
    >>> clf.predict(X_test[:5, :])
    array([1, 0, 1, 0, 1])
    >>> clf.score(X_test, y_test)
    0.8...
    r*   -C6?rB   rE   MbP?r   r   TNF?皙?+?:0yE>
   :  r>   r@   rA   rC   rG   rI   rJ   r   rL   rM   rN   rO   rP   rR   rS   rT   rU   rV   rW   rX   rY   c                T    t         |   |||||||||	d|
|||||||||||||       y )Nr   r6   r9   r>   r@   rA   rC   rG   rI   rJ   r]   r   rL   rM   rN   rO   rP   rR   rS   rT   rU   rV   rW   rX   rY   superr_   r^   r6   r9   r>   r@   rA   rC   rG   rI   rJ   r   rL   rM   rN   rO   rP   rR   rS   rT   rU   rV   rW   rX   rY   	__class__s                           r2   r_   zMLPClassifier.__init__  s_    6 	1!!'1%!1) 3-1 	 	
r`   c           	          t        | ||ddgdt        j                  t        j                  f|      \  }}|j                  dk(  r|j
                  d   dk(  rt        |d      }t        | d      r| j                  sH|sFt               | _
        | j                  j                  |       | j                  j                  | _        nt        |      }| j                  r<t        |      t        | j                        k7  rbt        d	| j                   d
|       t!        t        j"                  || j                  d            rt        d| j                   d| d      | j                  j%                  |      j'                  t(              }||fS )Nrt   ru   T)rv   multi_outputr   rw   r   r#   r   classes_zjwarm_start can only be used where `y` has the same classes as in the previous call to fit. Previously got z
, `y` has )assume_uniquez<`y` has classes not in `self.classes_`. `self.classes_` has z
. 'y' has .)r"   r,   float64float32r   rk   r   r   rO   r   r   r  r;  r   setr   r   	setdiff1d	transformr   bool)r^   rx   r   r   rw   classess         r2   r   zMLPClassifier._validate_inputT  s`    %.::rzz*
1 66Q;1771:?QT*A( j)4??;$2$4D!!!%%a( 11::DM#A&Gw<3t}}#55$#}}oZyB 
 R\\'4==MN ++/==/G9AO  !!++A.55d;!tr`   c                 :    t        |        | j                  |      S )aO  Predict using the multi-layer perceptron classifier.

        Parameters
        ----------
        X : {array-like, sparse matrix} of shape (n_samples, n_features)
            The input data.

        Returns
        -------
        y : ndarray, shape (n_samples,) or (n_samples, n_classes)
            The predicted classes.
        r!   r  r^   rx   s     r2   predictzMLPClassifier.predict       	}}Qr`   c                     | j                  ||      }| j                  dk(  r|j                         }| j                  j	                  |      S z5Private predict method with optional input validationr  r#   )rz   r   r.   r   r   r^   rx   ry   r  s       r2   r  zMLPClassifier._predict  sE    (((D??a\\^F$$66v>>r`   c                 0    t         |   ||t              S N)r  )r5  r  r   r^   rx   r   r7  s      r2   r  zMLPClassifier._score  s    w+Aq+PPr`   c                 "    | j                         S r\   r  ests    r2   <lambda>zMLPClassifier.<lambda>  s    c//1 r`   r  c                    t        | |      r`t               | _        t        |      j	                  d      r| j                  j                  |       n| j                  j                  |       | j                  ||d      S )a(  Update the model with a single iteration over the given data.

        Parameters
        ----------
        X : {array-like, sparse matrix} of shape (n_samples, n_features)
            The input data.

        y : array-like of shape (n_samples,)
            The target values.

        classes : array of shape (n_classes,), default=None
            Classes across all calls to partial_fit.
            Can be obtained via `np.unique(y_all)`, where y_all is the
            target vector of the entire dataset.
            This argument is required for the first call to partial_fit
            and can be omitted in the subsequent calls.
            Note that y doesn't need to contain all labels in `classes`.

        Returns
        -------
        self : object
            Trained MLP model.
        
multilabelTr  )r   r   r   r   
startswithr  r   )r^   rx   r   rD  s       r2   partial_fitzMLPClassifier.partial_fit  si    4 )w7$2$4D!a ++L9%%))!,%%))'2yyA4y00r`   c                 R    | j                  |      }t        j                  ||      S )a  Return the log of probability estimates.

        Parameters
        ----------
        X : ndarray of shape (n_samples, n_features)
            The input data.

        Returns
        -------
        log_y_prob : ndarray of shape (n_samples, n_classes)
            The predicted log-probability of the sample for each class
            in the model, where classes are ordered as they are in
            `self.classes_`. Equivalent to `log(predict_proba(X))`.
        )out)predict_probar,   log)r^   rx   y_probs      r2   predict_log_probazMLPClassifier.predict_log_proba  s%     ##A&vvf&))r`   c                     t        |        | j                  |      }| j                  dk(  r|j                         }|j                  dk(  r$t        j                  d|z
  |g      j                  S |S )a  Probability estimates.

        Parameters
        ----------
        X : {array-like, sparse matrix} of shape (n_samples, n_features)
            The input data.

        Returns
        -------
        y_prob : ndarray of shape (n_samples, n_classes)
            The predicted probability of the sample for each class in the
            model, where classes are ordered as they are in `self.classes_`.
        r#   )r!   rz   r   r.   r   r,   vstackr|   )r^   rx   r  s      r2   r[  zMLPClassifier.predict_proba  sb     	((+??a\\^F;;!99a&j&12444Mr`   c                 F    t         |          }d|j                  _        |S )NT)r5  __sklearn_tags__classifier_tagsmulti_label)r^   tagsr7  s     r2   rb  zMLPClassifier.__sklearn_tags__  s#    w')+/(r`   )d   r:   r  r\   )r  r   r!  r"  r_   r   rH  r  r  r   r   rX  r^  r[  rb  __classcell__r7  s   @r2   r(  r(    s    Tp "4

   34
l5n  ?Q 1251 6 31B*$2 r`   r(  c                        e Zd ZdZ	 	 ddddddddd	d
ddddd	dddddddd fdZd ZddZ fdZd Z e	d        e
d	      d               Z xZS )MLPRegressora+  Multi-layer Perceptron regressor.

    This model optimizes the squared error using LBFGS or stochastic gradient
    descent.

    .. versionadded:: 0.18

    Parameters
    ----------
    hidden_layer_sizes : array-like of shape(n_layers - 2,), default=(100,)
        The ith element represents the number of neurons in the ith
        hidden layer.

    activation : {'identity', 'logistic', 'tanh', 'relu'}, default='relu'
        Activation function for the hidden layer.

        - 'identity', no-op activation, useful to implement linear bottleneck,
          returns f(x) = x

        - 'logistic', the logistic sigmoid function,
          returns f(x) = 1 / (1 + exp(-x)).

        - 'tanh', the hyperbolic tan function,
          returns f(x) = tanh(x).

        - 'relu', the rectified linear unit function,
          returns f(x) = max(0, x)

    solver : {'lbfgs', 'sgd', 'adam'}, default='adam'
        The solver for weight optimization.

        - 'lbfgs' is an optimizer in the family of quasi-Newton methods.

        - 'sgd' refers to stochastic gradient descent.

        - 'adam' refers to a stochastic gradient-based optimizer proposed by
          Kingma, Diederik, and Jimmy Ba

        For a comparison between Adam optimizer and SGD, see
        :ref:`sphx_glr_auto_examples_neural_networks_plot_mlp_training_curves.py`.

        Note: The default solver 'adam' works pretty well on relatively
        large datasets (with thousands of training samples or more) in terms of
        both training time and validation score.
        For small datasets, however, 'lbfgs' can converge faster and perform
        better.

    alpha : float, default=0.0001
        Strength of the L2 regularization term. The L2 regularization term
        is divided by the sample size when added to the loss.

    batch_size : int, default='auto'
        Size of minibatches for stochastic optimizers.
        If the solver is 'lbfgs', the regressor will not use minibatch.
        When set to "auto", `batch_size=min(200, n_samples)`.

    learning_rate : {'constant', 'invscaling', 'adaptive'}, default='constant'
        Learning rate schedule for weight updates.

        - 'constant' is a constant learning rate given by
          'learning_rate_init'.

        - 'invscaling' gradually decreases the learning rate ``learning_rate_``
          at each time step 't' using an inverse scaling exponent of 'power_t'.
          effective_learning_rate = learning_rate_init / pow(t, power_t)

        - 'adaptive' keeps the learning rate constant to
          'learning_rate_init' as long as training loss keeps decreasing.
          Each time two consecutive epochs fail to decrease training loss by at
          least tol, or fail to increase validation score by at least tol if
          'early_stopping' is on, the current learning rate is divided by 5.

        Only used when solver='sgd'.

    learning_rate_init : float, default=0.001
        The initial learning rate used. It controls the step-size
        in updating the weights. Only used when solver='sgd' or 'adam'.

    power_t : float, default=0.5
        The exponent for inverse scaling learning rate.
        It is used in updating effective learning rate when the learning_rate
        is set to 'invscaling'. Only used when solver='sgd'.

    max_iter : int, default=200
        Maximum number of iterations. The solver iterates until convergence
        (determined by 'tol') or this number of iterations. For stochastic
        solvers ('sgd', 'adam'), note that this determines the number of epochs
        (how many times each data point will be used), not the number of
        gradient steps.

    shuffle : bool, default=True
        Whether to shuffle samples in each iteration. Only used when
        solver='sgd' or 'adam'.

    random_state : int, RandomState instance, default=None
        Determines random number generation for weights and bias
        initialization, train-test split if early stopping is used, and batch
        sampling when solver='sgd' or 'adam'.
        Pass an int for reproducible results across multiple function calls.
        See :term:`Glossary <random_state>`.

    tol : float, default=1e-4
        Tolerance for the optimization. When the loss or score is not improving
        by at least ``tol`` for ``n_iter_no_change`` consecutive iterations,
        unless ``learning_rate`` is set to 'adaptive', convergence is
        considered to be reached and training stops.

    verbose : bool, default=False
        Whether to print progress messages to stdout.

    warm_start : bool, default=False
        When set to True, reuse the solution of the previous
        call to fit as initialization, otherwise, just erase the
        previous solution. See :term:`the Glossary <warm_start>`.

    momentum : float, default=0.9
        Momentum for gradient descent update. Should be between 0 and 1. Only
        used when solver='sgd'.

    nesterovs_momentum : bool, default=True
        Whether to use Nesterov's momentum. Only used when solver='sgd' and
        momentum > 0.

    early_stopping : bool, default=False
        Whether to use early stopping to terminate training when validation
        score is not improving. If set to True, it will automatically set
        aside ``validation_fraction`` of training data as validation and
        terminate training when validation score is not improving by at
        least ``tol`` for ``n_iter_no_change`` consecutive epochs.
        Only effective when solver='sgd' or 'adam'.

    validation_fraction : float, default=0.1
        The proportion of training data to set aside as validation set for
        early stopping. Must be between 0 and 1.
        Only used if early_stopping is True.

    beta_1 : float, default=0.9
        Exponential decay rate for estimates of first moment vector in adam,
        should be in [0, 1). Only used when solver='adam'.

    beta_2 : float, default=0.999
        Exponential decay rate for estimates of second moment vector in adam,
        should be in [0, 1). Only used when solver='adam'.

    epsilon : float, default=1e-8
        Value for numerical stability in adam. Only used when solver='adam'.

    n_iter_no_change : int, default=10
        Maximum number of epochs to not meet ``tol`` improvement.
        Only effective when solver='sgd' or 'adam'.

        .. versionadded:: 0.20

    max_fun : int, default=15000
        Only used when solver='lbfgs'. Maximum number of function calls.
        The solver iterates until convergence (determined by ``tol``), number
        of iterations reaches max_iter, or this number of function calls.
        Note that number of function calls will be greater than or equal to
        the number of iterations for the MLPRegressor.

        .. versionadded:: 0.22

    Attributes
    ----------
    loss_ : float
        The current loss computed with the loss function.

    best_loss_ : float
        The minimum loss reached by the solver throughout fitting.
        If `early_stopping=True`, this attribute is set to `None`. Refer to
        the `best_validation_score_` fitted attribute instead.
        Only accessible when solver='sgd' or 'adam'.

    loss_curve_ : list of shape (`n_iter_`,)
        Loss value evaluated at the end of each training step.
        The ith element in the list represents the loss at the ith iteration.
        Only accessible when solver='sgd' or 'adam'.

    validation_scores_ : list of shape (`n_iter_`,) or None
        The score at each iteration on a held-out validation set. The score
        reported is the R2 score. Only available if `early_stopping=True`,
        otherwise the attribute is set to `None`.
        Only accessible when solver='sgd' or 'adam'.

    best_validation_score_ : float or None
        The best validation score (i.e. R2 score) that triggered the
        early stopping. Only available if `early_stopping=True`, otherwise the
        attribute is set to `None`.
        Only accessible when solver='sgd' or 'adam'.

    t_ : int
        The number of training samples seen by the solver during fitting.
        Mathematically equals `n_iters * X.shape[0]`, it means
        `time_step` and it is used by optimizer's learning rate scheduler.

    coefs_ : list of shape (n_layers - 1,)
        The ith element in the list represents the weight matrix corresponding
        to layer i.

    intercepts_ : list of shape (n_layers - 1,)
        The ith element in the list represents the bias vector corresponding to
        layer i + 1.

    n_features_in_ : int
        Number of features seen during :term:`fit`.

        .. versionadded:: 0.24

    feature_names_in_ : ndarray of shape (`n_features_in_`,)
        Names of features seen during :term:`fit`. Defined only when `X`
        has feature names that are all strings.

        .. versionadded:: 1.0

    n_iter_ : int
        The number of iterations the solver has run.

    n_layers_ : int
        Number of layers.

    n_outputs_ : int
        Number of outputs.

    out_activation_ : str
        Name of the output activation function.

    See Also
    --------
    BernoulliRBM : Bernoulli Restricted Boltzmann Machine (RBM).
    MLPClassifier : Multi-layer Perceptron classifier.
    sklearn.linear_model.SGDRegressor : Linear model fitted by minimizing
        a regularized empirical loss with SGD.

    Notes
    -----
    MLPRegressor trains iteratively since at each time step
    the partial derivatives of the loss function with respect to the model
    parameters are computed to update the parameters.

    It can also have a regularization term added to the loss function
    that shrinks model parameters to prevent overfitting.

    This implementation works with data represented as dense and sparse numpy
    arrays of floating point values.

    References
    ----------
    Hinton, Geoffrey E. "Connectionist learning procedures."
    Artificial intelligence 40.1 (1989): 185-234.

    Glorot, Xavier, and Yoshua Bengio.
    "Understanding the difficulty of training deep feedforward neural networks."
    International Conference on Artificial Intelligence and Statistics. 2010.

    :arxiv:`He, Kaiming, et al (2015). "Delving deep into rectifiers:
    Surpassing human-level performance on imagenet classification." <1502.01852>`

    :arxiv:`Kingma, Diederik, and Jimmy Ba (2014)
    "Adam: A method for stochastic optimization." <1412.6980>`

    Examples
    --------
    >>> from sklearn.neural_network import MLPRegressor
    >>> from sklearn.datasets import make_regression
    >>> from sklearn.model_selection import train_test_split
    >>> X, y = make_regression(n_samples=200, n_features=20, random_state=1)
    >>> X_train, X_test, y_train, y_test = train_test_split(X, y,
    ...                                                     random_state=1)
    >>> regr = MLPRegressor(random_state=1, max_iter=2000, tol=0.1)
    >>> regr.fit(X_train, y_train)
    MLPRegressor(max_iter=2000, random_state=1, tol=0.1)
    >>> regr.predict(X_test[:2])
    array([  28..., -290...])
    >>> regr.score(X_test, y_test)
    0.98...
    r*   r)  rB   rE   r*  r   r   TNFr+  r,  r-  r.  r/  r0  r1  c                T    t         |   |||||||||	d|
|||||||||||||       y )Nsquared_errorr3  r4  r6  s                           r2   r_   zMLPRegressor.__init__  s_    6 	1!!'1 %!1) 3-1 	 	
r`   c                 :    t        |        | j                  |      S )a;  Predict using the multi-layer perceptron model.

        Parameters
        ----------
        X : {array-like, sparse matrix} of shape (n_samples, n_features)
            The input data.

        Returns
        -------
        y : ndarray of shape (n_samples, n_outputs)
            The predicted values.
        rF  rG  s     r2   rH  zMLPRegressor.predictG  rI  r`   c                 p    | j                  ||      }|j                  d   dk(  r|j                         S |S rK  )rz   rk   r.   rL  s       r2   r  zMLPRegressor._predictW  s8    (((D<<?a<<>!r`   c                 0    t         |   ||t              S rN  )r5  r  r   rO  s      r2   r  zMLPRegressor._score^  s    w+Aq+JJr`   c           
          t        | ||ddgddt        j                  t        j                  f|      \  }}|j                  dk(  r|j
                  d   dk(  rt        |d      }||fS )Nrt   ru   T)rv   r9  	y_numericr   rw   r   r#   r:  )r"   r,   r>  r?  r   rk   r   )r^   rx   r   r   rw   s        r2   r   zMLPRegressor._validate_inputa  si     %.::rzz*	
1 66Q;1771:?QT*A!tr`   c                     | j                   S r\   rQ  rR  s    r2   rT  zMLPRegressor.<lambda>p  s    c// r`   r  c                 *    | j                  ||d      S )ar  Update the model with a single iteration over the given data.

        Parameters
        ----------
        X : {array-like, sparse matrix} of shape (n_samples, n_features)
            The input data.

        y : ndarray of shape (n_samples,)
            The target values.

        Returns
        -------
        self : object
            Trained MLP model.
        Tr  r  r  s      r2   rX  zMLPRegressor.partial_fitp  s    $ yyA4y00r`   rf  r  )r  r   r!  r"  r_   rH  r  r  r   r   r   rX  rh  ri  s   @r2   rk  rk    s    Sn "4

   34
l  K /051 6 11r`   rk  )@r"  r   abcr   r   	itertoolsr   numbersr   r   numpyr,   scipy.optimizer   baser	   r
   r   r   r   
exceptionsr   metricsr   r   model_selectionr   preprocessingr   utilsr   r   r   r   r   utils._param_validationr   r   r   utils.extmathr   utils.metaestimatorsr   utils.multiclassr   r   r   utils.optimizer    utils.validationr!   r"   _baser$   r%   r&   _stochastic_optimizersr'   r(   r   r3   r5   r(  rk  r%  r`   r2   <module>r     s    
  '  "    , . . *  D C + / 
 4 = ; ; ?fo @
O)} O)dqO%= qhG1>#; G1r`   