Spaces:
Sleeping
Sleeping
| import numpy as np | |
| import pickle | |
| from sklearn.ensemble import IsolationForest | |
| def train_security_model(path="security_model.sav"): | |
| rng = np.random.RandomState(42) | |
| # بيانات تدريب عشوائية (للـ MVP) | |
| X = rng.normal(size=(600, 6)) | |
| model = IsolationForest( | |
| contamination=0.05, | |
| random_state=42 | |
| ) | |
| model.fit(X) | |
| pickle.dump(model, open(path, "wb")) | |
| print("✔ تم تدريب نموذج الأمن CyberSecurity Model") | |
| if __name__ == "__main__": | |
| train_security_model() |