simulai package
Subpackages
- simulai.backup package
- simulai.math package
- Submodules
- simulai.math.differentiation module
- simulai.math.expressions module
- simulai.math.filtering module
- simulai.math.integration module
- simulai.math.kansas module
Kansas
Kansas.gen_f1()
Kansas.get_cross_derivative_matrix()
Kansas.get_cross_derivative_matrix_optimized()
Kansas.get_first_derivative_matrix()
Kansas.get_first_derivative_matrix_aux()
Kansas.get_first_derivative_matrix_optimized()
Kansas.get_interpolation_matrix()
Kansas.get_interpolation_matrix_optimized()
Kansas.get_laplacian_matrix()
Kansas.get_second_derivative_matrix()
Kansas.get_second_derivative_matrix_optimized()
Kansas.kernel()
Kansas.kernel_Dx()
Kansas.kernel_Dxx()
Kansas.kernel_Dxy()
Kansas.kernel_Laplacian()
- simulai.math.products module
- simulai.math.progression module
- simulai.math.quadratures module
- simulai.math.spaces module
- Module contents
- simulai.models package
- simulai.optimization package
- simulai.regression package
- simulai.residuals package
- simulai.rom package
- simulai.templates package
- simulai.utilities package
- simulai.workflows package
Submodules
simulai.abstract module
- class simulai.abstract.ByPassIntegrator[source]
Bases:
Integral
It does nothing
- name = 'no_post_process_op'
- class simulai.abstract.DataPreparer[source]
Bases:
object
DataPreparer classes are used to convert raw data to a proper format in order to be processed via others algorithms, as ROMs and ML algorithms
- class simulai.abstract.Integral[source]
Bases:
object
Parent class for the integration classes
- purpose = 'integration'
- class simulai.abstract.ROM[source]
Bases:
Transformation
simulai.activations module
- class simulai.activations.Siren(omega_0: Optional[float] = None, c: Optional[float] = None)[source]
Bases:
Module
- forward(input: Tensor) Tensor [source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- name = 'Siren'
- training: bool
- class simulai.activations.sin[source]
Bases:
Module
- forward(input: Tensor) Tensor [source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- name = 'sin'
- training: bool
simulai.batching module
- class simulai.batching.BatchwiseSampler(dataset: Optional[Group] = None, input_variables: Optional[List[str]] = None, target_variables: Optional[List[str]] = None, input_normalizer: Optional[callable] = None, target_normalizer: Optional[callable] = None, channels_first: Optional[bool] = None)[source]
Bases:
object
- property input_shape
simulai.file module
- class simulai.file.SPFile(compact: bool = False)[source]
Bases:
object
- read(model_path: Optional[str] = None) NetworkTemplate [source]
- Parameters
model_path (str) – the complete path to the model
- Returns
the model restored to memory
- Return type
NetworkTemplate (child of torch.nn.Module)
- write(save_dir: Optional[str] = None, name: Optional[str] = None, template: Optional[callable] = None, model: Optional[NetworkTemplate] = None, device: Optional[str] = None) None [source]
- Parameters
save_dir (str) – the absolute directory for the saved model
name (str) – a name for the model
template (callable) – a function for instantiate a raw version of the model
device (str) – the device in which the saved model must be located (gpu or cpu)
- Returns
nothing
simulai.initialization module
simulai.io module
- class simulai.io.BatchwiseExtrapolation(op: Optional[callable] = None, auxiliary_data: Optional[ndarray] = None)[source]
Bases:
object
BatchwiseExtraplation uses a time-series regression model and inputs as generated by MovingWindow to continuously extrapolate a dataset
- class simulai.io.ByPassPreparer(channels_last: bool = False)[source]
Bases:
DataPreparer
ByPass class, it fills the DataPreparer blank, but does nothing.
- name = 'no_preparer'
- class simulai.io.GaussianNoise(stddev: float = 0.01, input_data: Optional[Union[ndarray, Tensor]] = None)[source]
Bases:
object
- property data
- class simulai.io.IntersectingBatches(skip_size: int = 1, batch_size: Optional[int] = None, full: bool = True)[source]
Bases:
object
IntersectingBatches is applied over a time-series array (2D array).
See a graphical example:
batch n |------------|
batch n+1 |------------|
- class simulai.io.MapValid(config: Optional[dict] = None, mask=None, channels_last: bool = True)[source]
Bases:
Reshaper
MapValid converts n-dimensional arrays to two-dimensional ones performing a valid values mapping operation F: F: data.shape = (n0, n1, …, nm) -> data’.shape = (n0, n_valids) n_valids = dim([k in data[0, …] if k != mask]) WARNING: the invalid positions are expected to be static in relation to n0.
- name = 'map_valid'
- prepare_input_data(data: Optional[ndarray] = None) ndarray [source]
Internal input data preparer, executed for each label of the structured array
- Parameters
data (np.ndarray) –
- Returns
- Return type
np.ndarray
- prepare_input_structured_data(data: Optional[recarray] = None) ndarray [source]
- Parameters
data – structured array to be prepared, the default shape is
(n_samples, 1, *other_dimensions) The features dimensions is 1 in NumPy structured arrays :type data: np.ndarray :return: np.ndarray
- class simulai.io.MovingWindow(history_size: Optional[int] = None, skip_size: int = 1, horizon_size: Optional[int] = None, full_output: bool = True)[source]
Bases:
object
MovingWindow is applied over a time-series array (2D array), and it is used for creating the necessary augmented data used for LSTM networks, replicating the training windows for each sample in the dataset.
See a graphical example:
batch n ———|— history | horizon
batch n+1 ———|— history | horizon
- class simulai.io.Reshaper(channels_last: bool = False)[source]
Bases:
DataPreparer
- name = 'reshaper'
- class simulai.io.Sampling(choices_fraction: float = 0.1, shuffling: bool = False)[source]
Bases:
DataPreparer
- property indices: list
- name = 'sampling'
- prepare_input_data(data: Optional[ndarray] = None, data_interval: Optional[list] = None) ndarray [source]
- prepare_input_structured_data(data: Optional[Dataset] = None, data_interval: Optional[list] = None, batch_size: Optional[int] = None, dump_path: Optional[str] = None) recarray [source]
- Parameters
data – structured array to be prepared, the default shape is
(n_samples, 1, *other_dimensions) The features dimensions is 1 in NumPy structured arrays :type data: np.ndarray :return: np.ndarray
- class simulai.io.ScalerReshaper(bias: float = 0.0, scale: float = 1.0, channels_last: bool = False)[source]
Bases:
Reshaper
- name = 'scalerreshaper'
- prepare_input_data(data: Optional[Union[ndarray, recarray]] = None, *args, **kwargs) ndarray [source]
- class simulai.io.SlidingWindow(history_size: Optional[int] = None, skip_size: Optional[int] = None)[source]
Bases:
object
SlidingWindow is applied over a time-series array (2D array), and it is used for creating the necessary augmented data used for LSTM networks, replicating the training windows for each sample in the dataset. The difference between SlidingWindow and MovingWindow is that here there is no intersection between two sequential batches
See an graphical example:
batch n ———|— history | horizon
batch n+1 ———|— history | horizon
simulai.mesh module
simulai.metrics module
- class simulai.metrics.L2Norm(mask: Optional[Union[str, float]] = None, do_clean_data: bool = True, large_number: float = 1000000000000000.0, default_data: float = 0.0)[source]
Bases:
object
- name = 'l2_norm'
- class simulai.metrics.LyapunovUnits(lyapunov_unit: float = 1, tol=0.1, time_scale=1, norm_criteria='cumulative_norm')[source]
Bases:
object
- class simulai.metrics.MemorySizeEval(memory_tol_percent: float = 0.5)[source]
Bases:
object
- property available_memory_in_GB: float
- class simulai.metrics.MinMaxEvaluation[source]
Bases:
object
- eval_h5(dataset: Optional[Group] = None, data_interval: Optional[list] = None, batch_size: Optional[int] = None, data_preparer: Optional[DataPreparer] = None, axis: int = -1, keys: Optional[list] = None) ndarray [source]
- class simulai.metrics.PerturbationMethod(jacobian_evaluator: Optional[callable] = None)[source]
Bases:
object
simulai.normalization module
- class simulai.normalization.BatchNormalization(norm=None, channels_last=False)[source]
Bases:
object
- class simulai.normalization.StandardNormalization[source]
Bases:
Normalization
- name = 'standard'
- class simulai.normalization.UnitaryNormalization(value_max: Optional[float] = None, value_min: Optional[float] = None)[source]
Bases:
Normalization
- name = 'unitary'
- class simulai.normalization.UnitarySymmetricalNormalization(value_max: Optional[float] = None, value_min: Optional[float] = None)[source]
Bases:
UnitaryNormalization
- name = 'unitary_symmetrical'
simulai.output module
- simulai.output.plot_figures2D(u, t, x, z, nt, nx, nz, output_name)[source]
- Parameters
np.ndarray (z) – array with data to plot
np.ndarray – uni-dimensional array with timestamps
np.ndarray – uni-dimensional array with x samples
np.ndarray – uni-dimensional array with z samples
int (nz) – # of time samples
int – # of x samples
int – # of z samples
:param output_name str : name of final output.py :return:
simulai.parallel module
simulai.simulation module
- class simulai.simulation.Pipeline(stages: list = [], channels_last: bool = False)[source]
Bases:
BaseFramework
Pipeline class manages the execution of multiple operations such as data pre-processing (DataPreparer), ROM, and ML modeling (Model)
- batchwise_pipeline_loop(input_data, target_data, reference_data, extra_kwargs, data_interval=None, batch_size=None, batch_indices=None)[source]
- exec(input_data=None, target_data=None, reference_data=None, data_generator=None, extra_kwargs=None, fit_kwargs=None, data_interval=None, batch_size=None, batch_indices=None)[source]
- Parameters
batch_size –
batch_size – int
data (np.ndarray) –
input_data (np.ndarray) –
target_data (np.ndarray) –
reference_data –
data_generator –
extra_kwargs –
- Returns
- property input_data
- project_data(data=None, variables_list=None, data_interval=None, batch_size=1, batch_indices=None)[source]
- Parameters
data (np.ndarray) –
variables_list (List[str]) –
mean_component (bool) –
- Returns
simulai.special module
simulai.tokens module
- class simulai.tokens.Identity(*args)
Bases:
AppliedUndef
- default_assumptions = {}
- name = 'Identity'