romtools.rom.neural_network_surrogate#
Functions
|
Estimate the maximum pairwise Lipschitz slope from training data. |
Classes
|
Configuration for a hard Lipschitz constraint on the neural surrogate. |
|
Neural-network QoI surrogate with a spectral Lipschitz constraint. |
Build a torch neural-network QoI surrogate from workflow training data. |
- class romtools.rom.neural_network_surrogate.LipschitzConfig(enabled=False, lipschitz_constant=None, safety_factor=1.1, spectral_norm_power_iterations=5, pairwise_distance_tolerance=1e-12, layer_lipschitz_constants=None)[source]#
Bases:
objectConfiguration for a hard Lipschitz constraint on the neural surrogate.
When enabled, spectral normalization constrains every linear operator to unit spectral norm and a scalar multiplier is applied to each layer. If
lipschitz_constantis not supplied, the global constant is estimated from pairwise slopes in the transformed training coordinates and multiplied bysafety_factor.- Parameters:
enabled (bool)
lipschitz_constant (float | None)
safety_factor (float)
spectral_norm_power_iterations (int)
pairwise_distance_tolerance (float)
layer_lipschitz_constants (Sequence[float] | None)
- class romtools.rom.neural_network_surrogate.LipschitzNeuralNetworkQoiModel(parameters, qois, parameter_names=None, pod_energy_fraction=0.999999, max_pod_modes=None, network_config=None, lipschitz_config=None, normalize_parameters=True, normalize_targets=True)[source]#
Bases:
NeuralNetworkQoiModelNeural-network QoI surrogate with a spectral Lipschitz constraint.
- Parameters:
parameters (np.ndarray)
qois (np.ndarray)
parameter_names (Optional[Sequence[str]])
pod_energy_fraction (float)
max_pod_modes (Optional[int])
network_config (Optional[NeuralNetworkConfig])
lipschitz_config (Optional[LipschitzConfig])
normalize_parameters (bool)
normalize_targets (bool)
- class romtools.rom.neural_network_surrogate.NeuralNetworkQoiModelBuilderWithTrainingData(parameter_names, pod_energy_fraction=0.999999, max_pod_modes=None, network_config=None, lipschitz_config=None, normalize_parameters=True, normalize_targets=True)[source]#
Bases:
objectBuild a torch neural-network QoI surrogate from workflow training data.
The builder mirrors the POD controls used by the Gaussian-process surrogate while keeping neural-network architecture and optimization settings in
NeuralNetworkConfig. A hard Lipschitz constraint can be enabled independently withLipschitzConfig.- Parameters:
parameter_names (Optional[Sequence[str]])
pod_energy_fraction (float)
max_pod_modes (Optional[int])
network_config (Optional[NeuralNetworkConfig])
lipschitz_config (Optional[LipschitzConfig])
normalize_parameters (bool)
normalize_targets (bool)