Class ParamKoopmanDataSet
The class ParamKoopmanDataSet
is a subclass of KoopmanDataSet
,
it provides data for ParamKoopmanDLSolver
.
API Documentation¶
Bases: KoopmanDataSet
data_param
property
¶
Returns the parameters of the generated data.
Returns:
Type | Description |
---|---|
Tensor
|
The parameters of the generated data. |
__getitem__(idx)
¶
Retrieve the data and labels at the specified index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
The index of the data to retrieve. |
required |
Returns:
Type | Description |
---|---|
tuple
|
A tuple containing the data, parameters, and labels at the specified index. |
__init__(dynamics, x_sample_func=torch.rand, param_sample_func=torch.rand)
¶
Initializes the KoopmanDataSet class with the specified dynamics and sampling functions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dynamics
|
DiscreteDynamics
|
The dynamics function or model to be used in the dataset. |
required |
x_sample_func
|
callable
|
A function to sample the initial state |
rand
|
param_sample_func
|
callable
|
A function to sample the parameters. Defaults to |
rand
|
generate_data(n_traj, n_traj_per_param, traj_len, x_min, x_max, param_min, param_max, seed_x=11, seed_param=22, param_time_dependent=False)
¶
Generates synthetic data for the ParamKoopmanDataSet.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_traj
|
int
|
Number of trajectories to generate. |
required |
n_traj_per_param
|
int
|
Number of trajectories per parameter setting. |
required |
traj_len
|
int
|
Length of each trajectory. |
required |
x_min
|
float or Tensor
|
Minimum value for initial state sampling. |
required |
x_max
|
float or Tensor
|
Maximum value for initial state sampling. |
required |
param_min
|
float or Tensor
|
Minimum value for parameter sampling. |
required |
param_max
|
float or Tensor
|
Maximum value for parameter sampling. |
required |
seed_x
|
int
|
Random seed for initial state sampling. Default is 11. |
11
|
seed_param
|
int
|
Random seed for parameter sampling. Default is 22. |
22
|
param_time_dependent
|
bool
|
If True, parameters are time-dependent. Default is False. |
False
|
Returns: None: The generated data is stored in the instance variables _data_x, _data_param, and _labels.
load(file)
¶
Load data from a pickle file and set the object's attributes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file
|
str
|
The path to the pickle file to be loaded. |
required |
save(file)
¶
Saves the generated dataset to a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file
|
str
|
The path to the file where the dataset will be saved. |
required |