Ë
    ý�Dj|  ã                   ón   — d Z ddlZddlZddlmZ ddlmZ h d£Zd„ Z	d„ Z
d„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zy)z�
Arg validation for auto-arima calls. This allows us to test validation more
directly without having to fit numerous combinations of models.
é    N)Úmetrics)ÚModelFitWarning>   ÚaicÚbicÚoobÚaiccÚhqicc                 ó   — | dk(  r|S | S )zCA more concise way to handle the default behavior of with_interceptÚauto© )Úwith_interceptÚdefaults     ú^C:\Crop_Prediction\Backend\crop-ai-system\venv\Lib\site-packages\pmdarima/arima/_validation.pyÚauto_interceptr      s   € à˜ÒØˆØÐó    c                 ó‚   — | t         vrt        d| ›dt         ›�«      ‚| dk(  r|dk(  rd} t        j                  d«       | S )z0Check whether the information criterion is validz0auto_arima not defined for information_criteria=z&. Valid information criteria include: r   r   r   zoinformation_criterion cannot be 'oob' with out_of_sample_size = 0. Falling back to information criterion = aic.)ÚVALID_CRITERIAÚ
ValueErrorÚwarningsÚwarn)Úinformation_criterionÚout_of_sample_sizes     r   Úcheck_information_criterionr      sW   € à¤NÑ2Ýâ1µ>ðCó Dð 	Dð
  Ò%Ð*<ÀÒ*AØ %ÐÜ�‰ð Eô 	Fð !Ð r   c                 ó   — | r| S i S )zîReturn kwargs or an empty dict.

    We often pass named kwargs (like `sarimax_kwargs`) as None by default. This
    is to avoid a mutable default, which can bite you in unexpected ways. This
    will return a kwarg-compatible value.
    r   )Úkwargss    r   Úcheck_kwargsr   *   s   € ñ ØˆØ€Ir   c                 óv   — | dk  r|s| dk  rt        d«      ‚|s| dkD  rt        j                  d| z  «       d} | S )z+Check the value of M (seasonal periodicity)é   r   z"m must be a positive integer (> 0)z-m (%i) set for non-seasonal fit. Setting to 0)r   r   r   )ÚmÚseasonals     r   Úcheck_mr!   6   sC   € à	ˆAŠ‘(˜q 1šuÜÐ=Ó>Ð>áàˆqŠ5Ü�M‰MÐIÈAÑMÔNØˆà€Hr   c                 óH   — | r|dk7  rd}t        j                  d|z  «       |S )z¡Potentially update the n_jobs parameter

    We can't run in parallel with the stepwise algorithm. This checks
    ``n_jobs`` w.r.t. stepwise and will warn.
    r   z`stepwise model cannot be fit in parallel (n_jobs=%i). Falling back to stepwise parameter search.)r   r   )ÚstepwiseÚn_jobss     r   Úcheck_n_jobsr%   D   s3   € ñ �F˜a’KØˆÜ�‰ð CØEKñLô 	Mà€Mr   c                 ó    — |€t         j                  }| €t        d|z  «      ‚| dk  rt        d|z  «      ‚|| k  rt        d|›d|›�«      ‚| |fS )z2Ensure starting points and ending points are validzstart_%s cannot be Noner   zstart_%s must be positiveÚmax_z must be >= start_)ÚnpÚinfr   )ÚstÚmxÚargnames      r   Úcheck_start_max_valuesr-   Q   s^   € à	€zÜ�V‰VˆØ	€zÜÐ2°WÑ<Ó=Ð=Ø	ˆA‚vÜÐ4°wÑ>Ó?Ð?Ø	ˆB‚wÝºÁ'ÐJÓKÐKØˆrˆ6€Mr   c                 óR   — | €yt        | t        t        f«      rt        | «      S | ryy)zCheck the value of tracer   r   )Ú
isinstanceÚintÚbool)Útraces    r   Úcheck_tracer3   ^   s+   € à€}ØÜ�%œ#œt˜Ô%Ü�5‹zÐáØØr   c                 ó  — t        | t        «      r;| dk(  rt        j                  S | dk(  rt        j                  S 	 t        t        | «      S t        | «      st        dt        | «      z  «      ‚| S # t        $ r t        d| z  «      ‚w xY w)a;  Get a scoring metric by name, or passthrough a callable

    Parameters
    ----------
    metric : str or callable
        A name of a scoring metric, or a custom callable function. If it is a
        callable, it must adhere to the signature::

            def func(y_true, y_pred)

        Note that the ARIMA model selection seeks to MINIMIZE the score, and it
        is up to the user to ensure that scoring methods that return maximizing
        criteria (i.e., ``r2_score``) are wrapped in a function that will
        return the negative value of the score.
    ÚmseÚmaez#'%s' is not a valid scoring method.zG`metric` must be a valid scoring method, or a callable, but got type=%s)r/   Ústrr   Úmean_squared_errorÚmean_absolute_errorÚgetattrÚAttributeErrorr   ÚcallableÚ	TypeErrorÚtype)Úmetrics    r   Úget_scoring_metricr@   j   sŸ   € ô  �&œ#Ôð �UŠ?Ü×-Ñ-Ð-Ø�UŠ?Ü×.Ñ.Ð.ð	MÜœ7 FÓ+Ð+ô �FÔÜð 4Ü6:¸6³lñCó Dð 	Dð €Møô ò 	MÜÐBÀVÑKÓLÐLð	Mús   ¼A0 Á0Bc                 ó”   — |dk\  rt        j                  dt        «       y|| z   dkD  s| dkD  rt        j                  dt        «       yy)zWarn for large values of Dé   zqHaving more than one seasonal differences is not recommended. Please consider using only one seasonal difference.zvHaving 3 or more differencing operations is not recommended. Please consider reducing the total number of differences.N)r   r   r   )ÚdÚDs     r   Ú
warn_for_DrE   �   sJ   € àˆA‚vÜ�‰ð -ä.=õ	?ð
 
ˆQ‰�Š�a˜!’eÜ�‰ð /ä0?õ	Að r   )Ú__doc__Únumpyr(   r   Úsklearnr   Úpmdarima.warningsr   r   r   r   r   r!   r%   r-   r3   r@   rE   r   r   r   ú<module>rJ      sN   ðñó
 Û Ý å -ò 7€òò!ò"	òò
ò
ò	ò"óJAr   