Spaces:
Sleeping
Sleeping
Update course_recommender.py
Browse files- course_recommender.py +5 -1
course_recommender.py
CHANGED
|
@@ -27,6 +27,10 @@ class CourseRecommender:
|
|
| 27 |
"""Preprocess the data for training"""
|
| 28 |
df_processed = df.copy()
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
# Encode categorical variables
|
| 31 |
categorical_columns = ['strand', 'hobbies']
|
| 32 |
|
|
@@ -343,4 +347,4 @@ class CourseRecommender:
|
|
| 343 |
def add_feedback(self, course: str, stanine: int, gwa: float, strand: str,
|
| 344 |
rating: int, hobbies: str) -> bool:
|
| 345 |
"""Add user feedback to the database"""
|
| 346 |
-
return self.db_connection.add_feedback(course, stanine, gwa, strand, rating, hobbies)
|
|
|
|
| 27 |
"""Preprocess the data for training"""
|
| 28 |
df_processed = df.copy()
|
| 29 |
|
| 30 |
+
# Normalize strand to uppercase for case-insensitive matching
|
| 31 |
+
if 'strand' in df_processed.columns:
|
| 32 |
+
df_processed['strand'] = df_processed['strand'].astype(str).str.upper()
|
| 33 |
+
|
| 34 |
# Encode categorical variables
|
| 35 |
categorical_columns = ['strand', 'hobbies']
|
| 36 |
|
|
|
|
| 347 |
def add_feedback(self, course: str, stanine: int, gwa: float, strand: str,
|
| 348 |
rating: int, hobbies: str) -> bool:
|
| 349 |
"""Add user feedback to the database"""
|
| 350 |
+
return self.db_connection.add_feedback(course, stanine, gwa, strand, rating, hobbies)
|