Skip to content

Datasets

datasets

Attributes

DatasetInput module-attribute

DatasetInput = Annotated[
    IODataset, BeforeValidator(_coerce_to_dataset)
]

A dataset field accepting a mapping, a DataFrame or a Dataset.

Use this instead of Dataset or IODataset when declaring the field of a tool, so that users can pass the data they already have. The conversion is carried by the annotation rather than by the tool, so that it also applies when the inputs model is built directly, as done by the workflow engine.

Classes

DatasetAddFromModel

Methods:
add_group classmethod
add_group(
    dataset,
    input_group_name: str,
    input_variable_names: Iterable[str],
    model: IntegratedModel,
    output_group_name: str,
    output_variable_name: str,
    bias: float = 0.0,
) -> None

Add group based on the outputs of a model, its inputs being contained in the dataset.

Source code in src\vimseo\utilities\datasets.py
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
@classmethod
def add_group(
    cls,
    dataset,
    input_group_name: str,
    input_variable_names: Iterable[str],
    model: IntegratedModel,
    output_group_name: str,
    output_variable_name: str,
    bias: float = 0.0,
) -> None:
    """Add group based on the outputs of a model, its inputs being contained in the
    dataset."""
    out = []
    for i in range(dataset.shape[0]):
        input_data = {}
        for name in input_variable_names:
            input_data[name] = dataset.get_view(
                group_names=input_group_name,
                variable_names=name,
            ).values[i]
        model.execute(input_data)
        out.append(model.get_output_data()[output_variable_name])
    out = array(out)
    out += bias
    dataset.add_group(
        data=out,
        group_name=output_group_name,
        variable_names=output_variable_name,
    )

DatasetAddFromStatistics

DatasetAddFromStatistics()
Source code in src\vimseo\utilities\datasets.py
124
125
def __init__(self):
    self.space_for_sample_generation = ParameterSpace()
Methods:
add_group
add_group(
    dataset,
    group_name: str,
    variable_names: str,
    distributions: Mapping[str, DistributionParameters],
    nb_samples: int,
) -> None

Add group based on statistical parameters using OpenTurns distributions.

Source code in src\vimseo\utilities\datasets.py
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
def add_group(
    self,
    dataset,
    group_name: str,
    variable_names: str,
    distributions: Mapping[str, DistributionParameters],
    nb_samples: int,
) -> None:
    """Add group based on statistical parameters using OpenTurns distributions."""
    from vimseo.tools.space.random_variable_interface import (
        add_random_variable_interface,
    )

    for name in variable_names:
        assert name in distributions
        add_random_variable_interface(
            self.space_for_sample_generation,
            name,
            distributions[name],
        )
    samples = self.space_for_sample_generation.compute_samples(n_samples=nb_samples)
    measured_dataset = Dataset.from_array(samples, variable_names=variable_names)
    variable_names_to_n_components = dict.fromkeys(variable_names, 1)
    dataset.add_group(
        group_name=group_name,
        variable_names=variable_names,
        data=vstack([
            measured_dataset.get_view(variable_names=name).values.flatten()
            for name in variable_names
        ]).T,
        variable_names_to_n_components=variable_names_to_n_components,
    )

Variable

Bases: NamedTuple

A convenient data class to define a variable to be placed in a Dataset.

Functions:

assert_frame_equal_unordered

assert_frame_equal_unordered(
    df1: DataFrame, df2: DataFrame, **kwargs
)

Compare two DataFrames regardliess of column and row order.

Source code in src\vimseo\utilities\datasets.py
783
784
785
786
787
788
def assert_frame_equal_unordered(df1: DataFrame, df2: DataFrame, **kwargs):
    """Compare two DataFrames regardliess of column and row order."""
    cols = sorted(df1.columns)
    df1 = df1[cols]
    df2 = df2[cols]
    testing.assert_frame_equal(df1, df2, **kwargs)

dataframe_to_dataset

dataframe_to_dataset(df: DataFrame) -> Dataset

