
    =y!d                     p    d dl 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  G d d	e	e          Zd
S )    )sklearn_check_version   )BaseSVR   )dispatchwrap_output_data)SVR)_deprecate_positional_argsc                        e Zd ZU ej        Z ed          ri ej        Zeed<   e	ddddddd	d
dddd fd
            Z
ddZed             Zd Zd ZddZddZ xZS )r	   1.2_parameter_constraintsrbf   scaleg        gMbP?g      ?g?T   Fkerneldegreegammacoef0tolCepsilon	shrinking
cache_sizeverbosemax_iterc                `    t                                          |||||||||	|
|           d S )Nr   )super__init__)selfr   r   r   r   r   r   r   r   r   r   r   	__class__s               1lib/python3.11/site-packages/sklearnex/svm/svr.pyr!   zSVR.__init__    sJ     	&UqyZQX 	 	 	 	 	 	    Nc                     t          d          r|                                  t          d          r|                     |d           t          | d| j        j        t          j        d|||           | S )a  
        Fit the SVM model according to the given training data.

        Parameters
        ----------
        X : {array-like, sparse matrix} of shape (n_samples, n_features)                 or (n_samples, n_samples)
            Training vectors, where `n_samples` is the number of samples
            and `n_features` is the number of features.
            For kernel="precomputed", the expected shape of X is
            (n_samples, n_samples).

        y : array-like of shape (n_samples,)
            Target values (class labels in classification, real numbers in
            regression).

        sample_weight : array-like of shape (n_samples,), default=None
            Per-sample weights. Rescale C per sample. Higher weights
            force the classifier to put more emphasis on these points.

        Returns
        -------
        self : object
            Fitted estimator.

        Notes
        -----
        If X and y are not C-ordered and contiguous arrays of np.float64 and
        X is not a scipy.sparse.csr_matrix, X and/or y may be copied.

        If X is a dense array, then the other methods will not support sparse
        matrices as input.
        r   1.0Tresetsvm.SVR.fitonedalsklearn)r   _validate_params_check_feature_namesr   r#   _onedal_fitsklearn_SVRfit)r"   Xysample_weights       r$   r2   zSVR.fit)   s    D !'' 	$!!### '' 	5%%at%444}n0"'
 '
 a	  	  	 
 r%   c                     t          d          r|                     |d           t          | d| j        j        t
          j        d|          S )a  
        Perform regression on samples in X.

        For an one-class model, +1 (inlier) or -1 (outlier) is returned.

        Parameters
        ----------
        X : {array-like, sparse matrix} of shape (n_samples, n_features)
            For kernel="precomputed", the expected shape of X is
            (n_samples_test, n_samples_train).

        Returns
        -------
        y_pred : ndarray of shape (n_samples,)
            The predicted values.
        r'   Fr(   svm.SVR.predictr+   )r   r/   r   r#   _onedal_predictr1   predict)r"   r3   s     r$   r9   zSVR.predictV   sa    $ !'' 	6%%au%555/n4"*2
 2
   	r%   c                     dS )NF r"   method_namedatas      r$   _onedal_gpu_supportedzSVR._onedal_gpu_supportedo   s    ur%   c                 P    |dk    r	| j         dv S |dk    rt          | d          S d S )Nr*   )linearr   polysigmoidr7   _onedal_estimator)r   hasattrr<   s      r$   _onedal_cpu_supportedzSVR._onedal_cpu_supportedr   s@    -'';"FFF+++4!4555 ,+r%   c                 
   | j         | j        | j        | j        | j        | j        | j        | j        | j        | j	        d
}t          di || _        | j                            ||||           |                                  d S )N)
r   r   r   r   r   r   r   r   r   r   queuer;   )r   r   r   r   r   r   r   r   r   r   
onedal_SVRrD   r2   _save_attributes)r"   r3   r4   r5   rI   onedal_paramss         r$   r0   zSVR._onedal_fitx   s    |kkZZ8/
 
 ",!<!<m!<!<""1ae"DDDr%   c                 :    | j                             ||          S )NrH   )rD   r9   )r"   r3   rI   s      r$   r8   zSVR._onedal_predict   s    %--au-===r%   )N)NN)__name__
__module____qualname__r1   __doc__r   r   dict__annotations__r
   r!   r2   r   r9   r?   rF   r0   r8   __classcell__)r#   s   @r$   r	   r	      s        !GU## N'M+*L'MMMM!&qSD       + + + +Z   0  6 6 6       $> > > > > > > >r%   r	   N)daal4py.sklearn._utilsr   _commonr   _device_offloadr   r   sklearn.svmr	   r1   sklearn.utils.validationr
   
onedal.svmrJ   r;   r%   r$   <module>r[      s   " 9 8 8 8 8 8       8 8 8 8 8 8 8 8 * * * * * * ? ? ? ? ? ? ( ( ( ( ( (q> q> q> q> q>+w q> q> q> q> q>r%   