from sklearn.ensemble import RandomForestClassifier | |
def train_model(X_train, y_train): | |
""" | |
Train a Random Forest Classifier. | |
Args: | |
X_train (pd.DataFrame): Training features. | |
y_train (pd.Series): Training labels. | |
Returns: | |
model: Trained Random Forest model. | |
""" | |
model = RandomForestClassifier(random_state=42) | |
model.fit(X_train, y_train) | |
return model | |