Saltar al contenido principal

TransformDatasetUnit

Unit
DashAI.back.units.TransformDatasetUnit

Apply an already fitted converter to the dataset in the context.

Takes no converter configuration: the converter arrives fitted through the context, from :class:FitConverterUnit or :class:ApplyConverterUnit. That is what makes "fit on train, apply to test" possible without refitting — run this once per dataset, and the converter keeps the state it learned.

It does carry its own scope, on purpose: the scope is a list of 1-based indexes, and they are resolved against this unit's dataset. Reusing the column names resolved during fit would break the moment the two datasets order their columns differently, and would carry stale column identity across the context boundary.

Parameters​

scope
Part of the dataset the converter applies to: 'columns' is a list of {'idx': n} and 'rows' a list of n, both 1-based. An empty column list means every column.
target, default=None
Target column handed to the converter as y, as {'idx': n} with n 1-based. Leave empty for unsupervised converters.

Methods​

execute(self, ctx: DashAI.back.units.context.ExecutionContext) -> None

Defined on TransformDatasetUnit

Do the unit's work, reading from and writing to the context.

Parameters

ctx : ExecutionContext
The shared execution context.

validate(self, ctx: DashAI.back.units.context.ExecutionContext) -> None

Defined on TransformDatasetUnit

Reject an out-of-bounds target before any work is done.

get_credential(self, name: str)

Defined on ConfigObject

Resolve a registered credential component by name.

Parameters

name : str
Credential component class name (e.g. "HuggingFaceCredential").

Returns

BaseCredential
An instance of the requested credential component.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

validate_and_transform(self, raw_data: dict) -> dict

Defined on ConfigObject

It takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.

Parameters

raw_data : dict
A dictionary with the data provided by the user to initialize the model.

Returns

dict
A validated dictionary with the necessary objects.