.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_examples/03-list_based_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_03-list_based_subset_assignment.py: .. _ref_list_based_subset_assignment: List-based subset assignment ============================ This example demonstrates how to distribute your dataset between Test and Training subsets using lists. .. GENERATED FROM PYTHON SOURCE LINES 13-15 Import necessary libraries -------------------------- .. GENERATED FROM PYTHON SOURCE LINES 15-18 .. code-block:: Python import ansys.simai.core .. GENERATED FROM PYTHON SOURCE LINES 19-22 Create lists ------------ List the data to be used for the test set. .. GENERATED FROM PYTHON SOURCE LINES 22-28 .. code-block:: Python # CAUTION: # All training data that are not included into the following list will be # assigned the training subset TEST_LIST = ["My_td_1", "My_td_2"] .. GENERATED FROM PYTHON SOURCE LINES 29-33 Connect to the platform ------------------------ Connect to the SimAI platform. Refer to the :ref:`anchor-credentials` section of the documentation to adapt the connection type. .. GENERATED FROM PYTHON SOURCE LINES 33-37 .. code-block:: Python simai = ansys.simai.core.SimAIClient(organization="My_organization_name") project = simai.projects.get(name="My_project_name") .. GENERATED FROM PYTHON SOURCE LINES 38-41 Assign subsets -------------- Assign a subset to each dataset (list) you created. .. GENERATED FROM PYTHON SOURCE LINES 41-48 .. code-block:: Python td_list = project.data for td in td_list: if td.name in TEST_LIST: td.assign_subset(project, "Test") else: td.assign_subset(project, "Training") .. _sphx_glr_download__examples_03-list_based_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: 03-list_based_subset_assignment.ipynb <03-list_based_subset_assignment.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 03-list_based_subset_assignment.py <03-list_based_subset_assignment.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 03-list_based_subset_assignment.zip <03-list_based_subset_assignment.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_