Compute the GEMSEO Dataset from a DataFrame with a_name{a_group}[a_component] convention.

For vectors, naming convention is a_name{a_group}[0], a_name{a_group}[1], ... This naming convention is obtained with dataset_to_dataframe() with argument suffix_by_group=True.

This is the advanced, lossless counterpart of :func:dataset_to_dataframe, meant for round-tripping a dataset through a mono-indexed DataFrame. To build a dataset from data that does not already follow this convention, use :func:to_dataset instead.

Source code in src\vimseo\utilities\datasets.py
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
def dataframe_to_dataset(df: DataFrame) -> Dataset:
    """Compute the GEMSEO Dataset from a DataFrame with a_name{a_group}[a_component]
    convention.

    For vectors, naming convention is a_name{a_group}[0], a_name{a_group}[1], ...
    This naming convention is obtained with ``dataset_to_dataframe()`` with argument
    ``suffix_by_group=True``.

    This is the advanced, lossless counterpart of :func:`dataset_to_dataframe`, meant for
    round-tripping a dataset through a mono-indexed DataFrame. To build a dataset from
    data that does not already follow this convention, use :func:`to_dataset` instead.
    """

    def get_group_name(suffixed_name: str) -> str:
        return (suffixed_name.split(GROUP_SEPARATORS[1])[0]).split(GROUP_SEPARATORS[0])[
            1
        ]

    def get_variable_name(suffixed_name: str) -> str:
        return suffixed_name.split(GROUP_SEPARATORS[0])[0]

    def get_component(suffixed_name: str) -> str:
        component_suffix = suffixed_name.split(GROUP_SEPARATORS[1])[1]
        return (
            (component_suffix.split(COMPONENT_SEPARATORS[0])[1]).split(
                COMPONENT_SEPARATORS[1]
            )[0]
            if component_suffix
            else "0"
        )

    unique_names_to_group_names = {}
    for name in df.columns.values:
        variable_name = get_variable_name(name)
        group_name = get_group_name(name)
        component = get_component(name)
        unique_names_to_group_names[
            f"{variable_name}__group__{group_name}__component__{component}"
        ] = group_name

    names_and_groups = [
        unique_name.split("__component__")[0]
        for unique_name in unique_names_to_group_names
    ]
    unique_names_to_n_components = {}
    for name in set(names_and_groups):
        unique_names_to_n_components[name] = names_and_groups.count(name)

    unique_names = list(unique_names_to_n_components.keys())
    unique_names_to_group_names = {
        name.split("__component__")[0]: group_name
        for name, group_name in unique_names_to_group_names.items()
    }

    reordered_unique_names = []
    for name in df.columns.values:
        if get_component(name) != "0":
            continue
        variable_name = get_variable_name(name)
        group_name = get_group_name(name)
        reordered_unique_names.extend(
            unique_name
            for unique_name in unique_names
            if unique_name.split("__group__")[0] == variable_name
            and unique_name.split("__group__")[1] == group_name
        )

    dataset = Dataset.from_array(
        df.to_numpy(),
        variable_names=reordered_unique_names,
        variable_names_to_n_components=unique_names_to_n_components,
        variable_names_to_group_names=unique_names_to_group_names,
    )

    for group_name in dataset.group_names:
        for unique_name in dataset.get_variable_names(group_name=group_name):
            name = unique_name.split("__group__")[0]
            dataset.rename_variable(unique_name, name, group_name)

    return dataset.astype({col: df.dtypes[i] for i, col in enumerate(dataset.columns)})

dataset_to_dataframe

dataset_to_dataframe(
    dataset: Dataset,
    variable_names: list[str] = (),
    group_names: list[str] = (),
    suffix_by_group: bool = False,
) -> DataFrame

Extracts variables from a GEMSEO dataset, and store them in a mono-indexed DataFrame with variable naming convention a_name[a_group][a_component] .

