NumericExpansion
Derive a new numeric feature from each selected column via a unary function.
Applies one of log1p (ln(1+x)), square (x^2), or sqrt
(sqrt(x)) to every numeric column in scope, appending one new column
per input column named <operation>_<column>. Values outside the
domain of the chosen function (x <= -1 for log1p, x < 0 for
sqrt) become NaN in the corresponding output.
The original columns are left untouched. square preserves the input
column's type (Integer stays Integer, Float stays Float),
since squaring is exact for both; a missing value stays missing. log1p
and sqrt always produce a Float column, since they can yield
non-integer or NaN results even from integer input. The output type
only depends on the operation and the input type, never on the values.
Parameters
- operation : string, default=
log1p - Unary numeric expansion to apply to each selected column: 'log1p' (ln(1+x)), 'square' (x^2), or 'sqrt' (sqrt(x)).
Methods
fit(self, x: 'DashAIDataset', y: Optional[ForwardRef('DashAIDataset')] = None) -> 'NumericExpansion'
NumericExpansionIdentify which columns in x are numeric (Float or Integer).
Parameters
- x : DashAIDataset
- The dataset whose columns will be inspected.
- y : DashAIDataset, optional
- Ignored. Defaults to None.
Returns
- NumericExpansion
- The fitted converter instance (self).
get_output_type(self, column_name: str = None) -> DashAI.back.types.dashai_data_type.DashAIDataType
NumericExpansionReturn the output type for a given expanded column.
Parameters
- column_name : str, optional
- Name of the output column (e.g.
"square_age"). Defaults to None.
Returns
- DashAIDataType
- An
Integertype backed bypyarrow.int64(), or aFloattype backed bypyarrow.float64().
infer_output_columns(self, inputs: List[Annotated[Union[DashAI.back.preprocessing.structure_types.ColumnItem, DashAI.back.preprocessing.structure_types.BlockItem], FieldInfo(annotation=NoneType, required=True, discriminator='kind')]]) -> DashAI.back.preprocessing.structure_types.StructureDelta
NumericExpansionEstimate the output: the scope kept, plus one column per numeric one.
Parameters
- inputs : list of ColumnItem | BlockItem
- The dataset state items in this converter's scope.
Returns
- StructureDelta
- The unchanged inputs, plus an
<operation>_<column>column for every Float or Integer input, asfitpicks them.
transform(self, x: 'DashAIDataset', y: Optional[ForwardRef('DashAIDataset')] = None) -> 'DashAIDataset'
NumericExpansionApply the configured unary expansion to the fitted numeric columns.
Parameters
- x : DashAIDataset
- The dataset to transform.
- y : DashAIDataset, optional
- Ignored. Defaults to None.
Returns
- DashAIDataset
- The dataset with one new
<operation>_<column>column appended per fitted numeric column, typedIntegerorFloatdepending on the source column and the operation (see class docstring).
get_credential(self, name: str)
ConfigObjectResolve 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_metadata(cls) -> 'Dict[str, Any]'
BaseConverterGet metadata for the converter, used by the DashAI frontend.
Parameters
- cls : type
- The converter class (injected automatically by Python for classmethods).
Returns
- Dict[str, Any]
- Dictionary containing display name, short description, image preview path, category, icon, color, and whether the converter is supervised.
get_schema(cls) -> dict
ConfigObjectGenerates the component related Json Schema.
Returns
- dict
- Dictionary representing the Json Schema of the component.
rows_to_keep(self, x: "'DashAIDataset'") -> 'List[int]'
BaseConverterPositions of the rows of x that survive this converter.
Parameters
- x : DashAIDataset
- The converter's scope columns of one split.
Returns
- list of int
- 0-based positions of the kept rows, in order.
validate_and_transform(self, raw_data: dict) -> dict
ConfigObjectIt 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.