amisc.typing
Module with type hints for the AMISC package.
Includes:
MultiIndex
— tuples of integers or similar string representationsDataset
— a type hint for the input/outputdicts
handled byComponent.model
TrainIteration
— the results of a single training iterationCompressionData
— a dictionary spec for passing data to/fromVariable.compress()
LATENT_STR_ID
— a string identifier for latent coefficients of field quantities
CompressionData
Bases: TypedDict
Configuration dict
for passing compression data to/from Variable.compress()
.
Field quantity shapes
Field quantity data can take on any arbitrary shape, which we indicate with qty.shape
. For example, a 3d
structured grid might have qty.shape = (10, 15, 10)
. Unstructured data might just have qty.shape = (N,)
for \(N\) points in an unstructured grid. Regardless, Variable.compress()
will flatten this and compress
to a single latent vector of size latent_size
. That is, qty.shape
→ latent_size
.
Compression coordinates
Field quantity data must be specified along with its coordinate locations. If the coordinate locations are different from what was used when building the compression map (i.e. the SVD data matrix), then they will be interpolated to/from the SVD coordinates.
ATTRIBUTE | DESCRIPTION |
---|---|
coords |
TYPE:
|
latent |
TYPE:
|
qty |
TYPE:
|
Dataset
Bases: TypedDict
Type hint for the input/output dicts
of a call to Component.model
. The keys are the variable names and the
values are the corresponding np.ndarrays
. There are also a few special keys that can be returned by the model
that are described below.
The model can return additional items that are not part of Component.outputs
. These items are returned as object
arrays in the output.
This data structure is very similar to the Dataset
class in the xarray
package. Later versions might
consider migrating to xarray
for more advanced data manipulation.
ATTRIBUTE | DESCRIPTION |
---|---|
model_cost |
the computational cost (seconds of CPU time) of a single model evaluation
TYPE:
|
output_path |
the path to the output file or directory written by the model
TYPE:
|
errors |
a
TYPE:
|
MultiIndex
Bases: tuple
A multi-index is a tuple of integers, can be converted from a string.
TrainIteration
Bases: TypedDict
Gives the results of a single training iteration.
ATTRIBUTE | DESCRIPTION |
---|---|
component |
the name of the component selected for refinement at this iteration
TYPE:
|
alpha |
the selected candidate model fidelity multi-index
TYPE:
|
beta |
the selected candidate surrogate fidelity multi-index
TYPE:
|
num_evals |
the number of model evaluations performed during this iteration
TYPE:
|
added_cost |
the total added computational cost of the new model evaluations
TYPE:
|
added_error |
the error/difference between the refined surrogate and the previous surrogate
TYPE:
|
test_error |
the error of the refined surrogate on the test set (optional)
TYPE:
|