File size: 563 Bytes
2f7dda8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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()