.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_examples/02-subset_assignment.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr__examples_02-subset_assignment.py: .. _ref_subset_assignment: Subset assignment ================= This example demonstrates how to assign a subset to a training data. .. GENERATED FROM PYTHON SOURCE LINES 13-15 Import necessary libraries -------------------------- .. GENERATED FROM PYTHON SOURCE LINES 15-20 .. code-block:: Python import ansys.simai.core as asc simai = asc.from_config() .. GENERATED FROM PYTHON SOURCE LINES 21-24 Select a training data ---------------------- Example of a training_data_id associated with a project_id. .. GENERATED FROM PYTHON SOURCE LINES 24-28 .. code-block:: Python training_data_id = "k4z77qzq" project_id = "k9756vw0" .. GENERATED FROM PYTHON SOURCE LINES 29-32 Get subset assignment --------------------- Get and print the current subset assigned for this training_data_id. .. GENERATED FROM PYTHON SOURCE LINES 32-36 .. code-block:: Python current_subset = simai.training_data.get(id=training_data_id).get_subset(project=project_id) print(current_subset) .. GENERATED FROM PYTHON SOURCE LINES 37-40 Assign a new subset (two options) --------------------------------- Manually assign a new subset to the training data. .. GENERATED FROM PYTHON SOURCE LINES 40-43 .. code-block:: Python simai.training_data.get(id=training_data_id).assign_subset(project=project_id, subset="Test") .. GENERATED FROM PYTHON SOURCE LINES 44-45 Alternatively, use SubsetEnum to assign a valid enum value to the training data. .. GENERATED FROM PYTHON SOURCE LINES 45-51 .. code-block:: Python from ansys.simai.core.data.types import SubsetEnum simai.training_data.get(id=training_data_id).assign_subset( project=project_id, subset=SubsetEnum.TEST ) .. _sphx_glr_download__examples_02-subset_assignment.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 02-subset_assignment.ipynb <02-subset_assignment.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 02-subset_assignment.py <02-subset_assignment.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 02-subset_assignment.zip <02-subset_assignment.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_