plaid.problem_definition ======================== .. py:module:: plaid.problem_definition .. autoapi-nested-parse:: Implementation of the `ProblemDefinition` class. Attributes ---------- .. autoapisummary:: plaid.problem_definition.Self Classes ------- .. autoapisummary:: plaid.problem_definition.ProblemDefinition Module Contents --------------- .. py:data:: Self .. py:class:: ProblemDefinition(path: Optional[Union[str, pathlib.Path]] = None, directory_path: Optional[Union[str, pathlib.Path]] = None) Bases: :py:obj:`object` Gathers all necessary informations to define a learning problem. Initialize an empty :class:`ProblemDefinition `. Use :meth:`add_inputs ` or :meth:`add_output_scalars_names ` to feed the :class:`ProblemDefinition` :param path: The path from which to load PLAID problem definition files. :type path: Union[str,Path], optional :param directory_path: Deprecated, use `path` instead. :type directory_path: Union[str,Path], optional .. rubric:: Example .. code-block:: python 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') .. py:attribute:: in_features_identifiers :type: Sequence[Union[str, plaid.containers.FeatureIdentifier]] :value: [] .. py:attribute:: out_features_identifiers :type: Sequence[Union[str, plaid.containers.FeatureIdentifier]] :value: [] .. py:attribute:: constant_features_identifiers :type: list[str] :value: [] .. py:attribute:: in_scalars_names :type: list[str] :value: [] .. py:attribute:: out_scalars_names :type: list[str] :value: [] .. py:attribute:: in_timeseries_names :type: list[str] :value: [] .. py:attribute:: out_timeseries_names :type: list[str] :value: [] .. py:attribute:: in_fields_names :type: list[str] :value: [] .. py:attribute:: out_fields_names :type: list[str] :value: [] .. py:attribute:: in_meshes_names :type: list[str] :value: [] .. py:attribute:: out_meshes_names :type: list[str] :value: [] .. py:method:: get_name() -> str Get the name. None if not defined. :returns: The name, such as "regression_1". :rtype: str .. py:method:: set_name(name: str) -> None Set the name. :param name: The name, such as "regression_1". :type name: str .. py:method:: get_version() -> packaging.version.Version Get the version. None if not defined. :returns: The version, such as "0.1.0". :rtype: Version .. py:method:: get_task() -> str Get the authorized task. None if not defined. :returns: The authorized task, such as "regression" or "classification". :rtype: str .. py:method:: set_task(task: str) -> None Set the authorized task. :param task: The authorized task to be set, such as "regression" or "classification". :type task: str .. py:method:: get_score_function() -> str Get the authorized score function. None if not defined. :returns: The authorized score function, such as "RRMSE". :rtype: str .. py:method:: set_score_function(score_function: str) -> None Set the authorized score function. :param score_function: The authorized score function, such as "RRMSE". :type score_function: str .. py:method:: get_split(indices_name: Optional[str] = None) -> Union[plaid.types.IndexType, dict[str, plaid.types.IndexType]] 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. :param indices_name: The name of the split for which indices are requested. Defaults to None. :type indices_name: str, optional :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). :rtype: Union[IndexType,dict[str,IndexType]] .. rubric:: Example .. code-block:: python 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, ...] .. py:method:: set_split(split: dict[str, plaid.types.IndexType]) -> None 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). :param split: A dictionary containing split names and their indices. :type split: dict[str,IndexType] .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() new_split = {'train': [0, 1, 2], 'test': [3, 4]} problem.set_split(new_split) .. py:method:: get_train_split(indices_name: Optional[str] = None) -> Union[dict[str, plaid.types.IndexType], dict[str, dict[str, plaid.types.IndexType]]] Get the train split indices for different subsets of the dataset. :param indices_name: The name of the specific train split subset for which indices are requested. Defaults to None. :type indices_name: str, optional :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. :rtype: Union[dict[str, IndexType], dict[str, dict[str, IndexType]]] :raises AssertionError: If indices_name is provided but not found in the train split. .. py:method:: set_train_split(split: dict[str, dict[str, Optional[plaid.types.IndexType]]]) -> None Set the train split dictionary containing subsets and their indices. :param split: Dictionary mapping train subset names to their split dictionaries. Each split dictionary maps split names (e.g., 'train', 'val') to their indices. :type split: dict[str, dict[str, IndexType]] .. note:: If a train split already exists, it will be replaced and a warning will be logged. .. py:method:: get_test_split(indices_name: Optional[str] = None) -> Union[dict[str, plaid.types.IndexType], dict[str, dict[str, plaid.types.IndexType]]] Get the test split indices for different subsets of the dataset. :param indices_name: The name of the specific test split subset for which indices are requested. Defaults to None. :type indices_name: str, optional :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. :rtype: Union[dict[str, IndexType], dict[str, dict[str, IndexType]]] :raises AssertionError: If indices_name is provided but not found in the test split. .. py:method:: set_test_split(split: dict[str, dict[str, Optional[plaid.types.IndexType]]]) -> None Set the test split dictionary containing subsets and their indices. :param split: Dictionary mapping test subset names to their split dictionaries. Each split dictionary maps split names (e.g., 'test', 'test_ood') to their indices. :type split: dict[str, dict[str, IndexType]] .. note:: If a test split already exists, it will be replaced and a warning will be logged. .. py:method:: get_in_features_identifiers() -> Sequence[Union[str, plaid.containers.FeatureIdentifier]] Get the input features identifiers of the problem. :returns: A list of input feature identifiers. :rtype: Sequence[Union[str, FeatureIdentifier]] .. rubric:: Example .. code-block:: python from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() # [...] in_features_identifiers = problem.get_in_features_identifiers() print(in_features_identifiers) >>> ['omega', 'pressure'] .. py:method:: add_in_features_identifiers(inputs: Sequence[Union[str, plaid.containers.FeatureIdentifier]]) -> None Add input features identifiers to the problem. :param inputs: A list of input feature identifiers to add. :type inputs: Sequence[Union[str, FeatureIdentifier]] :raises ValueError: If some :code:`inputs` are redondant. .. rubric:: Example .. code-block:: python from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() in_features_identifiers = ['omega', 'pressure'] problem.add_in_features_identifiers(in_features_identifiers) .. py:method:: add_in_feature_identifier(input: Union[str, plaid.containers.FeatureIdentifier]) -> None Add an input feature identifier or identifier to the problem. :param input: The identifier or identifier of the input feature to add. :type input: FeatureIdentifier :raises ValueError: If the specified input feature is already in the list of inputs. .. rubric:: Example .. code-block:: python from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() input_identifier = 'pressure' problem.add_in_feature_identifier(input_identifier) .. py:method:: filter_in_features_identifiers(identifiers: Sequence[Union[str, plaid.containers.FeatureIdentifier]]) -> Sequence[Union[str, plaid.containers.FeatureIdentifier]] Filter and get input features features corresponding to a sorted list of identifiers. :param identifiers: A list of identifiers for which to retrieve corresponding input features. :type identifiers: Sequence[Union[str, FeatureIdentifier]] :returns: A sorted list of input feature identifiers or categories corresponding to the provided identifiers. :rtype: Sequence[Union[str, FeatureIdentifier]] .. rubric:: Example .. code-block:: python 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'] .. py:method:: get_out_features_identifiers() -> Sequence[Union[str, plaid.containers.FeatureIdentifier]] Get the output features identifiers of the problem. :returns: A list of output feature identifiers. :rtype: Sequence[Union[str, FeatureIdentifier]] .. rubric:: Example .. code-block:: python from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() # [...] outputs_identifiers = problem.get_out_features_identifiers() print(outputs_identifiers) >>> ['compression_rate', 'in_massflow', 'isentropic_efficiency'] .. py:method:: add_out_features_identifiers(outputs: Sequence[Union[str, plaid.containers.FeatureIdentifier]]) -> None Add output features identifiers to the problem. :param outputs: A list of output feature identifiers to add. :type outputs: Sequence[Union[str, FeatureIdentifier]] :raises ValueError: if some :code:`outputs` are redondant. .. rubric:: Example .. code-block:: python 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) .. py:method:: add_out_feature_identifier(output: Union[str, plaid.containers.FeatureIdentifier]) -> None Add an output feature identifier or identifier to the problem. :param output: The identifier or identifier of the output feature to add. :type output: FeatureIdentifier :raises ValueError: If the specified output feature is already in the list of outputs. .. rubric:: Example .. code-block:: python from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() out_features_identifiers = 'pressure' problem.add_out_feature_identifier(out_features_identifiers) .. py:method:: filter_out_features_identifiers(identifiers: Sequence[Union[str, plaid.containers.FeatureIdentifier]]) -> Sequence[Union[str, plaid.containers.FeatureIdentifier]] Filter and get output features corresponding to a sorted list of identifiers. :param identifiers: A list of identifiers for which to retrieve corresponding output features. :type identifiers: Sequence[Union[str, FeatureIdentifier]] :returns: A sorted list of output feature identifiers or categories corresponding to the provided identifiers. :rtype: Sequence[Union[str, FeatureIdentifier]] .. rubric:: Example .. code-block:: python 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'] .. py:method:: get_constant_features_identifiers() -> list[str] Get the constant features identifiers of the problem. :returns: A list of constant feature identifiers. :rtype: list[str] .. rubric:: Example .. code-block:: python 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'] .. py:method:: add_constant_features_identifiers(inputs: list[str]) -> None Add input features identifiers to the problem. :param inputs: A list of constant feature identifiers to add. :type inputs: list[str] :raises ValueError: If some :code:`inputs` are redondant. .. rubric:: Example .. code-block:: python 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) .. py:method:: add_constant_feature_identifier(input: str) -> None Add an constant feature identifier to the problem. :param input: The identifier of the constant feature to add. :type input: str :raises ValueError: If the specified input feature is already in the list of constant features. .. rubric:: Example .. code-block:: python from plaid.problem_definition import ProblemDefinition problem = ProblemDefinition() constant_identifier = 'Global/P' problem.add_constant_feature_identifier(constant_identifier) .. py:method:: filter_constant_features_identifiers(identifiers: list[str]) -> list[str] Filter and get input features features corresponding to a sorted list of identifiers. :param identifiers: A list of identifiers for which to retrieve corresponding constant features. :type identifiers: list[str] :returns: A sorted list of constant feature identifiers corresponding to the provided identifiers. :rtype: list[str] .. rubric:: Example .. code-block:: python 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'] .. py:method:: get_input_scalars_names() -> list[str] DEPRECATED: use :meth:`ProblemDefinition.get_in_features_identifiers` instead. Get the input scalars names of the problem. :returns: A list of input feature names. :rtype: list[str] .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() # [...] input_scalars_names = problem.get_input_scalars_names() print(input_scalars_names) >>> ['omega', 'pressure'] .. py:method:: add_input_scalars_names(inputs: list[str]) -> None DEPRECATED: use :meth:`ProblemDefinition.add_in_features_identifiers` instead. Add input scalars names to the problem. :param inputs: A list of input feature names to add. :type inputs: list[str] :raises ValueError: If some :code:`inputs` are redondant. .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() input_scalars_names = ['omega', 'pressure'] problem.add_input_scalars_names(input_scalars_names) .. py:method:: add_input_scalar_name(input: str) -> None DEPRECATED: use :meth:`ProblemDefinition.add_in_feature_identifier` instead. Add an input scalar name to the problem. :param input: The name of the input feature to add. :type input: str :raises ValueError: If the specified input feature is already in the list of inputs. .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() input_name = 'pressure' problem.add_input_scalar_name(input_name) .. py:method:: filter_input_scalars_names(names: list[str]) -> list[str] DEPRECATED: use :meth:`ProblemDefinition.filter_in_features_identifiers` instead. Filter and get input scalars features corresponding to a list of names. :param names: A list of names for which to retrieve corresponding input features. :type names: list[str] :returns: A sorted list of input feature names or categories corresponding to the provided names. :rtype: list[str] .. rubric:: Example .. code-block:: python 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'] .. py:method:: get_output_scalars_names() -> list[str] DEPRECATED: use :meth:`ProblemDefinition.get_out_features_identifiers` instead. Get the output scalars names of the problem. :returns: A list of output feature names. :rtype: list[str] .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() # [...] outputs_names = problem.get_output_scalars_names() print(outputs_names) >>> ['compression_rate', 'in_massflow', 'isentropic_efficiency'] .. py:method:: add_output_scalars_names(outputs: list[str]) -> None DEPRECATED: use :meth:`ProblemDefinition.add_out_features_identifiers` instead. Add output scalars names to the problem. :param outputs: A list of output feature names to add. :type outputs: list[str] :raises ValueError: if some :code:`outputs` are redondant. .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() output_scalars_names = ['compression_rate', 'in_massflow', 'isentropic_efficiency'] problem.add_output_scalars_names(output_scalars_names) .. py:method:: add_output_scalar_name(output: str) -> None DEPRECATED: use :meth:`ProblemDefinition.add_out_feature_identifier` instead. Add an output scalar name to the problem. :param output: The name of the output feature to add. :type output: str :raises ValueError: If the specified output feature is already in the list of outputs. .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() output_scalars_names = 'pressure' problem.add_output_scalar_name(output_scalars_names) .. py:method:: filter_output_scalars_names(names: list[str]) -> list[str] Filter and get output features corresponding to a list of names. :param names: A list of names for which to retrieve corresponding output features. :type names: list[str] :returns: A sorted list of output feature names or categories corresponding to the provided names. :rtype: list[str] .. rubric:: Example .. code-block:: python 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'] .. py:method:: get_input_fields_names() -> list[str] DEPRECATED: use :meth:`ProblemDefinition.get_in_features_identifiers` instead. Get the input fields names of the problem. :returns: A list of input feature names. :rtype: list[str] .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() # [...] input_fields_names = problem.get_input_fields_names() print(input_fields_names) >>> ['omega', 'pressure'] .. py:method:: add_input_fields_names(inputs: list[str]) -> None DEPRECATED: use :meth:`ProblemDefinition.add_in_features_identifiers` instead. Add input fields names to the problem. :param inputs: A list of input feature names to add. :type inputs: list[str] :raises ValueError: If some :code:`inputs` are redondant. .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() input_fields_names = ['omega', 'pressure'] problem.add_input_fields_names(input_fields_names) .. py:method:: add_input_field_name(input: str) -> None DEPRECATED: use :meth:`ProblemDefinition.add_in_feature_identifier` instead. Add an input field name to the problem. :param input: The name of the input feature to add. :type input: str :raises ValueError: If the specified input feature is already in the list of inputs. .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() input_name = 'pressure' problem.add_input_field_name(input_name) .. py:method:: filter_input_fields_names(names: list[str]) -> list[str] Filter and get input fields features corresponding to a list of names. :param names: A list of names for which to retrieve corresponding input features. :type names: list[str] :returns: A sorted list of input feature names or categories corresponding to the provided names. :rtype: list[str] .. rubric:: Example .. code-block:: python 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'] .. py:method:: get_output_fields_names() -> list[str] DEPRECATED: use :meth:`ProblemDefinition.get_out_features_identifiers` instead. Get the output fields names of the problem. :returns: A list of output feature names. :rtype: list[str] .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() # [...] outputs_names = problem.get_output_fields_names() print(outputs_names) >>> ['compression_rate', 'in_massflow', 'isentropic_efficiency'] .. py:method:: add_output_fields_names(outputs: list[str]) -> None DEPRECATED: use :meth:`ProblemDefinition.add_out_features_identifiers` instead. Add output fields names to the problem. :param outputs: A list of output feature names to add. :type outputs: list[str] :raises ValueError: if some :code:`outputs` are redondant. .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() output_fields_names = ['compression_rate', 'in_massflow', 'isentropic_efficiency'] problem.add_output_fields_names(output_fields_names) .. py:method:: add_output_field_name(output: str) -> None DEPRECATED: use :meth:`ProblemDefinition.add_out_feature_identifier` instead. Add an output field name to the problem. :param output: The name of the output feature to add. :type output: str :raises ValueError: If the specified output feature is already in the list of outputs. .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() output_fields_names = 'pressure' problem.add_output_field_name(output_fields_names) .. py:method:: filter_output_fields_names(names: list[str]) -> list[str] Filter and get output features corresponding to a list of names. :param names: A list of names for which to retrieve corresponding output features. :type names: list[str] :returns: A sorted list of output feature names or categories corresponding to the provided names. :rtype: list[str] .. rubric:: Example .. code-block:: python 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'] .. py:method:: get_input_timeseries_names() -> list[str] DEPRECATED: use :meth:`ProblemDefinition.get_in_features_identifiers` instead. Get the input timeseries names of the problem. :returns: A list of input feature names. :rtype: list[str] .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() # [...] input_timeseries_names = problem.get_input_timeseries_names() print(input_timeseries_names) >>> ['omega', 'pressure'] .. py:method:: add_input_timeseries_names(inputs: list[str]) -> None DEPRECATED: use :meth:`ProblemDefinition.add_in_features_identifiers` instead. Add input timeseries names to the problem. :param inputs: A list of input feature names to add. :type inputs: list[str] :raises ValueError: If some :code:`inputs` are redondant. .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() input_timeseries_names = ['omega', 'pressure'] problem.add_input_timeseries_names(input_timeseries_names) .. py:method:: add_input_timeseries_name(input: str) -> None DEPRECATED: use :meth:`ProblemDefinition.add_in_feature_identifier` instead. Add an input timeseries name to the problem. :param input: The name of the input feature to add. :type input: str :raises ValueError: If the specified input feature is already in the list of inputs. .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() input_name = 'pressure' problem.add_input_timeseries_name(input_name) .. py:method:: filter_input_timeseries_names(names: list[str]) -> list[str] Filter and get input timeseries features corresponding to a list of names. :param names: A list of names for which to retrieve corresponding input features. :type names: list[str] :returns: A sorted list of input feature names or categories corresponding to the provided names. :rtype: list[str] .. rubric:: Example .. code-block:: python 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'] .. py:method:: get_output_timeseries_names() -> list[str] DEPRECATED: use :meth:`ProblemDefinition.get_out_features_identifiers` instead. Get the output timeseries names of the problem. :returns: A list of output feature names. :rtype: list[str] .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() # [...] outputs_names = problem.get_output_timeseries_names() print(outputs_names) >>> ['compression_rate', 'in_massflow', 'isentropic_efficiency'] .. py:method:: add_output_timeseries_names(outputs: list[str]) -> None DEPRECATED: use :meth:`ProblemDefinition.add_out_features_identifiers` instead. Add output timeseries names to the problem. :param outputs: A list of output feature names to add. :type outputs: list[str] :raises ValueError: if some :code:`outputs` are redondant. .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() output_timeseries_names = ['compression_rate', 'in_massflow', 'isentropic_efficiency'] problem.add_output_timeseries_names(output_timeseries_names) .. py:method:: add_output_timeseries_name(output: str) -> None DEPRECATED: use :meth:`ProblemDefinition.add_out_feature_identifier` instead. Add an output timeseries name to the problem. :param output: The name of the output feature to add. :type output: str :raises ValueError: If the specified output feature is already in the list of outputs. .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() output_timeseries_names = 'pressure' problem.add_output_timeseries_name(output_timeseries_names) .. py:method:: filter_output_timeseries_names(names: list[str]) -> list[str] Filter and get output features corresponding to a list of names. :param names: A list of names for which to retrieve corresponding output features. :type names: list[str] :returns: A sorted list of output feature names or categories corresponding to the provided names. :rtype: list[str] .. rubric:: Example .. code-block:: python 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'] .. py:method:: get_input_meshes_names() -> list[str] DEPRECATED: use :meth:`ProblemDefinition.get_in_features_identifiers` instead. Get the input meshes names of the problem. :returns: A list of input feature names. :rtype: list[str] .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() # [...] input_meshes_names = problem.get_input_meshes_names() print(input_meshes_names) >>> ['omega', 'pressure'] .. py:method:: add_input_meshes_names(inputs: list[str]) -> None DEPRECATED: use :meth:`ProblemDefinition.add_in_features_identifiers` instead. Add input meshes names to the problem. :param inputs: A list of input feature names to add. :type inputs: list[str] :raises ValueError: If some :code:`inputs` are redondant. .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() input_meshes_names = ['omega', 'pressure'] problem.add_input_meshes_names(input_meshes_names) .. py:method:: add_input_mesh_name(input: str) -> None DEPRECATED: use :meth:`ProblemDefinition.add_in_feature_identifier` instead. Add an input mesh name to the problem. :param input: The name of the input feature to add. :type input: str :raises ValueError: If the specified input feature is already in the list of inputs. .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() input_name = 'pressure' problem.add_input_mesh_name(input_name) .. py:method:: filter_input_meshes_names(names: list[str]) -> list[str] Filter and get input meshes features corresponding to a list of names. :param names: A list of names for which to retrieve corresponding input features. :type names: list[str] :returns: A sorted list of input feature names or categories corresponding to the provided names. :rtype: list[str] .. rubric:: Example .. code-block:: python 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'] .. py:method:: get_output_meshes_names() -> list[str] DEPRECATED: use :meth:`ProblemDefinition.get_out_features_identifiers` instead. Get the output meshes names of the problem. :returns: A list of output feature names. :rtype: list[str] .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() # [...] outputs_names = problem.get_output_meshes_names() print(outputs_names) >>> ['compression_rate', 'in_massflow', 'isentropic_efficiency'] .. py:method:: add_output_meshes_names(outputs: list[str]) -> None DEPRECATED: use :meth:`ProblemDefinition.add_out_features_identifiers` instead. Add output meshes names to the problem. :param outputs: A list of output feature names to add. :type outputs: list[str] :raises ValueError: if some :code:`outputs` are redondant. .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() output_meshes_names = ['compression_rate', 'in_massflow', 'isentropic_efficiency'] problem.add_output_meshes_names(output_meshes_names) .. py:method:: add_output_mesh_name(output: str) -> None DEPRECATED: use :meth:`ProblemDefinition.add_out_feature_identifier` instead. Add an output mesh name to the problem. :param output: The name of the output feature to add. :type output: str :raises ValueError: If the specified output feature is already in the list of outputs. .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() output_meshes_names = 'pressure' problem.add_output_mesh_name(output_meshes_names) .. py:method:: filter_output_meshes_names(names: list[str]) -> list[str] Filter and get output features corresponding to a list of names. :param names: A list of names for which to retrieve corresponding output features. :type names: list[str] :returns: A sorted list of output feature names or categories corresponding to the provided names. :rtype: list[str] .. rubric:: Example .. code-block:: python 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'] .. py:method:: get_all_indices() -> list[int] Get all indices from splits. :returns: list containing all unique indices. :rtype: list[int] .. py:method:: save_to_file(path: Union[str, pathlib.Path]) -> None Save problem information, inputs, outputs, and split to the specified file in YAML format. :param path: The filepath where the problem information will be saved. :type path: Union[str,Path] .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() problem.save_to_file("/path/to/save_file") .. py:method:: save_to_dir(path: Union[str, pathlib.Path]) -> None Save problem information, inputs, outputs, and split to the specified directory in YAML and CSV formats. :param path: The directory where the problem information will be saved. :type path: Union[str,Path] .. rubric:: Example .. code-block:: python from plaid import ProblemDefinition problem = ProblemDefinition() problem.save_to_dir("/path/to/save_directory") .. py:method:: load(path: Union[str, pathlib.Path]) -> Self :classmethod: Load data from a specified directory. :param path: The path from which to load files. :type path: Union[str,Path] :returns: The loaded dataset (Dataset). :rtype: Self .. py:method:: extract_problem_definition_from_identifiers(identifiers: Sequence[Union[str, plaid.containers.FeatureIdentifier]]) -> Self Create a new ProblemDefinition restricted to a subset of feature identifiers. :param identifiers: List of identifiers to keep. :type identifiers: Sequence[Union[str, FeatureIdentifier]] :returns: A new :class:`ProblemDefinition` instance. :rtype: ProblemDefinition