TrainingData#
A TrainingData
instance is a
collection of TrainingDataPart
instances representing a prediction that can be used as input for the training of models.
Directory#
- class TrainingDataDirectory#
Provides a collection of methods related to training data.
This class is accessed through
client.training_data
.Example
List all of the training data:
import ansys.simai.core simai = ansys.simai.core.from_config() simai.training_data.list()
- create(name: str, project: Project | str | None = None) TrainingData #
Create a
TrainingData
object.- Parameters:
name (str) – Name to give the new
TrainingData
object.project (Project | str | None) –
Project
object to associate the data with.
- Returns:
Created
TrainingData
object.- Return type:
- delete(training_data: TrainingData | str) None #
Delete a
TrainingData
object and its associated parts from the server.- Parameters:
training_data (TrainingData | str) – ID or
model
object of theTrainingData
object.
- get(id) TrainingData #
Get a specific
TrainingData
object from the server.
- list() List[TrainingData] #
List all
TrainingData
objects on the server.- Returns:
List of all
TrainingData
objects on the server.- Return type:
- upload_folder(training_data: TrainingData | str, folder_path: Path | str | PathLike, compute: bool = True) List[TrainingDataPart] #
Upload all files in a folder to a
TrainingData
object.This method automatically requests computation of the training data once the upload is complete unless specified otherwise.
- upload_part(training_data: TrainingData | str, file: Path | str | PathLike | Tuple[BinaryIO | RawIOBase | BufferedIOBase | Path | str | PathLike, str], monitor_callback: Callable[[int], None] | None) TrainingDataPart #
Add a part to a
TrainingData
object.- Parameters:
training_data (TrainingData | str) – ID or
model
object of the training data to add the part to.file (Path | str | PathLike | Tuple[BinaryIO | RawIOBase | BufferedIOBase | Path | str | PathLike, str]) –
NamedFile
to upload.monitor_callback (Callable[[int], None] | None) – Optional callback for monitoring the progress of the upload. For more information, see the
MonitorCallback
object.
- Returns:
Added
TrainingDataPart
object.- Return type:
Model#
- class TrainingData#
Provides the local representation of a training data object.
- assign_subset(project: Project | str, subset: SubsetEnum) None #
Assign the training data subset in relation to a given project.
- Parameters:
subset (SubsetEnum) – SubsetEnum attribute (e.g. SubsetEnum.TRAINING) or string value (e.g. “Training”). Available options: (Training, Validation, Test, Ignored)
- Returns:
None
- Return type:
None
- compute() None #
Compute or recompute the training data.
Training data should be computed once all its parts have been fully uploaded.
Training data can only be recomputed if computation previously failed or if new data has been added.
- get_subset(project: Project | str) SubsetEnum | None #
Get the subset that the training data belongs to, in relation to the given project.
- Parameters:
project (Project | str) – ID or
model
of the project to check theProject
object for, or its ID.- Returns:
- SubsetEnum of the subset that the training data belongs to in the given project.
(e.g. <SubsetEnum.VALIDATION: ‘Validation’>)
- Return type:
SubsetEnum | None
- remove_from_project(project: Project | str)#
Remove the training data from a
Project
object.- Parameters:
project (Project | str) – ID or
model
of the project to remove data from.- Raises:
ansys.simai.core.errors.ApiClientError – If the data is the project’s sample.
ansys.simai.core.errors.ApiClientError – If the project is in training.
- upload_folder(folder_path: Path | str | PathLike, compute: bool = True) List[TrainingDataPart] #
Upload all the parts contained in a folder to a
TrainingData
instance.This method automatically requests computation of the training data once the upload is complete unless specified otherwise.
- upload_part(file: Path | str | PathLike | Tuple[BinaryIO | RawIOBase | BufferedIOBase | Path | str | PathLike, str], monitor_callback: Callable[[int], None] | None = None) TrainingDataPart #
Add a part to the training data.
- Parameters:
- Returns:
Created
TrainingDataPart
.- Return type:
- wait(timeout: float | None = None) bool #
Wait for all jobs concerning the object to either finish or fail.
- property failure_reason#
Optional message giving the causes for why the creation of the object failed.
See also
- property has_failed#
Boolean indicating if the creation of the object failed.
See also
- property is_pending#
Boolean indicating if the object is still in creation. The value becomes
False
once object creation is either successful or has failed.See also
- property is_ready#
Boolean indicating if the object has finished creating without error.
See also
- property parts: List[TrainingDataPart]#
List of all
parts
objects in the training data.