torchml.kernel_approximations

Classes

torchml.kernel_approximations.RBFSampler

[Source]

Description

RBFSampler constructs an approximate mapping for Random Kitchen Sinks.

References
  1. Ali Rahimi and Benjamin Rechti's Weighted Sums of Random Kitchen Sinks paper
  2. The scikit-learn documentation page
Arguments
  • gamma (float, default=1.0) - Parameter of RBF kernel.
  • n_components (int, default=100) - Dimensionality of the computed feature space.
  • random_state (int, default=None) - Passed in seed that controls the generation of the random weights and random offset when fitting the training data.
Example
rbfsampler = RBFSampler()

fit(self, X: Tensor, y: Tensor = None)

Description

Fit the model with training data X.

Arguments
  • X (Tensor) - Input variates.
  • y (Tensor) - Target covariates (None for unsupervised transformation).
Example
rbfsampler = RBFSampler()
rbfsampler.fit(X_train, y_train)

fit_transform(self, X: Tensor, y: Tensor = None)

Description

Fit and then transform X.

Arguments
  • X (Tensor) - Input variates.
  • y (Tensor) - Target covariates (None for unsupervised transformation).
Example
rbfsampler = RBFSampler()
rbfsampler.fit_transform(X_train, y_train)

transform(self, X: Tensor)

Description

Apply the approximate feature mapping to X.

Arguments
  • X (Tensor) - Input variates.
Example
rbfsampler = RBFSampler()
rbfsampler.fit(X_train, y_train)
rbfsampler.transform(X_train)