plaid.problem_definition¶
Implementation of the ProblemDefinition class.
Attributes¶
Classes¶
Gathers all necessary informations to define a learning problem. |
Module Contents¶
- class ProblemDefinition(path: str | pathlib.Path | None = None, directory_path: str | pathlib.Path | None = None)[source]¶
Bases:
objectGathers all necessary informations to define a learning problem.
Initialize an empty
ProblemDefinition.Use
add_inputsoradd_output_scalars_namesto feed theProblemDefinition- Parameters:
Example
from plaid import ProblemDefinition # 1. Create empty instance of ProblemDefinition problem_definition = ProblemDefinition() print(problem_definition) >>> ProblemDefinition() # 2. Load problem definition and create ProblemDefinition instance problem_definition = ProblemDefinition("path_to_plaid_prob_def") print(problem_definition) >>> ProblemDefinition(input_scalars_names=['s_1'], output_scalars_names=['s_2'], input_meshes_names=['mesh'], task='regression')
- get_name() str[source]¶
Get the name. None if not defined.
- Returns:
The name, such as “regression_1”.
- Return type:
- set_name(name: str) None[source]¶
Set the name.
- Parameters:
name (str) – The name, such as “regression_1”.
- get_version() packaging.version.Version[source]¶
Get the version. None if not defined.
- Returns:
The version, such as “0.1.0”.
- Return type:
Version
- get_task() str[source]¶
Get the authorized task. None if not defined.
- Returns:
The authorized task, such as “regression” or “classification”.
- Return type:
- set_task(task: str) None[source]¶
Set the authorized task.
- Parameters:
task (str) – The authorized task to be set, such as “regression” or “classification”.
- get_score_function() str[source]¶
Get the authorized score function. None if not defined.
- Returns:
The authorized score function, such as “RRMSE”.
- Return type:
- set_score_function(score_function: str) None[source]¶
Set the authorized score function.
- Parameters:
score_function (str) – The authorized score function, such as “RRMSE”.
- get_split(indices_name: str | None = None) plaid.types.IndexType | dict[str, plaid.types.IndexType][source]¶
Get the split indices. This function returns the split indices, either for a specific split with the provided indices_name or all split indices if indices_name is not specified.
- Parameters:
indices_name (str, optional) – The name of the split for which indices are requested. Defaults to None.
- Raises:
KeyError – If indices_name is specified but not found among split names.
- Returns:
If indices_name is provided, it returns the indices for that split (IndexType). If indices_name is not provided, it returns a dictionary mapping split names (str) to their respective indices (IndexType).
- Return type:
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] split_indices = problem.get_split() print(split_indices) >>> {'train': [0, 1, 2, ...], 'test': [100, 101, ...]} test_indices = problem.get_split('test') print(test_indices) >>> [100, 101, ...]
- set_split(split: dict[str, plaid.types.IndexType]) None[source]¶
Set the split indices. This function allows you to set the split indices by providing a dictionary mapping split names (str) to their respective indices (IndexType).
Example
from plaid import ProblemDefinition problem = ProblemDefinition() new_split = {'train': [0, 1, 2], 'test': [3, 4]} problem.set_split(new_split)
- get_train_split(indices_name: str | None = None) dict[str, plaid.types.IndexType] | dict[str, dict[str, plaid.types.IndexType]][source]¶
Get the train split indices for different subsets of the dataset.
- Parameters:
indices_name (str, optional) – The name of the specific train split subset for which indices are requested. Defaults to None.
- Returns:
- If indices_name is provided:
Returns a dictionary mapping split names to their indices for the specified subset.
- If indices_name is None:
Returns the complete train split dictionary containing all subsets and their indices.
- Return type:
Union[dict[str, IndexType], dict[str, dict[str, IndexType]]]
- Raises:
AssertionError – If indices_name is provided but not found in the train split.
- set_train_split(split: dict[str, dict[str, plaid.types.IndexType | None]]) None[source]¶
Set the train split dictionary containing subsets and their indices.
- Parameters:
split (dict[str, dict[str, IndexType]]) – Dictionary mapping train subset names to their split dictionaries. Each split dictionary maps split names (e.g., ‘train’, ‘val’) to their indices.
Note
If a train split already exists, it will be replaced and a warning will be logged.
- get_test_split(indices_name: str | None = None) dict[str, plaid.types.IndexType] | dict[str, dict[str, plaid.types.IndexType]][source]¶
Get the test split indices for different subsets of the dataset.
- Parameters:
indices_name (str, optional) – The name of the specific test split subset for which indices are requested. Defaults to None.
- Returns:
- If indices_name is provided:
Returns a dictionary mapping split names to their indices for the specified subset.
- If indices_name is None:
Returns the complete test split dictionary containing all subsets and their indices.
- Return type:
Union[dict[str, IndexType], dict[str, dict[str, IndexType]]]
- Raises:
AssertionError – If indices_name is provided but not found in the test split.
- set_test_split(split: dict[str, dict[str, plaid.types.IndexType | None]]) None[source]¶
Set the test split dictionary containing subsets and their indices.
- Parameters:
split (dict[str, dict[str, IndexType]]) – Dictionary mapping test subset names to their split dictionaries. Each split dictionary maps split names (e.g., ‘test’, ‘test_ood’) to their indices.
Note
If a test split already exists, it will be replaced and a warning will be logged.
- get_in_features_identifiers() Sequence[str | plaid.containers.FeatureIdentifier][source]¶
Get the input features identifiers of the problem.
- Returns:
A list of input feature identifiers.
- Return type:
Sequence[Union[str, FeatureIdentifier]]
Example
from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() # [...] in_features_identifiers = problem.get_in_features_identifiers() print(in_features_identifiers) >>> ['omega', 'pressure']
- set_in_features_identifiers(features_identifiers: Sequence[str | plaid.containers.FeatureIdentifier]) None[source]¶
Set the input features identifiers of the problem.
Example
from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() # [...] problem.set_in_features_identifiers(in_features_identifiers)
- add_in_features_identifiers(inputs: Sequence[str | plaid.containers.FeatureIdentifier]) None[source]¶
Add input features identifiers to the problem.
- Parameters:
inputs (Sequence[Union[str, FeatureIdentifier]]) – A list of input feature identifiers to add.
- Raises:
ValueError – If some
inputsare redondant.
Example
from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() in_features_identifiers = ['omega', 'pressure'] problem.add_in_features_identifiers(in_features_identifiers)
- add_in_feature_identifier(input: str | plaid.containers.FeatureIdentifier) None[source]¶
Add an input feature identifier or identifier to the problem.
- Parameters:
input (FeatureIdentifier) – The identifier or identifier of the input feature to add.
- Raises:
ValueError – If the specified input feature is already in the list of inputs.
Example
from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() input_identifier = 'pressure' problem.add_in_feature_identifier(input_identifier)
- filter_in_features_identifiers(identifiers: Sequence[str | plaid.containers.FeatureIdentifier]) Sequence[str | plaid.containers.FeatureIdentifier][source]¶
Filter and get input features features corresponding to a sorted list of identifiers.
- Parameters:
identifiers (Sequence[Union[str, FeatureIdentifier]]) – A list of identifiers for which to retrieve corresponding input features.
- Returns:
A sorted list of input feature identifiers or categories corresponding to the provided identifiers.
- Return type:
Sequence[Union[str, FeatureIdentifier]]
Example
from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() # [...] features_identifiers = ['omega', 'pressure', 'temperature'] input_features = problem.filter_in_features_identifiers(features_identifiers) print(input_features) >>> ['omega', 'pressure']
- get_out_features_identifiers() Sequence[str | plaid.containers.FeatureIdentifier][source]¶
Get the output features identifiers of the problem.
- Returns:
A list of output feature identifiers.
- Return type:
Sequence[Union[str, FeatureIdentifier]]
Example
from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() # [...] outputs_identifiers = problem.get_out_features_identifiers() print(outputs_identifiers) >>> ['compression_rate', 'in_massflow', 'isentropic_efficiency']
- set_out_features_identifiers(features_identifiers: Sequence[str | plaid.containers.FeatureIdentifier]) None[source]¶
Set the output features identifiers of the problem.
Example
from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() # [...] problem.set_out_features_identifiers(out_features_identifiers)
- add_out_features_identifiers(outputs: Sequence[str | plaid.containers.FeatureIdentifier]) None[source]¶
Add output features identifiers to the problem.
- Parameters:
outputs (Sequence[Union[str, FeatureIdentifier]]) – A list of output feature identifiers to add.
- Raises:
ValueError – if some
outputsare redondant.
Example
from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() out_features_identifiers = ['compression_rate', 'in_massflow', 'isentropic_efficiency'] problem.add_out_features_identifiers(out_features_identifiers)
- add_out_feature_identifier(output: str | plaid.containers.FeatureIdentifier) None[source]¶
Add an output feature identifier or identifier to the problem.
- Parameters:
output (FeatureIdentifier) – The identifier or identifier of the output feature to add.
- Raises:
ValueError – If the specified output feature is already in the list of outputs.
Example
from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() out_features_identifiers = 'pressure' problem.add_out_feature_identifier(out_features_identifiers)
- filter_out_features_identifiers(identifiers: Sequence[str | plaid.containers.FeatureIdentifier]) Sequence[str | plaid.containers.FeatureIdentifier][source]¶
Filter and get output features corresponding to a sorted list of identifiers.
- Parameters:
identifiers (Sequence[Union[str, FeatureIdentifier]]) – A list of identifiers for which to retrieve corresponding output features.
- Returns:
A sorted list of output feature identifiers or categories corresponding to the provided identifiers.
- Return type:
Sequence[Union[str, FeatureIdentifier]]
Example
from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() # [...] features_identifiers = ['compression_rate', 'in_massflow', 'isentropic_efficiency'] output_features = problem.filter_out_features_identifiers(features_identifiers) print(output_features) >>> ['in_massflow']
- get_constant_features_identifiers() list[str][source]¶
Get the constant features identifiers of the problem.
Example
from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() # [...] constant_features_identifiers = problem.get_constant_features_identifiers() print(constant_features_identifiers) >>> ['Global/P', 'Base_2_2/Zone/GridCoordinates']
- set_constant_features_identifiers(features_identifiers: list[str]) None[source]¶
Set the constant features identifiers of the problem.
Example
from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() # [...] problem.set_constant_features_identifiers(constant_features_identifiers)
- add_constant_features_identifiers(inputs: list[str]) None[source]¶
Add input features identifiers to the problem.
- Parameters:
inputs (list[str]) – A list of constant feature identifiers to add.
- Raises:
ValueError – If some
inputsare redondant.
Example
from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() constant_features_identifiers = ['Global/P', 'Base_2_2/Zone/GridCoordinates'] problem.add_constant_features_identifiers(constant_features_identifiers)
- add_constant_feature_identifier(input: str) None[source]¶
Add an constant feature identifier to the problem.
- Parameters:
input (str) – The identifier of the constant feature to add.
- Raises:
ValueError – If the specified input feature is already in the list of constant features.
Example
from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() constant_identifier = 'Global/P' problem.add_constant_feature_identifier(constant_identifier)
- filter_constant_features_identifiers(identifiers: list[str]) list[str][source]¶
Filter and get input features features corresponding to a sorted list of identifiers.
- Parameters:
identifiers (list[str]) – A list of identifiers for which to retrieve corresponding constant features.
- Returns:
A sorted list of constant feature identifiers corresponding to the provided identifiers.
- Return type:
Example
from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() # [...] features_identifiers = ['Global/P', 'Base_2_2/Zone/GridCoordinates'] constant_features = problem.filter_constant_features_identifiers(features_identifiers) print(constant_features) >>> ['Global/P']
- get_input_scalars_names() list[str][source]¶
DEPRECATED: use
ProblemDefinition.get_in_features_identifiers()instead.Get the input scalars names of the problem.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] input_scalars_names = problem.get_input_scalars_names() print(input_scalars_names) >>> ['omega', 'pressure']
- add_input_scalars_names(inputs: list[str]) None[source]¶
DEPRECATED: use
ProblemDefinition.add_in_features_identifiers()instead.Add input scalars names to the problem.
- Parameters:
- Raises:
ValueError – If some
inputsare redondant.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() input_scalars_names = ['omega', 'pressure'] problem.add_input_scalars_names(input_scalars_names)
- add_input_scalar_name(input: str) None[source]¶
DEPRECATED: use
ProblemDefinition.add_in_feature_identifier()instead.Add an input scalar name to the problem.
- Parameters:
input (str) – The name of the input feature to add.
- Raises:
ValueError – If the specified input feature is already in the list of inputs.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() input_name = 'pressure' problem.add_input_scalar_name(input_name)
- filter_input_scalars_names(names: list[str]) list[str][source]¶
DEPRECATED: use
ProblemDefinition.filter_in_features_identifiers()instead.Filter and get input scalars features corresponding to a list of names.
- Parameters:
names (list[str]) – A list of names for which to retrieve corresponding input features.
- Returns:
A sorted list of input feature names or categories corresponding to the provided names.
- Return type:
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] scalars_names = ['omega', 'pressure', 'temperature'] input_features = problem.filter_input_scalars_names(scalars_names) print(input_features) >>> ['omega', 'pressure']
- get_output_scalars_names() list[str][source]¶
DEPRECATED: use
ProblemDefinition.get_out_features_identifiers()instead.Get the output scalars names of the problem.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] outputs_names = problem.get_output_scalars_names() print(outputs_names) >>> ['compression_rate', 'in_massflow', 'isentropic_efficiency']
- add_output_scalars_names(outputs: list[str]) None[source]¶
DEPRECATED: use
ProblemDefinition.add_out_features_identifiers()instead.Add output scalars names to the problem.
- Parameters:
outputs (list[str]) – A list of output feature names to add.
- Raises:
ValueError – if some
outputsare redondant.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() output_scalars_names = ['compression_rate', 'in_massflow', 'isentropic_efficiency'] problem.add_output_scalars_names(output_scalars_names)
- add_output_scalar_name(output: str) None[source]¶
DEPRECATED: use
ProblemDefinition.add_out_feature_identifier()instead.Add an output scalar name to the problem.
- Parameters:
output (str) – The name of the output feature to add.
- Raises:
ValueError – If the specified output feature is already in the list of outputs.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() output_scalars_names = 'pressure' problem.add_output_scalar_name(output_scalars_names)
- filter_output_scalars_names(names: list[str]) list[str][source]¶
Filter and get output features corresponding to a list of names.
- Parameters:
names (list[str]) – A list of names for which to retrieve corresponding output features.
- Returns:
A sorted list of output feature names or categories corresponding to the provided names.
- Return type:
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] scalars_names = ['compression_rate', 'in_massflow', 'isentropic_efficiency'] output_features = problem.filter_output_scalars_names(scalars_names) print(output_features) >>> ['in_massflow']
- get_input_fields_names() list[str][source]¶
DEPRECATED: use
ProblemDefinition.get_in_features_identifiers()instead.Get the input fields names of the problem.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] input_fields_names = problem.get_input_fields_names() print(input_fields_names) >>> ['omega', 'pressure']
- add_input_fields_names(inputs: list[str]) None[source]¶
DEPRECATED: use
ProblemDefinition.add_in_features_identifiers()instead.Add input fields names to the problem.
- Parameters:
- Raises:
ValueError – If some
inputsare redondant.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() input_fields_names = ['omega', 'pressure'] problem.add_input_fields_names(input_fields_names)
- add_input_field_name(input: str) None[source]¶
DEPRECATED: use
ProblemDefinition.add_in_feature_identifier()instead.Add an input field name to the problem.
- Parameters:
input (str) – The name of the input feature to add.
- Raises:
ValueError – If the specified input feature is already in the list of inputs.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() input_name = 'pressure' problem.add_input_field_name(input_name)
- filter_input_fields_names(names: list[str]) list[str][source]¶
Filter and get input fields features corresponding to a list of names.
- Parameters:
names (list[str]) – A list of names for which to retrieve corresponding input features.
- Returns:
A sorted list of input feature names or categories corresponding to the provided names.
- Return type:
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] input_fields_names = ['omega', 'pressure', 'temperature'] input_features = problem.filter_input_fields_names(input_fields_names) print(input_features) >>> ['omega', 'pressure']
- get_output_fields_names() list[str][source]¶
DEPRECATED: use
ProblemDefinition.get_out_features_identifiers()instead.Get the output fields names of the problem.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] outputs_names = problem.get_output_fields_names() print(outputs_names) >>> ['compression_rate', 'in_massflow', 'isentropic_efficiency']
- add_output_fields_names(outputs: list[str]) None[source]¶
DEPRECATED: use
ProblemDefinition.add_out_features_identifiers()instead.Add output fields names to the problem.
- Parameters:
outputs (list[str]) – A list of output feature names to add.
- Raises:
ValueError – if some
outputsare redondant.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() output_fields_names = ['compression_rate', 'in_massflow', 'isentropic_efficiency'] problem.add_output_fields_names(output_fields_names)
- add_output_field_name(output: str) None[source]¶
DEPRECATED: use
ProblemDefinition.add_out_feature_identifier()instead.Add an output field name to the problem.
- Parameters:
output (str) – The name of the output feature to add.
- Raises:
ValueError – If the specified output feature is already in the list of outputs.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() output_fields_names = 'pressure' problem.add_output_field_name(output_fields_names)
- filter_output_fields_names(names: list[str]) list[str][source]¶
Filter and get output features corresponding to a list of names.
- Parameters:
names (list[str]) – A list of names for which to retrieve corresponding output features.
- Returns:
A sorted list of output feature names or categories corresponding to the provided names.
- Return type:
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] output_fields_names = ['compression_rate', 'in_massflow', 'isentropic_efficiency'] output_features = problem.filter_output_fields_names(output_fields_names) print(output_features) >>> ['in_massflow']
- get_input_timeseries_names() list[str][source]¶
DEPRECATED: use
ProblemDefinition.get_in_features_identifiers()instead.Get the input timeseries names of the problem.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] input_timeseries_names = problem.get_input_timeseries_names() print(input_timeseries_names) >>> ['omega', 'pressure']
- add_input_timeseries_names(inputs: list[str]) None[source]¶
DEPRECATED: use
ProblemDefinition.add_in_features_identifiers()instead.Add input timeseries names to the problem.
- Parameters:
- Raises:
ValueError – If some
inputsare redondant.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() input_timeseries_names = ['omega', 'pressure'] problem.add_input_timeseries_names(input_timeseries_names)
- add_input_timeseries_name(input: str) None[source]¶
DEPRECATED: use
ProblemDefinition.add_in_feature_identifier()instead.Add an input timeseries name to the problem.
- Parameters:
input (str) – The name of the input feature to add.
- Raises:
ValueError – If the specified input feature is already in the list of inputs.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() input_name = 'pressure' problem.add_input_timeseries_name(input_name)
- filter_input_timeseries_names(names: list[str]) list[str][source]¶
Filter and get input timeseries features corresponding to a list of names.
- Parameters:
names (list[str]) – A list of names for which to retrieve corresponding input features.
- Returns:
A sorted list of input feature names or categories corresponding to the provided names.
- Return type:
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] input_timeseries_names = ['omega', 'pressure', 'temperature'] input_features = problem.filter_input_timeseries_names(input_timeseries_names) print(input_features) >>> ['omega', 'pressure']
- get_output_timeseries_names() list[str][source]¶
DEPRECATED: use
ProblemDefinition.get_out_features_identifiers()instead.Get the output timeseries names of the problem.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] outputs_names = problem.get_output_timeseries_names() print(outputs_names) >>> ['compression_rate', 'in_massflow', 'isentropic_efficiency']
- add_output_timeseries_names(outputs: list[str]) None[source]¶
DEPRECATED: use
ProblemDefinition.add_out_features_identifiers()instead.Add output timeseries names to the problem.
- Parameters:
outputs (list[str]) – A list of output feature names to add.
- Raises:
ValueError – if some
outputsare redondant.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() output_timeseries_names = ['compression_rate', 'in_massflow', 'isentropic_efficiency'] problem.add_output_timeseries_names(output_timeseries_names)
- add_output_timeseries_name(output: str) None[source]¶
DEPRECATED: use
ProblemDefinition.add_out_feature_identifier()instead.Add an output timeseries name to the problem.
- Parameters:
output (str) – The name of the output feature to add.
- Raises:
ValueError – If the specified output feature is already in the list of outputs.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() output_timeseries_names = 'pressure' problem.add_output_timeseries_name(output_timeseries_names)
- filter_output_timeseries_names(names: list[str]) list[str][source]¶
Filter and get output features corresponding to a list of names.
- Parameters:
names (list[str]) – A list of names for which to retrieve corresponding output features.
- Returns:
A sorted list of output feature names or categories corresponding to the provided names.
- Return type:
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] output_timeseries_names = ['compression_rate', 'in_massflow', 'isentropic_efficiency'] output_features = problem.filter_output_timeseries_names(output_timeseries_names) print(output_features) >>> ['in_massflow']
- get_input_meshes_names() list[str][source]¶
DEPRECATED: use
ProblemDefinition.get_in_features_identifiers()instead.Get the input meshes names of the problem.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] input_meshes_names = problem.get_input_meshes_names() print(input_meshes_names) >>> ['omega', 'pressure']
- add_input_meshes_names(inputs: list[str]) None[source]¶
DEPRECATED: use
ProblemDefinition.add_in_features_identifiers()instead.Add input meshes names to the problem.
- Parameters:
- Raises:
ValueError – If some
inputsare redondant.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() input_meshes_names = ['omega', 'pressure'] problem.add_input_meshes_names(input_meshes_names)
- add_input_mesh_name(input: str) None[source]¶
DEPRECATED: use
ProblemDefinition.add_in_feature_identifier()instead.Add an input mesh name to the problem.
- Parameters:
input (str) – The name of the input feature to add.
- Raises:
ValueError – If the specified input feature is already in the list of inputs.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() input_name = 'pressure' problem.add_input_mesh_name(input_name)
- filter_input_meshes_names(names: list[str]) list[str][source]¶
Filter and get input meshes features corresponding to a list of names.
- Parameters:
names (list[str]) – A list of names for which to retrieve corresponding input features.
- Returns:
A sorted list of input feature names or categories corresponding to the provided names.
- Return type:
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] input_meshes_names = ['omega', 'pressure', 'temperature'] input_features = problem.filter_input_meshes_names(input_meshes_names) print(input_features) >>> ['omega', 'pressure']
- get_output_meshes_names() list[str][source]¶
DEPRECATED: use
ProblemDefinition.get_out_features_identifiers()instead.Get the output meshes names of the problem.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] outputs_names = problem.get_output_meshes_names() print(outputs_names) >>> ['compression_rate', 'in_massflow', 'isentropic_efficiency']
- add_output_meshes_names(outputs: list[str]) None[source]¶
DEPRECATED: use
ProblemDefinition.add_out_features_identifiers()instead.Add output meshes names to the problem.
- Parameters:
outputs (list[str]) – A list of output feature names to add.
- Raises:
ValueError – if some
outputsare redondant.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() output_meshes_names = ['compression_rate', 'in_massflow', 'isentropic_efficiency'] problem.add_output_meshes_names(output_meshes_names)
- add_output_mesh_name(output: str) None[source]¶
DEPRECATED: use
ProblemDefinition.add_out_feature_identifier()instead.Add an output mesh name to the problem.
- Parameters:
output (str) – The name of the output feature to add.
- Raises:
ValueError – If the specified output feature is already in the list of outputs.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() output_meshes_names = 'pressure' problem.add_output_mesh_name(output_meshes_names)
- filter_output_meshes_names(names: list[str]) list[str][source]¶
Filter and get output features corresponding to a list of names.
- Parameters:
names (list[str]) – A list of names for which to retrieve corresponding output features.
- Returns:
A sorted list of output feature names or categories corresponding to the provided names.
- Return type:
Example
from plaid import ProblemDefinition problem = ProblemDefinition() # [...] output_meshes_names = ['compression_rate', 'in_massflow', 'isentropic_efficiency'] output_features = problem.filter_output_meshes_names(output_meshes_names) print(output_features) >>> ['in_massflow']
- save_to_file(path: str | pathlib.Path) None[source]¶
Save problem information, inputs, outputs, and split to the specified file in YAML format.
- Parameters:
path (Union[str,Path]) – The filepath where the problem information will be saved.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() problem.save_to_file("/path/to/save_file")
- save_to_dir(path: str | pathlib.Path) None[source]¶
Save problem information, inputs, outputs, and split to the specified directory in YAML and CSV formats.
- Parameters:
path (Union[str,Path]) – The directory where the problem information will be saved.
Example
from plaid import ProblemDefinition problem = ProblemDefinition() problem.save_to_dir("/path/to/save_directory")
- classmethod load(path: str | pathlib.Path) Self[source]¶
Load data from a specified directory.
- extract_problem_definition_from_identifiers(identifiers: Sequence[str | plaid.containers.FeatureIdentifier]) Self[source]¶
Create a new ProblemDefinition restricted to a subset of feature identifiers.
- Parameters:
identifiers (Sequence[Union[str, FeatureIdentifier]]) – List of identifiers to keep.
- Returns:
A new
ProblemDefinitioninstance.- Return type: