Skip to main content

SkewedChi2Sampler

Converter
DashAI.back.converters.scikit_learn.SkewedChi2Sampler

Approximate the skewed chi-squared kernel feature map via random Fourier features.

The skewed chi-squared kernel is well suited for histogram-based features (e.g. visual bag-of-words, colour histograms) and is defined as:

K(x, y) = prod_j 2 * sqrt(x_j + c) * sqrt(y_j + c) / (x_j + y_j + 2c)

where c is the skewedness parameter. A skewedness value of 0 recovers the ordinary chi-squared kernel; larger values reduce the sensitivity to small feature values.

This converter maps inputs to a n_components-dimensional random Fourier feature space in which a dot product approximates the above kernel, following the approach of Rahimi & Recht (2007) [2]. Training a linear classifier on the resulting features approximates an SVM with the skewed chi-squared kernel.

Output columns are typed as Float64 in DashAI.

Wraps sklearn.kernel_approximation.SkewedChi2Sampler.

References​

Parameters​

skewedness : number, default=1.0
The skewedness parameter of the chi-squared kernel.
n_components : integer, default=100
Number of Monte Carlo samples per original feature. Equals the dimensionality of the computed feature space.
random_state, default=None
Pseudo-random number generator to control the generation of the random weights and random offset when fitting the training data. Pass an int for reproducible output across multiple function calls.

Methods​

get_output_type(self, column_name: str = None) -> DashAI.back.types.dashai_data_type.DashAIDataType

Defined on SkewedChi2Sampler

Return the DashAI data type produced by this converter for a column.

Parameters

column_name : str, optional
Not used; all output columns share the same type. Defaults to None.

Returns

DashAIDataType
A Float type backed by pyarrow.float64().

build_report(self, data: 'Dict[str, Any]') -> 'Dict[str, Any]'

Defined on BaseConverter

Wrap converter-specific data with the producer converter name.

fit(self, x: 'DashAIDataset', y: Optional[ForwardRef('DashAIDataset')] = None) -> DashAI.back.converters.base_converter.BaseConverter

Defined on SklearnWrapper

Fit the scikit-learn transformer to the data.

Parameters

x : DashAIDataset
The input dataset to fit the transformer on.
y : DashAIDataset, optional
Target values for supervised transformers. Defaults to None.

Returns

BaseConverter
The fitted transformer instance (self).

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_metadata(cls) -> 'Dict[str, Any]'

Defined on BaseConverter

Get 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_report(self) -> 'Union[Dict[str, Any], None]'

Defined on BaseConverter

Return the converter report produced after execution, if any.

Returns

Dict[str, Any] or None
JSON-serializable report dict, or None when the converter does not produce one.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

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

Defined on ComponentsOutputMixin

rows_to_keep(self, x: "'DashAIDataset'") -> 'List[int]'

Defined on BaseConverter

Positions 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.

session_params(cls, params: 'Optional[Dict[str, Any]]') -> 'Dict[str, Any]'

Defined on BaseConverter

A session step's params, with the session defaults under them.

Parameters

params : dict or None
The params the step stores.

Returns

dict
SESSION_PARAMS updated with params: what the step gives wins.

transform(self, x: 'DashAIDataset', y: Optional[ForwardRef('DashAIDataset')] = None) -> 'DashAIDataset'

Defined on SklearnWrapper

Transform the data using the fitted scikit-learn transformer.

Parameters

x : DashAIDataset
The input dataset to transform.
y : DashAIDataset, optional
Not used. Present for API consistency. Defaults to None.

Returns

DashAIDataset
The transformed dataset with updated DashAI column types.

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.