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)
when the source column has no missing values, since squaring is exact
for both. log1p and sqrt always produce a Float column, since
they can yield non-integer or NaN results even from integer input,
and square also falls back to Float when the source Integer
column has missing values (since a missing value has no exact integer
representation).
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().
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_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.
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.