hyb
2025-11-07 cadac0a99d87c53805a07f3b4ca7fd11e524fe4a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
Ë
Wñúh$ãó|—dZddlmZmZddlZddlZddlm    Z    ddl
m Z ddl m Z ddlmZddlmZGd    „d
e e    «Zy) z£Generic transformer utilities for MySQL Connector/Python.
 
Provides a scikit-learn compatible Transformer using HeatWave for fit/transform
and scoring operations.
é)ÚOptionalÚUnionN)ÚTransformerMixin)Ú MyBaseMLModel)ÚML_TASK)Ú    copy_dict)ÚMySQLConnectionAbstractcó(—eZdZdZej
dddddfdedeeefdede    ede    e
d    e    e
d
e    e
fd „Z d e jd e jfd„Zd ee jej fdee jej fd efd„Zy)ÚMyGenericTransformera
    MySQL HeatWave scikit-learn compatible generic transformer.
 
    Can be used as the transformation step in an sklearn pipeline. Implements fit, transform,
    explain, and scoring capability, passing options for server-side transform logic.
 
    Args:
        db_connection (MySQLConnectionAbstract): Active MySQL connector database connection.
        task (str): ML task type for transformer (default: "classification").
        score_metric (str): Scoring metric to request from backend (default: "balanced_accuracy").
        model_name (str, optional): Custom name for the deployed model.
        fit_extra_options (dict, optional): Extra fit options.
        transform_extra_options (dict, optional): Extra options for transformations.
        score_extra_options (dict, optional): Extra options for scoring.
 
    Attributes:
        score_metric (str): Name of the backend metric to use for scoring
            (e.g. "balanced_accuracy").
        score_extra_options (dict): Dictionary of optional scoring parameters;
            passed to backend score.
        transform_extra_options (dict): Dictionary of inference (/predict)
            parameters for the backend.
        fit_extra_options (dict): See MyBaseMLModel.
        _model (MyModel): Underlying interface for database model operations.
 
    Methods:
        fit(X, y): Fit the underlying model using the provided features/targets.
        transform(X): Transform features using the backend model.
        score(X, y): Score data using backend metric and options.
    Úbalanced_accuracyNÚ db_connectionÚtaskÚ score_metricÚ
model_nameÚfit_extra_optionsÚtransform_extra_optionsÚscore_extra_optionscó†—tj|||||¬«||_t|«|_t|«|_y)aÉ
        Initialize transformer with required and optional arguments.
 
        Args:
            db_connection: Active MySQL backend database connection.
            task: ML task type for transformer.
            score_metric: Requested backend scoring metric.
            model_name: Optional model name for storage.
            fit_extra_options: Optional extra options for fitting.
            transform_extra_options: Optional extra options for transformation/inference.
            score_extra_options: Optional extra scoring options.
 
        Raises:
            DatabaseError:
                If a database connection issue occurs.
                If an operational error occurs during execution.
        )rrN)rÚ__init__rrrr)Úselfr rrrrrrs        úJH:\Change_password\venv_build\Lib\site-packages\mysql/ai/ml/transformer.pyrzMyGenericTransformer.__init__MsG€ô6    ×ÑØ Ø Ø Ø!Ø/õ     
ð)ˆÔÜ#,Ð-@Ó#AˆÔ ä'0Ð1HÓ'IˆÕ$óÚXÚreturncóP—|jj||j¬«S)aP
        Transform input data to model predictions using the underlying helper.
 
        Args:
            X: DataFrame of features to predict/transform.
 
        Returns:
            pd.DataFrame: Results of transformation as returned by backend.
 
        Raises:
            DatabaseError:
                If provided options are invalid or unsupported,
                or if the model is not initialized, i.e., fit or import has not
                been called
                If a database connection issue occurs.
                If an operational error occurs during execution.
        ©Úoptions)Ú_modelÚpredictr)rrs  rÚ    transformzMyGenericTransformer.transformus$€ð({‰{×"Ñ" 1¨d×.JÑ.JÐ"ÓKÐKrÚycóh—|jj|||j|j¬«S)aK
        Score the transformed data using the backend scoring interface.
 
        Args:
            X: Transformed features.
            y: Target labels or data for scoring.
 
        Returns:
            float: Score based on backend metric.
 
        Raises:
            DatabaseError:
                If provided options are invalid or unsupported,
                or if the model is not initialized, i.e., fit or import has not
                been called
                If a database connection issue occurs.
                If an operational error occurs during execution.
        r)rÚscorerr)rrr!s   rr#zMyGenericTransformer.score‹s5€ð.{‰{× Ñ Ø ˆq$×#Ñ#¨T×-EÑ-Eð!ó
ð    
r)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rÚCLASSIFICATIONr    rÚstrrÚdictrÚpdÚ    DataFramer ÚnpÚndarrayÚfloatr#©rrr r -sò„ñðD%,×$:Ñ$:Ø/Ø$(Ø,0Ø26Ø.2ñ&Jà.ð&JðC˜LÑ!ð&Jðð    &Jð
˜S‘Mð &Jð $ D™>ð &Jð"*¨$¡ð&Jð& d™^ó&JðPLØ—‘ðLà     ‰óLð,
à —‘˜rŸz™zÐ)Ñ *ð
𠐗‘˜rŸz™zÐ)Ñ *ð
ð
ô    
rr )r'ÚtypingrrÚnumpyr-Úpandasr+Ú sklearn.baserÚmysql.ai.ml.baserÚmysql.ai.ml.modelrÚmysql.ai.utilsrÚmysql.connector.abstractsr    r r0rrú<module>r9s5ðñ8÷
#ãÛÝ)å*Ý%Ý$Ý=ôw
˜=Ð*:õw
r