AmanPredict / prediction_model.py
NorahAlzeid's picture
Upload 7 files
9628c5e verified
raw
history blame contribute delete
656 Bytes
# prediction_model.py
import pandas as pd
from sklearn.tree import DecisionTreeClassifier
import pickle
def train_document_model():
df = pd.read_csv("data.csv")
df["Document_Status"] = df["Document_Status"].map({"active": 0, "expiring": 1})
df["Risk_Level"] = df["Risk_Level"].map({"Low": 0, "High": 1})
X = df[["Days_Left", "Document_Status"]]
y = df["Risk_Level"]
model = DecisionTreeClassifier()
model.fit(X, y)
pickle.dump(model, open("document_model.sav", "wb"))
print("✔ تم تدريب نموذج الوثائق Document Model")
if __name__ == "__main__":
train_document_model()