Predictions#
The Prediction
module is in charge of running the SimAI-powered
predictions on the geometries
that you have uploaded.
A prediction represents a numerical prediction with geometry and boundary conditions.
The arguments to the predictions.run()
method
depend on your model.
# Run a prediction on a given geometry with the specified velocity.
velocity = 10.0
prediction = geometry.run_prediction(Vx=velocity)
Directory#
- class PredictionDirectory#
Provides a collection of methods related to model predictions.
This method is accessed through
client.prediction
.Example
import ansys.simai.core simai = ansys.simai.core.from_config() simai.predictions.list()
- delete(prediction: Prediction | str) None #
Delete a specific prediction from the server.
- Parameters:
prediction (Prediction | str) – ID or
model
of the prediction.- Raises:
ansys.simai.core.errors.NotFoundError – No prediction with the given ID exists.
- get(id: str) Prediction #
Get a specific prediction object from the server by ID.
- Parameters:
id (str) – ID of the prediction.
- Returns:
Prediction
instance with the given ID if it exists.- Raises:
NotFoundError – No prediction with the given ID exists.
- Return type:
- list(workspace: Workspace | str | None = None) List[Prediction] #
List all predictions on the server that belong to the specified workspace or the configured one.
- run(geometry: Geometry | str, boundary_conditions: Dict[str, Number] | None = None, **kwargs) Prediction #
Run a prediction on a given geometry with a given boundary conditions.
Boundary conditions can be passed as a dictionary or as kwargs.
To learn more about the expected boundary conditions in your workspace, you can use the
simai.current_workspace.model_manifest.boundary_conditions
orsimai.predictions.boundary_conditions
method, whereex
is your ~ansys.simai.core.client.SimAIClient object.- Parameters:
- Returns:
Created prediction object.
- Raises:
ProcessingError – If the server failed to process the request.
- Return type:
Examples
simai = ansys.simai.core.from_config() geometry = simai.geometries.list()[0] prediction = simai.predictions.run(geometry, dict(Vx=10.5, Vy=2))
Using kwargs:
prediction = simai.predictions.run(geometry_id, Vx=10.5, Vy=2)
- property boundary_conditions: Dict[str, Any]#
Information on the boundary conditions expected by the model of the current workspace. For example, the prediction’s input.
- property info#
Information on the prediction’s inputs and outputs.
Example
from pprint import pprint import ansys.simai.core simai = ansys.simai.core.from_config() prediction_info = simai.predictions.info pprint(prediction_info)
Model#
- class Prediction#
Provides the local representation of a prediction object.
- wait(timeout: float | None = None) bool #
Wait for all jobs concerning the object to either finish or fail.
- property confidence_score: str | None#
Confidence score, which is either
high
orlow
.This method blocks until the confidence score is computed.
- property failure_reason#
Optional message giving the causes for why the creation of the object failed.
See also
- property geometry: Geometry#
Parent geometry.
The parent geometry is queried if is not already known by the current SimAI client session.
See also
geometry_id
: Get the parent geometry’s ID without query.
- 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 post: PredictionPostProcessings#
Namespace containing methods for postprocessing the result of a prediction.
For more information, see the
PredictionPostProcessings
class.