uf3.regression.least_squaresΒΆ

This module provides the WeightedLinearModel class for fitting UF potentials from featurized DataFrames using regularized least squares.

Functions

apply_weighted_gram

Deprecated utility function for weighting gram matrix.

apply_weights

Deprecated utility function for weighting inputs/outputs.

arrange_coefficients

Arrange coefficients by degree of interaction.

batched_moore_penrose

Batched evaluation of gram matrix (x^T x) and ordinate (x^T y).

batched_prediction

Convenience function for optimization workflow.

dataframe_to_tuples

Extract energy/force inputs/outputs from DataFrame.

find_pair_potential_well

Identify coefficient index corresponding to possible potential well.

freeze_columns

Freeze coefficients of the solution (e.g.

freeze_regularizer

Apply freezing mask to regularizer, eliminating masked columns.

get_freezing_mask

Freezing mask is the set difference between the range of feature indices and the indices to be excluded (col_idx).

linear_least_squares

Solves the linear least-squares problem Ax=y.

lu_factorization

LU factorization for least-squares solution using np.linalg.solve().

mae_metric

Mean-absolute error metric.

moore_penrose_components

Compute gram matrix (x^T x) and ordinate (x^T y).

postprocess_coefficients_2b

Postprocess 2B coefficients to enforce repulsive core.

revert_frozen_coefficients

Reverse freezing operations by arranging learned coefficients and frozen coefficients using the mask.

rmse_metric

Root-mean-square error metric.

subset_prediction

Convenience function for optimization workflow.

validate_regularizer

Check for consistency between regularizer matrix and number of features.

weighted_least_squares

Solves the linear least-squares problem with optional Tikhonov regularizer matrix and optional weighting.

Classes

BasicLinearModel

Base class for linear regression.

VarianceRecorder

Convenience class for computing online variance and mean

WeightedLinearModel

Handler class for regularized linear least squares using energies and forces and basis set provided by bspline.BsplineBasis.