Skip to main content

FitConverterUnit

Unit
DashAI.back.units.FitConverterUnit

Fit a converter on the dataset in the context and publish it fitted.

Splits the "fit" half out of :class:ApplyConverterUnit so a converter can be learned from one dataset and applied to another. That is the standard train/test discipline: a scaler, an encoder or an imputer must learn its statistics from the training data only, and then be applied unchanged to the test data — refitting on test would leak information into the evaluation.

The dataset is left untouched: this unit produces a fitted converter, not data. Pair it with :class:TransformDatasetUnit, once per dataset the fitted converter has to be applied to.

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 FitConverterUnit

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 FitConverterUnit

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.