from sklearn.ensemble import RandomForestClassifier def train_model(X, y): # just in case Loan_ID is still present, remove it if "Loan_ID" in X.columns: X = X.drop("Loan_ID", axis=1) # create Random Forest model model = RandomForestClassifier(n_estimators=200, max_depth=10, random_state=42) # train the model model.fit(X, y) return model