Skip to main content

RBFSampler

Converter
DashAI.back.converters.scikit_learn.RBFSampler

Approximate the RBF (Gaussian) kernel feature map via random Fourier features.

The Radial Basis Function (RBF) kernel is one of the most widely used kernels in kernel-based learning methods such as SVMs. Computing it directly scales quadratically with the number of training samples.

This converter implements the random Fourier feature approximation of Rahimi & Recht (2007) [2]: random weights are sampled from the Fourier transform of the RBF kernel (a Gaussian distribution), and the input features are mapped to n_components sinusoidal features. A linear model trained on the resulting representation approximates a kernel machine at a fraction of the cost.

The gamma parameter controls the bandwidth of the RBF kernel: K(x, y) = exp(-gamma * ||x - y||²). When set to "scale", it is computed from the training data as 1 / (n_features * X.var()).

Output columns are typed as Float64 in DashAI.

Wraps sklearn.kernel_approximation.RBFSampler.

References

Parameters

gamma, default=scale
Parameter of the RBF kernel.
n_components : integer, default=100
The number of features to construct.
random_state, default=0
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 RBFSampler

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().

changes_row_count(self) -> 'bool'

Defined on BaseConverter

Indicate whether this converter changes the number of dataset rows.

Returns

bool
True if the converter may add or remove rows, False otherwise.

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_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_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

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.