Skip to main content

ApplyConverterUnit

Unit
DashAI.back.units.ApplyConverterUnit

Fit one converter on the scoped data and transform the same dataset.

The single-dataset case, which is what applying a converter to a notebook means. Equivalent to :class:FitConverterUnit followed by :class:TransformDatasetUnit on the same dataset, kept as one unit for two reasons: it is the common case, and when there is no row scope it hands transform the very object fit saw, which some converters rely on to skip recomputing (see below).

Use the split pair instead whenever the converter has to be learned from one dataset and applied to another — fit on train, transform on test.

Reads dataset and writes dataset: the same key on both sides, so any number of these can be chained in one context, each one seeing what the previous one produced.

That is also why nothing about column identity ever crosses the context boundary. The scope is expressed as 1-based column and row indexes, and those indexes are resolved against dataset.column_names read at the top of execute — the dataset as it is right now. A converter that renames, drops or adds columns changes what index 3 means, so a resolved column list published to the context would be stale for the very next converter.

Parameters​

converter : object
Converter to apply, together with its own configuration.
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 ApplyConverterUnit

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 ApplyConverterUnit

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.