Skip to content

Commit 1125d62

Browse files
committed
Fix an error in the code
1 parent 67fa843 commit 1125d62

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

My_path_team9/student/ai_recommender.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ def train_model(self):
205205
print("No training data available")
206206
return False
207207

208+
# Ensure there are both positive and negative labels
209+
if len(set(y_train)) < 2:
210+
print("Not enough class diversity in training labels")
211+
return False
212+
208213
# Split data for validation
209214
X_train_split, X_val, y_train_split, y_val = train_test_split(
210215
X_train, y_train, test_size=0.2, random_state=42

0 commit comments

Comments
 (0)