Anomaly detection Code Explanation
Overview of the Anomaly Detection API (Flask + PyOD)
1. Model Training (Normal Vibration Simulation)
normal_values = np.random.uniform(0.0, 5.0, 500)
normal_values = normal_values.reshape(-1, 1)Scaling the Data
scaler = StandardScaler()
normal_scaled = scaler.fit_transform(normal_values)Training the Isolation Forest Model
model = IForest(contamination=0.05)
model.fit(normal_scaled)2. Prediction API Endpoint (/predict)
/predict)3. Retraining Endpoint (/retrain)
/retrain)4. Running the Flask Server
Summary
PreviousHiveMQ Edge-to-Cloud AI PipelineNextSecure OT/IT Data Integration Using HiveMQ Edge and Site DMZ
Last updated