Source code in src\vimseo\utilities\datasets.py
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
def dataset_to_dataframe(
    dataset: Dataset,
    variable_names: list[str] = (),
    group_names: list[str] = (),
    suffix_by_group: bool = False,
) -> DataFrame:
    """Extracts variables from a GEMSEO dataset, and store them in a mono-indexed
    DataFrame with variable naming convention a_name[a_group][a_component] ."""
    sep = "__group__"
    group_names = group_names if len(group_names) > 0 else dataset.group_names

    name_and_groups = []
    for group_name in group_names:
        name_and_groups.extend(
            f"{name}{sep}{group_name}"
            for name in dataset.get_variable_names(group_name=group_name)
        )
    group_names = [s.split(sep)[-1] for s in name_and_groups]

    names = [v.split(sep)[0] for v in name_and_groups]
    seen = set()

    if suffix_by_group:
        duplicated_names = names
    else:
        duplicated_names = []
        for x in names:
            if x not in seen:
                seen.add(x)
            else:
                duplicated_names.append(x)

    variable_names = variable_names if len(variable_names) > 0 else names
    final_names = [name for name in variable_names if name not in duplicated_names]

    duplicated_name_and_groups = []
    for name in duplicated_names:
        duplicated_name_and_groups.extend(
            v for v in name_and_groups if v.startswith(name)
        )

    ds = dataset.copy()
    for v in duplicated_name_and_groups:
        splitted_name = v.split(sep)
        name = splitted_name[0]
        group_name = splitted_name[1]
        new_name = f"{name}{GROUP_SEPARATORS[0]}{group_name}{GROUP_SEPARATORS[1]}"
        ds.rename_variable(name, new_name, group_name)
        if name in variable_names:
            final_names.append(new_name)

    view = ds.get_view(group_names=group_names, variable_names=final_names)
    df = view.copy()
    df.columns = view.get_columns(as_tuple=False)
    df_as_dict = df.to_dict()
    return DataFrame.from_dict(df_as_dict)

decode_vector

decode_vector(vector_as_str: str, separator='_') -> ndarray

Decode a stringified vector.

Parameters:

  • vector_as_str (str) –

    A vector as a string, under the form of numerical values

  • separator –

    The separator between ply angles.

Returns:

  • ndarray –

    A vector_as_str as an array of floats, compatible as a model input.

Source code in src\vimseo\utilities\datasets.py
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
def decode_vector(vector_as_str: str, separator="_") -> ndarray:
    """Decode a stringified vector.

    Args:
        vector_as_str: A vector as a ``string``, under the form of numerical values
        separated by ``separator``. Square brackets at the beginning
        and the end of the string are allowed
        (typically if the string is obtained from str(NumPy.array)).
        separator: The separator between ply angles.

    Returns:
        A vector_as_str as an array of ``floats``, compatible as a model input.
    """
    vector_as_str = vector_as_str.strip("[]")
    splitted_str = vector_as_str.split(separator)
    splitted_str = [val for val in splitted_str if val != ""]
    return asarray(splitted_str, dtype=float)

encode_vector

encode_vector(
    vector_numerical: ndarray | list[float | int],
)

Encode a vector_as_str.

Example

