Class MLIntegrationExamples.OnnxAdapter
java.lang.Object
neqsim.process.safety.risk.ml.MLIntegrationExamples.BaseMLAdapter
neqsim.process.safety.risk.ml.MLIntegrationExamples.OnnxAdapter
- All Implemented Interfaces:
Serializable, MLIntegrationExamples.MLModelAdapter
- Enclosing class:
MLIntegrationExamples
Adapter for ONNX Runtime models.
ONNX (Open Neural Network Exchange) provides a platform-independent format for ML models. This adapter loads ONNX models using the ONNX Runtime Java API.
Dependencies Required
<dependency> <groupId>com.microsoft.onnxruntime</groupId> <artifactId>onnxruntime</artifactId> <version>1.15.1</version> </dependency>
- Since:
- 3.3.0
- Version:
- 1.0
- Author:
- NeqSim Development Team
- See Also:
-
Field Summary
FieldsFields inherited from class MLIntegrationExamples.BaseMLAdapter
featureDefaults, inputFeatures, isLoaded, modelName -
Constructor Summary
ConstructorsConstructorDescriptionOnnxAdapter(String modelPath, List<String> inputFeatures) Creates an ONNX adapter. -
Method Summary
Methods inherited from class MLIntegrationExamples.BaseMLAdapter
getInputFeatures, getModelName, isLoaded, prepareInput
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
modelPath
-
-
Constructor Details
-
OnnxAdapter
-
-
Method Details
-
load
public void load()Loads the ONNX model.In production, this would use:
env = OrtEnvironment.getEnvironment(); session = env.createSession(modelPath, new OrtSession.SessionOptions());
-
predict
Description copied from interface:MLIntegrationExamples.MLModelAdapterPredicts output from input features.- Parameters:
features- input features as name-value map- Returns:
- prediction score or probability
-
getModelPath
-