/var/opt/nydus/ops/mysql/ai/ml/__pycache__
NameSizeModeActions
base.cpython-312.pyc47860644editdlrm
classifier.cpython-312.pyc75470644editdlrm
model.cpython-312.pyc305340644editdlrm
outlier.cpython-312.pyc80480644editdlrm
regressor.cpython-312.pyc54700644editdlrm
transformer.cpython-312.pyc61060644editdlrm
__init__.cpython-312.pyc7640644editdlrm
Edit: /var/opt/nydus/ops/mysql/ai/ml/__pycache__/transformer.cpython-312.pyc (6106B)
N j+|dZddlmZmZddlZddlZddlm Z ddl m Z ddl m Z ddlmZddlmZGd d e e Zy) zGeneric transformer utilities for MySQL Connector/Python. Provides a scikit-learn compatible Transformer using HeatWave for fit/transform and scoring operations. )OptionalUnionN)TransformerMixin) MyBaseMLModel)ML_TASK) copy_dict)MySQLConnectionAbstractc(eZdZdZej dddddfdedeeefdede ede e d e e d e e fd Z d e jd e jfdZd ee jej fdee jej fd efdZy)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_connectiontask score_metric model_namefit_extra_optionstransform_extra_optionsscore_extra_optionsctj|||||||_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 H/opt/nydus/tmp/pip-target-a90h98xg/lib/python/mysql/ai/ml/transformer.pyrzMyGenericTransformer.__init__MsG6    !/  )#,-@#A '01H'I$XreturncP|jj||jS)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)_modelpredictr)rrs r transformzMyGenericTransformer.transformus$({{""1d.J.J"KKrych|jj|||j|jS)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)rscorerr)rrr!s rr#zMyGenericTransformer.scores5.{{  q$##T-E-E!  r)__name__ __module__ __qualname____doc__rCLASSIFICATIONr rstrrdictrpd DataFramer npndarrayfloatr#rrr r -sD%,$:$:/$(,026.2&J.&JCL!&J &J SM &J $D> &J"*$&J&d^&JPLL L, rzz) *  rzz) *    rr )r'typingrrnumpyr-pandasr+ sklearn.basermysql.ai.ml.basermysql.ai.ml.modelrmysql.ai.utilsrmysql.connector.abstractsr r r0rrr9s58 #)*%$=w =*:w r