encode_vector(array([0,90,0])

Args: vector_numerical: [ndarray] A 1D array containing numerical values of plies angles. Returns: vector_as_str_str: [ndarray] An array containing a single string of encoded angle values.

Source code in src\vimseo\utilities\datasets.py
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
def encode_vector(vector_numerical: ndarray | list[float | int]):
    """Encode a vector_as_str.

    Example:
        >>> encode_vector(array([0,90,0])
    Args:
        vector_numerical: [ndarray] A 1D array containing numerical values of plies
        angles.
    Returns:
        vector_as_str_str: [ndarray] An array containing a single string of encoded
        angle values.
    """
    if isinstance(vector_numerical, list):
        vector_numerical = array(vector_numerical)

    if array(vector_numerical).ndim != 1 or len(vector_numerical) == 0:
        msg = "Expecting 1D array but it was given "
        raise ValueError(
            msg,
            array(vector_numerical).ndim,
            vector_numerical,
        )
    if not (
        issubdtype(vector_numerical.dtype, integer)
        or issubdtype(vector_numerical.dtype, float)
    ):
        msg = "vector_as_str to encode is expected to be a numerical array, but not "
        raise TypeError(
            msg,
            vector_numerical,
        )

    # [0, 90.1, 0.0] => [0, 90.1, 0]
    vector_as_str_interm = [int(a) if a == int(a) else a for a in vector_numerical]

    # [0, 90.1, 0] => ["0", "90.1", "0"]
    vector_as_str_interm = asarray(vector_as_str_interm, dtype=str)

    # ["0", "90.1", "0"] => ["0_90.1_0"]
    return "_".join(vector_as_str_interm)

get_nb_input_variables

get_nb_input_variables(dataset: IODataset)

Compute the number of input variables.

Source code in src\vimseo\utilities\datasets.py
234
235
236
def get_nb_input_variables(dataset: IODataset):
    """Compute the number of input variables."""
    return len(dataset.get_variable_names(group_name=IODataset.INPUT_GROUP))

plot_dataset_element

plot_dataset_element(
    dataset,
    sample_id,
    variables,
    abscissa_variable,
    file_name: str = "",
    group_name: str = "",
) -> PlotResult

Visualize row number sample_id of a dataset as a line plot.

Useful if the dataset contains vector elements (1D outputs).

Parameters:

  • dataset –

    A dataset containing 1D outputs to visualize.

  • sample_id –

    The id of the row to visualize.

  • variables –

    The variables to be plotted as ordinate.

  • abscissa_variable –

    The abscissa variable.

  • file_name (str, default: '' ) –

    The name of the saved file.

  • group_name (str, default: '' ) –

    The name of the group to which variables and abscissa_name belong.

Returns: The plot result.

Source code in src\vimseo\utilities\datasets.py
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
def plot_dataset_element(
    dataset,
    sample_id,
    variables,
    abscissa_variable,
    file_name: str = "",
    group_name: str = "",
) -> PlotResult:
    """Visualize row number ``sample_id`` of a dataset as a line plot.

     Useful if the dataset contains vector elements (1D outputs).

    Args:
         dataset: A dataset containing 1D outputs to visualize.
         sample_id: The id of the row to visualize.
         variables: The variables to be plotted as ordinate.
         abscissa_variable: The abscissa variable.
         file_name: The name of the saved file.
         group_name: The name of the group to which ``variables`` and
             ``abscissa_name`` belong.

     Returns:
         The plot result.
    """
    from vimseo.tools.post_tools.line_plot import Lines

    group_name = Dataset.DEFAULT_GROUP if group_name == "" else group_name
    all_variables = [*variables, abscissa_variable]
    dataset_to_plot = Dataset.from_array(
        vstack([
            dataset[group_name][name].to_numpy()[sample_id] for name in all_variables
        ]).T,
        variable_names=all_variables,
        variable_names_to_n_components=dict.fromkeys(all_variables, 1),
    )
    file_name = (
        f"{list_to_str(variables)}_versus_{abscissa_variable}_"
        f"sample_id_{sample_id}.html"
    )
    plot = Lines()
    plot.execute(
        dataset_to_plot,
        variables,
        abscissa_variable,
        show=True,
        file_format="html",
        file_name=file_name,
    )
    return plot.result

resolve_io_groups

resolve_io_groups(
    dataset: Dataset,
    model: IntegratedModel | None = None,
    input_names: Iterable[str] = (),
    output_names: Iterable[str] = (),
) -> IODataset

Split the default group of a dataset into an input group and an output group.

A dataset that already declares an input or an output group is returned unchanged, so that this function can be called unconditionally by a tool. Otherwise the roles are taken from input_names and output_names when given, and from the grammars of model otherwise. Variables matching neither role are left in the default group, so that data carried along for reference, such as a batch number, is preserved.

Parameters:

  • dataset (Dataset) –

    The dataset whose groups are to be resolved.

  • model (IntegratedModel | None, default: None ) –

    The model providing the variable roles. If None, the roles must be given explicitly.

  • input_names (Iterable[str], default: () ) –

    The names of the variables to place in the input group. If empty, use the input variables of model.

  • output_names (Iterable[str], default: () ) –

    The names of the variables to place in the output group. If empty, use the output variables of model.

Returns:

  • IODataset –

    The dataset with an input group and an output group.

Raises:

  • ValueError –

    If the roles of the variables cannot be resolved.

Source code in src\vimseo\utilities\datasets.py
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
def resolve_io_groups(
    dataset: Dataset,
    model: IntegratedModel | None = None,
    input_names: Iterable[str] = (),
    output_names: Iterable[str] = (),
) -> IODataset:
    """Split the default group of a dataset into an input group and an output group.

    A dataset that already declares an input or an output group is returned unchanged,
    so that this function can be called unconditionally by a tool. Otherwise the roles
    are taken from ``input_names`` and ``output_names`` when given, and from the grammars
    of ``model`` otherwise. Variables matching neither role are left in the default
    group, so that data carried along for reference, such as a batch number, is
    preserved.

    Args:
        dataset: The dataset whose groups are to be resolved.
        model: The model providing the variable roles.
            If ``None``, the roles must be given explicitly.
        input_names: The names of the variables to place in the input group.
            If empty, use the input variables of ``model``.
        output_names: The names of the variables to place in the output group.
            If empty, use the output variables of ``model``.

    Returns:
        The dataset with an input group and an output group.

    Raises:
        ValueError: If the roles of the variables cannot be resolved.
    """
    dataset = dataset if isinstance(dataset, IODataset) else IODataset(dataset)

    group_names = set(dataset.group_names)
    if IODataset.INPUT_GROUP in group_names or IODataset.OUTPUT_GROUP in group_names:
        return dataset

    if Dataset.DEFAULT_GROUP not in group_names:
        return dataset

    available_names = dataset.get_variable_names(Dataset.DEFAULT_GROUP)

    if not input_names and model is not None:
        input_names = model.input_grammar.names

    if not output_names and model is not None:
        output_names = model.get_output_data_names(remove_metadata=True)

    names_to_group_names = {
        name: IODataset.INPUT_GROUP for name in input_names if name in available_names
    }
    names_to_group_names.update({
        name: IODataset.OUTPUT_GROUP for name in output_names if name in available_names
    })

    if not names_to_group_names:
        msg = (
            "Cannot tell the inputs from the outputs of the data. "
            "Either pass a model, name the variables with the ``input_names`` and "
            "``output_names`` settings, or group the data explicitly as "
            f"{{{IODataset.INPUT_GROUP!r}: ..., {IODataset.OUTPUT_GROUP!r}: ...}}. "
            f"The available variables are {available_names}."
        )
        raise ValueError(msg)

    dataset.columns = MultiIndex.from_tuples(
        [
            (
                names_to_group_names.get(variable_name, group_name),
                variable_name,
                component,
            )
            for group_name, variable_name, component in dataset.columns
        ],
        names=dataset.columns.names,
    )
    return dataset

to_dataset

to_dataset(
    data: Dataset | DataFrame | Mapping[str, Any],
    input_names: Iterable[str] = (),
    output_names: Iterable[str] = (),
) -> IODataset

Convert user data to a GEMSEO dataset.

This is the entry point used by the tools to accept plain Python data, so that the GEMSEO :class:~gemseo.datasets.dataset.Dataset API does not have to be learnt. The accepted forms are:

  • a mapping of variable names to values, e.g. {"dx": [1.0, 0.5], "sigma": [3, 4]}. A value can be a scalar, a vector, an array shaped as (n_entries, n_components) for a vector variable, or a sequence of vectors of different lengths, which are then padded with NaN;
  • a mapping of group names to such mappings, e.g. {"inputs": {"dx": ...}, "outputs": {"sigma": ...}}, to state the groups explicitly;
  • a mono-indexed :class:~pandas.DataFrame, typically read from a csv file;
  • a :class:~pandas.DataFrame following the a_name{a_group}[a_component] column convention, see :func:dataframe_to_dataset;
  • a :class:~gemseo.datasets.dataset.Dataset, returned unchanged.

Parameters:

  • data (Dataset | DataFrame | Mapping[str, Any]) –

    The data to convert.

  • input_names (Iterable[str], default: () ) –

    The names of the variables to place in the input group. If empty, no variable is placed in the input group.

  • output_names (Iterable[str], default: () ) –

    The names of the variables to place in the output group. If empty, no variable is placed in the output group.

Returns:

  • IODataset –

    The data as an :class:~gemseo.datasets.io_dataset.IODataset.

Raises:

  • TypeError –

    If the type of data is not supported.

Source code in src\vimseo\utilities\datasets.py
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
def to_dataset(
    data: Dataset | DataFrame | Mapping[str, Any],
    input_names: Iterable[str] = (),
    output_names: Iterable[str] = (),
) -> IODataset:
    """Convert user data to a GEMSEO dataset.

    This is the entry point used by the tools to accept plain Python data, so that the
    GEMSEO :class:`~gemseo.datasets.dataset.Dataset` API does not have to be learnt.
    The accepted forms are:

    - a mapping of variable names to values, e.g. ``{"dx": [1.0, 0.5], "sigma": [3, 4]}``.
      A value can be a scalar, a vector, an array shaped as ``(n_entries, n_components)``
      for a vector variable, or a sequence of vectors of different lengths, which are
      then padded with ``NaN``;
    - a mapping of group names to such mappings, e.g.
      ``{"inputs": {"dx": ...}, "outputs": {"sigma": ...}}``, to state the groups
      explicitly;
    - a mono-indexed :class:`~pandas.DataFrame`, typically read from a csv file;
    - a :class:`~pandas.DataFrame` following the ``a_name{a_group}[a_component]`` column
      convention, see :func:`dataframe_to_dataset`;
    - a :class:`~gemseo.datasets.dataset.Dataset`, returned unchanged.

    Args:
        data: The data to convert.
        input_names: The names of the variables to place in the input group.
            If empty, no variable is placed in the input group.
        output_names: The names of the variables to place in the output group.
            If empty, no variable is placed in the output group.

    Returns:
        The data as an :class:`~gemseo.datasets.io_dataset.IODataset`.

    Raises:
        TypeError: If the type of ``data`` is not supported.
    """
    if isinstance(data, Dataset):
        dataset = data if isinstance(data, IODataset) else IODataset(data)
        if input_names or output_names:
            return resolve_io_groups(
                dataset, input_names=input_names, output_names=output_names
            )
        return dataset

    if isinstance(data, DataFrame):
        if isinstance(data.columns, MultiIndex):
            return to_dataset(
                IODataset.from_dataframe(data),
                input_names=input_names,
                output_names=output_names,
            )
        if any(GROUP_SEPARATORS[0] in str(name) for name in data.columns):
            return to_dataset(
                dataframe_to_dataset(data),
                input_names=input_names,
                output_names=output_names,
            )
        data = {str(name): data[name].to_numpy() for name in data.columns}

    if not isinstance(data, Mapping):
        msg = (
            f"Cannot build a dataset from an object of type {type(data).__name__}; "
            "expected a mapping of variable names to values, a DataFrame or a Dataset."
        )
        raise TypeError(msg)

    if data and all(isinstance(value, Mapping) for value in data.values()):
        return _build_dataset(data)

    dataset = _build_dataset({Dataset.DEFAULT_GROUP: data})
    if input_names or output_names:
        return resolve_io_groups(
            dataset, input_names=input_names, output_names=output_names
        )
    return dataset