gw.SVD.SVDBasis

gw.SVD.SVDBasis(file_name=None, dictionary=None)

Attributes

Name Description
V
Vh
dataset_type
mismatches
n
s

Methods

Name Description
compress Convert from data (e.g., frequency series) to compressed representation in
compute_test_mismatches Test SVD basis by computing mismatches of compressed / decompressed data
decompress Convert from basis coefficients back to raw data representation.
from_dictionary Load the SVD basis from a dictionary.
from_file Load the SVD basis from a HDF5 file.
generate_basis Generate the SVD basis from training data and store it.
print_validation_summary Print a summary of the validation mismatches.

compress

gw.SVD.SVDBasis.compress(data)

Convert from data (e.g., frequency series) to compressed representation in terms of basis coefficients.

Parameters

Name Type Description Default
data np.ndarray required

Returns

Name Type Description
array of basis coefficients

compute_test_mismatches

gw.SVD.SVDBasis.compute_test_mismatches(
    data,
    parameters=None,
    increment=50,
    verbose=False,
)

Test SVD basis by computing mismatches of compressed / decompressed data against original data. Results are saved as a DataFrame.

Parameters

Name Type Description Default
data np.ndarray Array of data sets to validate against. required
parameters pd.DataFrame Optional labels for the data sets. This is useful for checking performance on particular regions of the parameter space. None
increment int Specifies SVD truncations for computing mismatches. E.g., increment = 50 means that the SVD will be truncated at size [50, 100, 150, …, len(data)]. 50
verbose bool Whether to print summary statistics. False

decompress

gw.SVD.SVDBasis.decompress(coefficients)

Convert from basis coefficients back to raw data representation.

Parameters

Name Type Description Default
coefficients np.ndarray Array of basis coefficients required

Returns

Name Type Description
array of decompressed data

from_dictionary

gw.SVD.SVDBasis.from_dictionary(dictionary)

Load the SVD basis from a dictionary.

Parameters

Name Type Description Default
dictionary dict The dictionary should contain at least a ‘V’ key, and optionally an ‘s’ key. required

from_file

gw.SVD.SVDBasis.from_file(filename)

Load the SVD basis from a HDF5 file.

Parameters

Name Type Description Default
filename str required

generate_basis

gw.SVD.SVDBasis.generate_basis(training_data, n, method='scipy')

Generate the SVD basis from training data and store it.

The SVD decomposition takes

training_data = U @ diag(s) @ Vh

where U and Vh are unitary.

Parameters

Name Type Description Default
training_data np.ndarray Array of waveform data on the physical domain required
n int Number of basis elements to keep. n=0 keeps all basis elements. required
method str Select SVD method, ‘random’ or ‘scipy’ 'scipy'

print_validation_summary

gw.SVD.SVDBasis.print_validation_summary()

Print a summary of the validation mismatches.