Spaces:
Runtime error
Runtime error
fixed error of csv file usage
Browse files
app.py
CHANGED
|
@@ -51,22 +51,31 @@ from sklearn.metrics import accuracy_score, f1_score
|
|
| 51 |
from sklearn.preprocessing import StandardScaler
|
| 52 |
|
| 53 |
# =========================
|
| 54 |
-
# 4. LOAD LABELS (
|
| 55 |
# =========================
|
| 56 |
def load_labels():
|
| 57 |
df_train = pd.read_csv("train_split_Depression_AVEC2017.csv")
|
| 58 |
df_dev = pd.read_csv("dev_split_Depression_AVEC2017.csv")
|
| 59 |
-
df_test = pd.read_csv("test_split_Depression_AVEC2017.csv")
|
| 60 |
|
| 61 |
-
df = pd.concat([df_train, df_dev
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
labels = {}
|
|
|
|
| 64 |
for _, row in df.iterrows():
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
|
|
|
| 70 |
return labels
|
| 71 |
|
| 72 |
labels_dict = load_labels()
|
|
@@ -129,7 +138,7 @@ def get_visual_features(folder_path):
|
|
| 129 |
return np.concatenate(features)
|
| 130 |
|
| 131 |
# =========================
|
| 132 |
-
# 7. BUILD DATASET
|
| 133 |
# =========================
|
| 134 |
print("\nBuilding dataset...")
|
| 135 |
|
|
@@ -171,7 +180,6 @@ y = np.array([d[1] for d in data])
|
|
| 171 |
scaler = StandardScaler()
|
| 172 |
X = scaler.fit_transform(X)
|
| 173 |
|
| 174 |
-
# Split using AVEC logic (simple split for now)
|
| 175 |
split = int(0.7 * len(X))
|
| 176 |
X_train, X_test = X[:split], X[split:]
|
| 177 |
y_train, y_test = y[:split], y[split:]
|
|
|
|
| 51 |
from sklearn.preprocessing import StandardScaler
|
| 52 |
|
| 53 |
# =========================
|
| 54 |
+
# 4. LOAD LABELS (CORRECT)
|
| 55 |
# =========================
|
| 56 |
def load_labels():
|
| 57 |
df_train = pd.read_csv("train_split_Depression_AVEC2017.csv")
|
| 58 |
df_dev = pd.read_csv("dev_split_Depression_AVEC2017.csv")
|
|
|
|
| 59 |
|
| 60 |
+
df = pd.concat([df_train, df_dev])
|
| 61 |
+
|
| 62 |
+
# Clean column names
|
| 63 |
+
df.columns = df.columns.str.strip()
|
| 64 |
|
| 65 |
labels = {}
|
| 66 |
+
|
| 67 |
for _, row in df.iterrows():
|
| 68 |
+
try:
|
| 69 |
+
pid = str(int(row["Participant_ID"]))
|
| 70 |
+
|
| 71 |
+
# ✅ FINAL LABEL
|
| 72 |
+
label = int(row["PHQ8_Binary"])
|
| 73 |
+
|
| 74 |
+
labels[pid] = label
|
| 75 |
+
except:
|
| 76 |
+
continue
|
| 77 |
|
| 78 |
+
print("Total labels loaded:", len(labels))
|
| 79 |
return labels
|
| 80 |
|
| 81 |
labels_dict = load_labels()
|
|
|
|
| 138 |
return np.concatenate(features)
|
| 139 |
|
| 140 |
# =========================
|
| 141 |
+
# 7. BUILD DATASET
|
| 142 |
# =========================
|
| 143 |
print("\nBuilding dataset...")
|
| 144 |
|
|
|
|
| 180 |
scaler = StandardScaler()
|
| 181 |
X = scaler.fit_transform(X)
|
| 182 |
|
|
|
|
| 183 |
split = int(0.7 * len(X))
|
| 184 |
X_train, X_test = X[:split], X[split:]
|
| 185 |
y_train, y_test = y[:split], y[split:]
|