Linear

class franken.rf.heads.Linear(input_dim, num_species=None, chemically_informed_ratio=None, bias=0.0, length_scale=1.0)

Bases: RandomFeaturesHead

Implements the linear kernel.

This kernel does not need to be approximated with random-features, and can be used directly as if it were composed of random features. No stochasticity is present.

\[\frac{\langle x, y \rangle}{\ell^{2}} + b\]
Parameters:
  • input_dim (int) – The dimensionality of the input features.

  • num_species (int | None) – The number of chemical species for which the kernel is computed. This parameter is relevant for systems with multiple chemical species. Defaults to None.

  • chemically_informed_ratio (float | None) – The relative weight of chemically-informed kernels with respect to the all-species kernel. Ignored if num_species is None. Defaults to None.

  • bias (float) – The bias term \(b\) added to the kernel function. This allows for shifting the kernel values, which can be useful for certain applications. Defaults to 0.0.

  • length_scale (float) – The length scale parameter \(\ell\) that controls the smoothness of the kernel function. It affects how quickly the kernel values decay with distance. Defaults to 1.0.

feature_map(h, atomic_numbers=None, batch_ids=None)

Computes the random-feature map for a given configuration h

Parameters:
  • h (torch.Tensor) – descriptors for a single configuration ~[natoms, descriptors]

  • atomic_numbers (torch.Tensor) – atomic numbers for a single configuration ~[natoms]