Package neqsim.process.safety.risk.ml
package neqsim.process.safety.risk.ml
Machine Learning Integration Package for Risk Assessment.
This package provides a standardized interface for integrating external machine learning models with the NeqSim risk framework. It enables data-driven risk assessment and prediction.
Key Classes
RiskMLInterface- Main interface for ML model management and prediction
ML Use Cases
- Failure Prediction: Predict equipment failures before they occur
- Anomaly Detection: Identify unusual patterns indicating potential problems
- RUL Prediction: Estimate remaining useful life of equipment
- Risk Scoring: ML-based risk scoring for complex scenarios
- Optimization: Optimize operations under risk constraints
Integration Example
// Create ML interface
RiskMLInterface mlInterface = new RiskMLInterface("Platform Risk ML");
// Register a failure prediction model
RiskMLInterface.MLModel model =
mlInterface.createFailurePredictionModel("pump-failure-v1", "Pump Failure Predictor");
model.setVersion("1.0.0");
model.setAccuracy(0.92);
// Set up predictor (e.g., calling external Python/TensorFlow service)
model.setPredictor(new MLPredictor() {
public MLPrediction predict(Map features) {
// Call ML service
RiskMLInterface.MLPrediction pred = new RiskMLInterface.MLPrediction(model.getModelId());
pred.setPrediction(callMLService(features)); // Your ML service
pred.setConfidence(0.85);
return pred;
}
});
// Register feature extractor
mlInterface.registerFeatureExtractor("process", new FeatureExtractor() {
public Map extractFeatures(Map processData) {
Map features = new HashMap();
features.put("pressure", processData.get("PT-001"));
features.put("temperature", processData.get("TT-001"));
features.put("vibration", processData.get("VT-001"));
return features;
}
});
// Make prediction
Map processData = getLatestProcessData();
RiskMLInterface.MLPrediction prediction =
mlInterface.predictWithExtraction("pump-failure-v1", "process", processData);
if (prediction.getPrediction() > 0.7) {
// High failure probability - trigger alert
generateMaintenanceWorkOrder();
}
Python Integration
The ML interface is designed for easy integration with Python-based ML models via REST API or direct JPype/Py4J bridging.
- Version:
- 1.0
- Author:
- NeqSim Development Team
- See Also:
-
ClassDescriptionExamples and templates for integrating external ML frameworks with the risk system.Base adapter class with common functionality.Interface for ML model adapters.Adapter for ONNX Runtime models.Adapter for REST API-based model serving.Adapter for TensorFlow SavedModel format.Simple threshold-based model for testing and fallback.Machine Learning Integration Interface for Risk Assessment.Feature extractor for process data.Machine learning model wrapper.ML prediction result.Functional interface for ML model prediction.Model performance metrics.Prediction record for history tracking.