Canstralian
commited on
Create models/model.py
Browse files- models/model.py +16 -0
models/model.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sklearn.ensemble import RandomForestClassifier
|
2 |
+
|
3 |
+
def train_model(X_train, y_train):
|
4 |
+
"""
|
5 |
+
Train a Random Forest Classifier.
|
6 |
+
|
7 |
+
Args:
|
8 |
+
X_train (pd.DataFrame): Training features.
|
9 |
+
y_train (pd.Series): Training labels.
|
10 |
+
|
11 |
+
Returns:
|
12 |
+
model: Trained Random Forest model.
|
13 |
+
"""
|
14 |
+
model = RandomForestClassifier(random_state=42)
|
15 |
+
model.fit(X_train, y_train)
|
16 |
+
return model
|