Spaces:
Running
Running
A15 model and evaluation
Browse files- A15/scoring.py +534 -0
- A15_results/all_results.csv +41 -0
- A15_results/evaluation_summary.csv +5 -0
- A15_results/training_summary.json +19 -0
- models/scoring_model.keras +3 -0
- models/scoring_scaler.pkl +3 -0
A15/scoring.py
ADDED
|
@@ -0,0 +1,534 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import numpy as np
|
| 3 |
+
import pandas as pd
|
| 4 |
+
import matplotlib.pyplot as plt
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
from sklearn.model_selection import KFold, train_test_split
|
| 7 |
+
from sklearn.preprocessing import StandardScaler
|
| 8 |
+
from scipy.stats import pearsonr
|
| 9 |
+
import tensorflow as tf
|
| 10 |
+
from tensorflow import keras
|
| 11 |
+
from tensorflow.keras import layers
|
| 12 |
+
import joblib
|
| 13 |
+
import re
|
| 14 |
+
|
| 15 |
+
# Paths
|
| 16 |
+
CUT_DIR = Path('A15_Data/a15_cut_augmented')
|
| 17 |
+
SCORES_CSV = Path('A15_Data/a15_augmented_data.csv')
|
| 18 |
+
RESULTS_DIR = Path('A15_results')
|
| 19 |
+
RESULTS_DIR.mkdir(exist_ok=True)
|
| 20 |
+
|
| 21 |
+
JOINTS = [
|
| 22 |
+
'head', 'left_shoulder', 'left_elbow', 'right_shoulder', 'right_elbow',
|
| 23 |
+
'left_hand', 'right_hand', 'left_hip', 'right_hip',
|
| 24 |
+
'left_knee', 'right_knee', 'left_foot', 'right_foot'
|
| 25 |
+
]
|
| 26 |
+
|
| 27 |
+
C = 10
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
# Load and prepare data
|
| 31 |
+
|
| 32 |
+
def sample_frames(df, c=C):
|
| 33 |
+
indices = np.linspace(0, len(df)-1, c).astype(int)
|
| 34 |
+
sampled = df.iloc[indices]
|
| 35 |
+
frames = []
|
| 36 |
+
for _, row in sampled.iterrows():
|
| 37 |
+
joints = [[row[f'{j}_x'], row[f'{j}_y'], row[f'{j}_z']]
|
| 38 |
+
for j in JOINTS]
|
| 39 |
+
frames.append(joints)
|
| 40 |
+
return np.array(frames, dtype=np.float32)
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def load_dataset():
|
| 45 |
+
scores_df = pd.read_csv(SCORES_CSV)
|
| 46 |
+
scores_df.columns = scores_df.columns.str.strip()
|
| 47 |
+
|
| 48 |
+
X, y, names = [], [], []
|
| 49 |
+
|
| 50 |
+
for _, row in scores_df.iterrows():
|
| 51 |
+
csv_path = CUT_DIR / f"{row['clip']}.csv"
|
| 52 |
+
|
| 53 |
+
if not csv_path.exists():
|
| 54 |
+
print(f" Missing: {csv_path.name}")
|
| 55 |
+
continue
|
| 56 |
+
|
| 57 |
+
df = pd.read_csv(csv_path)
|
| 58 |
+
df.columns = df.columns.str.strip()
|
| 59 |
+
|
| 60 |
+
if len(df) < C:
|
| 61 |
+
print(f" Too short ({len(df)} frames): {csv_path.name}")
|
| 62 |
+
continue
|
| 63 |
+
|
| 64 |
+
frames = sample_frames(df)
|
| 65 |
+
X.append(frames)
|
| 66 |
+
y.append(float(row['score_rescaled']))
|
| 67 |
+
names.append(row['clip'])
|
| 68 |
+
|
| 69 |
+
X = np.array(X)
|
| 70 |
+
y = np.array(y)
|
| 71 |
+
|
| 72 |
+
print(f"\nDataset loaded:")
|
| 73 |
+
print(f" Clips: {len(X)}")
|
| 74 |
+
print(f" Score range: {y.min():.2f} to {y.max():.2f}")
|
| 75 |
+
print(f" Score mean: {y.mean():.2f} ± {y.std():.2f}")
|
| 76 |
+
|
| 77 |
+
return X, y, names
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
X_raw, y, names = load_dataset()
|
| 81 |
+
|
| 82 |
+
X_flat = X_raw.reshape(len(X_raw), -1)
|
| 83 |
+
X_seq = X_raw.reshape(len(X_raw), C, 13*3)
|
| 84 |
+
|
| 85 |
+
original_names = [re.sub(r'_(mirror|rotate_pos|rotate_neg|stretch)$', '', n)
|
| 86 |
+
for n in names]
|
| 87 |
+
|
| 88 |
+
unique_originals = list(set(original_names))
|
| 89 |
+
np.random.seed(42)
|
| 90 |
+
np.random.shuffle(unique_originals)
|
| 91 |
+
|
| 92 |
+
n_test = max(1, int(len(unique_originals) * 0.1))
|
| 93 |
+
test_clips = set(unique_originals[:n_test])
|
| 94 |
+
train_clips = set(unique_originals[n_test:])
|
| 95 |
+
|
| 96 |
+
# Get indices for each split
|
| 97 |
+
train_idx = [i for i, n in enumerate(original_names) if n in train_clips]
|
| 98 |
+
test_idx = [i for i, n in enumerate(original_names) if n in test_clips]
|
| 99 |
+
|
| 100 |
+
X_flat_tv = X_flat[train_idx]
|
| 101 |
+
X_flat_te = X_flat[test_idx]
|
| 102 |
+
X_seq_tv = X_seq[train_idx]
|
| 103 |
+
X_seq_te = X_seq[test_idx]
|
| 104 |
+
y_tv = y[train_idx]
|
| 105 |
+
y_te = y[test_idx]
|
| 106 |
+
|
| 107 |
+
# Define architectures
|
| 108 |
+
|
| 109 |
+
def build_dense(input_dim, hidden=(64, 32), dropout=0.2):
|
| 110 |
+
inp = keras.Input(shape=(input_dim,))
|
| 111 |
+
x = inp
|
| 112 |
+
for u in hidden:
|
| 113 |
+
x = layers.Dense(u, activation='relu')(x)
|
| 114 |
+
x = layers.Dropout(dropout)(x)
|
| 115 |
+
out = layers.Dense(1, activation='linear')(x)
|
| 116 |
+
return keras.Model(inp, out, name='Dense')
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def build_cnn(c=C, n_features=39, filters=(32,), kernel=3, dropout=0.2):
|
| 120 |
+
inp = keras.Input(shape=(c, n_features))
|
| 121 |
+
x = inp
|
| 122 |
+
for f in filters:
|
| 123 |
+
x = layers.Conv1D(f, kernel, activation='relu', padding='same')(x)
|
| 124 |
+
x = layers.MaxPooling1D(2, padding='same')(x)
|
| 125 |
+
x = layers.Dropout(dropout)(x)
|
| 126 |
+
x = layers.GlobalAveragePooling1D()(x)
|
| 127 |
+
x = layers.Dense(16, activation='relu')(x)
|
| 128 |
+
out = layers.Dense(1, activation='linear')(x)
|
| 129 |
+
return keras.Model(inp, out, name='CNN')
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
def build_lstm(c=C, n_features=39, units=(32,), dropout=0.2):
|
| 133 |
+
inp = keras.Input(shape=(c, n_features))
|
| 134 |
+
x = inp
|
| 135 |
+
for i, u in enumerate(units):
|
| 136 |
+
rs = (i < len(units) - 1)
|
| 137 |
+
x = layers.LSTM(u, return_sequences=rs, dropout=dropout)(x)
|
| 138 |
+
x = layers.Dense(16, activation='relu')(x)
|
| 139 |
+
out = layers.Dense(1, activation='linear')(x)
|
| 140 |
+
return keras.Model(inp, out, name='LSTM')
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
def build_gru(c=C, n_features=39, units=(32,), dropout=0.2):
|
| 144 |
+
inp = keras.Input(shape=(c, n_features))
|
| 145 |
+
x = inp
|
| 146 |
+
for i, u in enumerate(units):
|
| 147 |
+
rs = (i < len(units) - 1)
|
| 148 |
+
x = layers.GRU(u, return_sequences=rs, dropout=dropout)(x)
|
| 149 |
+
x = layers.Dense(16, activation='relu')(x)
|
| 150 |
+
out = layers.Dense(1, activation='linear')(x)
|
| 151 |
+
return keras.Model(inp, out, name='GRU')
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
# Compile
|
| 155 |
+
|
| 156 |
+
def compile_model(model, optimizer='adam', lr=1e-3):
|
| 157 |
+
opt_map = {
|
| 158 |
+
'adam': keras.optimizers.Adam(learning_rate=lr),
|
| 159 |
+
'rmsprop': keras.optimizers.RMSprop(learning_rate=lr),
|
| 160 |
+
}
|
| 161 |
+
model.compile(
|
| 162 |
+
optimizer=opt_map[optimizer],
|
| 163 |
+
loss='mae',
|
| 164 |
+
metrics=['mae', 'mse']
|
| 165 |
+
)
|
| 166 |
+
return model
|
| 167 |
+
|
| 168 |
+
# 3-fold CV
|
| 169 |
+
|
| 170 |
+
def run_cv(X_tv, y_tv, X_te, y_te,
|
| 171 |
+
build_fn, is_seq,
|
| 172 |
+
optimizer, lr, batch_size,
|
| 173 |
+
arch_name, n_folds=10):
|
| 174 |
+
|
| 175 |
+
run_name = f"{arch_name}_{optimizer}_lr{lr}_bs{batch_size}"
|
| 176 |
+
print(f"\n{'='*55}")
|
| 177 |
+
print(f" {run_name} ({n_folds}-fold CV)")
|
| 178 |
+
print(f"{'='*55}")
|
| 179 |
+
|
| 180 |
+
kf = KFold(n_splits=n_folds, shuffle=True, random_state=42)
|
| 181 |
+
fold_maes = []
|
| 182 |
+
best_mae, best_model, best_scaler = np.inf, None, None
|
| 183 |
+
|
| 184 |
+
for fold_idx, (tr_idx, val_idx) in enumerate(kf.split(X_tv)):
|
| 185 |
+
print(f" Fold {fold_idx+1}/{n_folds}", end=' ')
|
| 186 |
+
|
| 187 |
+
X_tr, X_val = X_tv[tr_idx], X_tv[val_idx]
|
| 188 |
+
y_tr, y_val = y_tv[tr_idx], y_tv[val_idx]
|
| 189 |
+
|
| 190 |
+
# Normalise — fit on train only
|
| 191 |
+
scaler = StandardScaler()
|
| 192 |
+
X_tr_sc = scaler.fit_transform(
|
| 193 |
+
X_tr.reshape(len(X_tr), -1)
|
| 194 |
+
).reshape(X_tr.shape).astype(np.float32)
|
| 195 |
+
X_val_sc = scaler.transform(
|
| 196 |
+
X_val.reshape(len(X_val), -1)
|
| 197 |
+
).reshape(X_val.shape).astype(np.float32)
|
| 198 |
+
|
| 199 |
+
model = build_fn()
|
| 200 |
+
model = compile_model(model, optimizer=optimizer, lr=lr)
|
| 201 |
+
|
| 202 |
+
callbacks = [
|
| 203 |
+
keras.callbacks.EarlyStopping(
|
| 204 |
+
monitor='val_loss', patience=10,
|
| 205 |
+
restore_best_weights=True, verbose=0),
|
| 206 |
+
keras.callbacks.ReduceLROnPlateau(
|
| 207 |
+
monitor='val_loss', factor=0.5,
|
| 208 |
+
patience=5, verbose=0)
|
| 209 |
+
]
|
| 210 |
+
|
| 211 |
+
model.fit(
|
| 212 |
+
X_tr_sc, y_tr,
|
| 213 |
+
validation_data=(X_val_sc, y_val),
|
| 214 |
+
epochs=100,
|
| 215 |
+
batch_size=batch_size,
|
| 216 |
+
callbacks=callbacks,
|
| 217 |
+
verbose=0
|
| 218 |
+
)
|
| 219 |
+
|
| 220 |
+
y_pred = model.predict(X_val_sc, verbose=0).flatten()
|
| 221 |
+
mae = float(np.mean(np.abs(y_val - y_pred)))
|
| 222 |
+
print(f"MAE={mae:.4f}")
|
| 223 |
+
fold_maes.append(mae)
|
| 224 |
+
|
| 225 |
+
if mae < best_mae:
|
| 226 |
+
best_mae, best_model, best_scaler = mae, model, scaler
|
| 227 |
+
|
| 228 |
+
avg_mae = np.mean(fold_maes)
|
| 229 |
+
std_mae = np.std(fold_maes)
|
| 230 |
+
print(f"\n {n_folds}-FOLD: MAE={avg_mae:.4f} +/- {std_mae:.4f}")
|
| 231 |
+
|
| 232 |
+
# Final test evaluation
|
| 233 |
+
X_te_sc = best_scaler.transform(
|
| 234 |
+
X_te.reshape(len(X_te), -1)
|
| 235 |
+
).reshape(X_te.shape).astype(np.float32)
|
| 236 |
+
|
| 237 |
+
y_pred_te = best_model.predict(X_te_sc, verbose=0).flatten()
|
| 238 |
+
y_pred_te = np.clip(y_pred_te, 0.0, 4.0)
|
| 239 |
+
|
| 240 |
+
test_mae = float(np.mean(np.abs(y_te - y_pred_te)))
|
| 241 |
+
test_mse = float(np.mean((y_te - y_pred_te)**2))
|
| 242 |
+
corr, _ = pearsonr(y_te, y_pred_te)
|
| 243 |
+
|
| 244 |
+
print(f" TEST: MAE={test_mae:.4f} MSE={test_mse:.4f} "
|
| 245 |
+
f"Corr={corr:.3f}")
|
| 246 |
+
|
| 247 |
+
n_params = best_model.count_params()
|
| 248 |
+
print(f" Params: {n_params:,}")
|
| 249 |
+
|
| 250 |
+
# Save model and scaler
|
| 251 |
+
best_model.save(str(RESULTS_DIR / f'{run_name}_model.keras'))
|
| 252 |
+
joblib.dump(best_scaler, str(RESULTS_DIR / f'{run_name}_scaler.pkl'))
|
| 253 |
+
|
| 254 |
+
return {
|
| 255 |
+
'run': run_name,
|
| 256 |
+
'arch': arch_name,
|
| 257 |
+
'optimizer':optimizer,
|
| 258 |
+
'lr': lr,
|
| 259 |
+
'batch': batch_size,
|
| 260 |
+
'cv_mae': avg_mae,
|
| 261 |
+
'cv_std': std_mae,
|
| 262 |
+
'test_mae': test_mae,
|
| 263 |
+
'test_mse': test_mse,
|
| 264 |
+
'corr': corr,
|
| 265 |
+
'n_params': n_params,
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
OPTIMIZERS = ['adam', 'rmsprop']
|
| 270 |
+
BATCH_SIZES = [8, 16]
|
| 271 |
+
LEARNING_RATES = [1e-3, 5e-4]
|
| 272 |
+
N_FOLDS = 3
|
| 273 |
+
|
| 274 |
+
all_results = []
|
| 275 |
+
|
| 276 |
+
# Architecture configs to test
|
| 277 |
+
ARCH_CONFIGS = [
|
| 278 |
+
# Dense variants
|
| 279 |
+
('Dense_medium', lambda: build_dense(390, hidden=(64,), dropout=0.2), False),
|
| 280 |
+
('Dense_large', lambda: build_dense(390, hidden=(128,64),dropout=0.3), False),
|
| 281 |
+
# CNN variants
|
| 282 |
+
('CNN_medium', lambda: build_cnn(filters=(32,), kernel=3), True),
|
| 283 |
+
# LSTM
|
| 284 |
+
('LSTM_medium', lambda: build_lstm(units=(64,), ), True),
|
| 285 |
+
# GRU
|
| 286 |
+
('GRU_medium', lambda: build_gru(units=(64,), ), True),
|
| 287 |
+
]
|
| 288 |
+
|
| 289 |
+
for arch_name, build_fn, is_seq in ARCH_CONFIGS:
|
| 290 |
+
X_tv = X_seq_tv if is_seq else X_flat_tv
|
| 291 |
+
X_te = X_seq_te if is_seq else X_flat_te
|
| 292 |
+
|
| 293 |
+
for opt in OPTIMIZERS:
|
| 294 |
+
for lr in LEARNING_RATES:
|
| 295 |
+
for bs in BATCH_SIZES:
|
| 296 |
+
result = run_cv(
|
| 297 |
+
X_tv, y_tv, X_te, y_te,
|
| 298 |
+
build_fn, is_seq,
|
| 299 |
+
opt, lr, bs,
|
| 300 |
+
arch_name, N_FOLDS
|
| 301 |
+
)
|
| 302 |
+
all_results.append(result)
|
| 303 |
+
results_df = pd.DataFrame(all_results).sort_values('cv_mae')
|
| 304 |
+
results_df.to_csv(str(RESULTS_DIR / 'all_results.csv'), index=False)
|
| 305 |
+
print(results_df[['arch','optimizer','cv_mae','test_mae',
|
| 306 |
+
'corr','n_params']].to_string(index=False))
|
| 307 |
+
|
| 308 |
+
# Evaluation
|
| 309 |
+
|
| 310 |
+
def full_evaluation(y_true, y_pred, arch_name, results_dir):
|
| 311 |
+
y_pred = np.clip(y_pred, float(y_true.min()), float(y_true.max()))
|
| 312 |
+
|
| 313 |
+
mae = float(np.mean(np.abs(y_true - y_pred)))
|
| 314 |
+
mse = float(np.mean((y_true - y_pred)**2))
|
| 315 |
+
bias = float(np.mean(y_pred - y_true))
|
| 316 |
+
corr, p_val = pearsonr(y_true, y_pred)
|
| 317 |
+
|
| 318 |
+
print(f" Evaluation: {arch_name}")
|
| 319 |
+
print(f" MAE : {mae:.4f}")
|
| 320 |
+
print(f" MSE : {mse:.4f}")
|
| 321 |
+
print(f" Correlation : {corr:.3f} (p={p_val:.4f})")
|
| 322 |
+
print(f" Bias : {bias:+.4f} "
|
| 323 |
+
f"({'over-predicts' if bias > 0 else 'under-predicts'})")
|
| 324 |
+
|
| 325 |
+
# Plot 1: Predicted vs Ground Truth
|
| 326 |
+
fig, axes = plt.subplots(1, 3, figsize=(15, 5))
|
| 327 |
+
fig.suptitle(f'Evaluation — {arch_name}', fontsize=13)
|
| 328 |
+
|
| 329 |
+
# Scatter: predicted vs true
|
| 330 |
+
ax = axes[0]
|
| 331 |
+
ax.scatter(y_true, y_pred, alpha=0.7, color='steelblue', s=40)
|
| 332 |
+
lims = [min(y_true.min(), y_pred.min()) - 0.05,
|
| 333 |
+
max(y_true.max(), y_pred.max()) + 0.05]
|
| 334 |
+
ax.plot(lims, lims, 'r--', lw=1.5, label='Perfect prediction')
|
| 335 |
+
ax.set_xlabel('Ground Truth Score')
|
| 336 |
+
ax.set_ylabel('Predicted Score')
|
| 337 |
+
ax.set_title(f'Predicted vs True\nCorr={corr:.3f} MAE={mae:.4f}')
|
| 338 |
+
ax.legend()
|
| 339 |
+
ax.set_xlim(lims)
|
| 340 |
+
ax.set_ylim(lims)
|
| 341 |
+
|
| 342 |
+
# Plot 2: Bland-Altman
|
| 343 |
+
means = (y_true + y_pred) / 2
|
| 344 |
+
diffs = y_true - y_pred
|
| 345 |
+
md = np.mean(diffs)
|
| 346 |
+
sd = np.std(diffs)
|
| 347 |
+
upper = md + 1.96 * sd
|
| 348 |
+
lower = md - 1.96 * sd
|
| 349 |
+
|
| 350 |
+
ax = axes[1]
|
| 351 |
+
ax.scatter(means, diffs, alpha=0.7, color='steelblue', s=40)
|
| 352 |
+
ax.axhline(md, color='red', lw=2, label=f'Bias={md:+.3f}')
|
| 353 |
+
ax.axhline(upper, color='gray', lw=1.5, linestyle='--',
|
| 354 |
+
label=f'+1.96SD={upper:.3f}')
|
| 355 |
+
ax.axhline(lower, color='gray', lw=1.5, linestyle='--',
|
| 356 |
+
label=f'-1.96SD={lower:.3f}')
|
| 357 |
+
ax.axhline(0, color='black', lw=0.5, linestyle=':')
|
| 358 |
+
ax.set_xlabel('Mean of True and Predicted')
|
| 359 |
+
ax.set_ylabel('True − Predicted')
|
| 360 |
+
ax.set_title('Bland-Altman Plot\n(bias and limits of agreement)')
|
| 361 |
+
ax.legend(fontsize=8)
|
| 362 |
+
|
| 363 |
+
# Plot 3: Outlier analysis
|
| 364 |
+
abs_errors = np.abs(y_true - y_pred)
|
| 365 |
+
outlier_threshold = md + 2 * sd # points outside 2 SD = outliers
|
| 366 |
+
is_outlier = np.abs(diffs) > abs(outlier_threshold)
|
| 367 |
+
n_outliers = is_outlier.sum()
|
| 368 |
+
|
| 369 |
+
ax = axes[2]
|
| 370 |
+
ax.bar(range(len(abs_errors)),
|
| 371 |
+
sorted(abs_errors, reverse=True),
|
| 372 |
+
color=['red' if e > abs(outlier_threshold) else 'steelblue'
|
| 373 |
+
for e in sorted(abs_errors, reverse=True)])
|
| 374 |
+
ax.axhline(abs(outlier_threshold), color='red', lw=1.5,
|
| 375 |
+
linestyle='--', label=f'Outlier threshold={abs(outlier_threshold):.3f}')
|
| 376 |
+
ax.set_xlabel('Video (sorted by error)')
|
| 377 |
+
ax.set_ylabel('Absolute Error')
|
| 378 |
+
ax.set_title(f'Outlier Analysis\n{n_outliers} outliers detected')
|
| 379 |
+
ax.legend()
|
| 380 |
+
|
| 381 |
+
plt.tight_layout()
|
| 382 |
+
plot_path = results_dir / f'{arch_name}_evaluation.png'
|
| 383 |
+
plt.close()
|
| 384 |
+
|
| 385 |
+
# Bias direction interpretation
|
| 386 |
+
print(f"\n Bias analysis:")
|
| 387 |
+
if abs(bias) < 0.01:
|
| 388 |
+
print(f" No systematic bias")
|
| 389 |
+
elif bias > 0:
|
| 390 |
+
print(f" Model over-predicts by {bias:.4f} on average")
|
| 391 |
+
else:
|
| 392 |
+
print(f" Model under-predicts by {abs(bias):.4f} on average")
|
| 393 |
+
|
| 394 |
+
# Outlier details
|
| 395 |
+
print(f"\n Outliers (error > 2SD = {abs(outlier_threshold):.3f}):")
|
| 396 |
+
print(f" Count: {n_outliers} / {len(y_true)}")
|
| 397 |
+
if n_outliers > 0:
|
| 398 |
+
outlier_errors = abs_errors[is_outlier]
|
| 399 |
+
print(f" Max outlier error: {outlier_errors.max():.4f}")
|
| 400 |
+
print(f" Possible causes: model bias in specific score range,")
|
| 401 |
+
print(f" unusual exercise form, or noisy ground truth label")
|
| 402 |
+
|
| 403 |
+
# Sort by true score and check if predictions follow same order
|
| 404 |
+
sorted_idx = np.argsort(y_true)
|
| 405 |
+
rank_corr = np.corrcoef(
|
| 406 |
+
np.argsort(y_true), np.argsort(y_pred))[0, 1]
|
| 407 |
+
|
| 408 |
+
print(f"\n Usefulness check (ranking consistency):")
|
| 409 |
+
print(f" Rank correlation: {rank_corr:.3f}")
|
| 410 |
+
if rank_corr > 0.7:
|
| 411 |
+
print(f"Model correctly ranks better vs worse exercises")
|
| 412 |
+
elif rank_corr > 0.4:
|
| 413 |
+
print(f"Model partially ranks exercises correctly")
|
| 414 |
+
else:
|
| 415 |
+
print(f"Model struggles to distinguish better from worse")
|
| 416 |
+
|
| 417 |
+
return {
|
| 418 |
+
'mae': mae,
|
| 419 |
+
'mse': mse,
|
| 420 |
+
'corr': corr,
|
| 421 |
+
'bias': bias,
|
| 422 |
+
'n_outliers': int(n_outliers),
|
| 423 |
+
'rank_corr': rank_corr,
|
| 424 |
+
'upper_loa': upper,
|
| 425 |
+
'lower_loa': lower,
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
|
| 429 |
+
# Run evaluation for best model of each architecture family
|
| 430 |
+
|
| 431 |
+
print("Evaluation")
|
| 432 |
+
|
| 433 |
+
eval_results = []
|
| 434 |
+
|
| 435 |
+
for arch_family in ['Dense', 'CNN', 'LSTM', 'GRU']:
|
| 436 |
+
family_df = results_df[results_df['arch'].str.contains(arch_family)]
|
| 437 |
+
if family_df.empty:
|
| 438 |
+
continue
|
| 439 |
+
|
| 440 |
+
best_family = family_df.iloc[0]
|
| 441 |
+
best_run = best_family['run']
|
| 442 |
+
is_seq = any(n in arch_family for n in ['CNN', 'LSTM', 'GRU'])
|
| 443 |
+
|
| 444 |
+
# Load best model
|
| 445 |
+
model_path = RESULTS_DIR / f'{best_run}_model.keras'
|
| 446 |
+
scaler_path = RESULTS_DIR / f'{best_run}_scaler.pkl'
|
| 447 |
+
|
| 448 |
+
if not model_path.exists():
|
| 449 |
+
continue
|
| 450 |
+
|
| 451 |
+
model = tf.keras.models.load_model(str(model_path))
|
| 452 |
+
scaler = joblib.load(str(scaler_path))
|
| 453 |
+
|
| 454 |
+
X_te_use = X_seq_te if is_seq else X_flat_te
|
| 455 |
+
X_te_sc = scaler.transform(
|
| 456 |
+
X_te_use.reshape(len(X_te_use), -1)
|
| 457 |
+
).reshape(X_te_use.shape).astype(np.float32)
|
| 458 |
+
|
| 459 |
+
y_pred = model.predict(X_te_sc, verbose=0).flatten()
|
| 460 |
+
|
| 461 |
+
eval_res = full_evaluation(y_te, y_pred, arch_family, RESULTS_DIR)
|
| 462 |
+
eval_res['arch'] = arch_family
|
| 463 |
+
eval_results.append(eval_res)
|
| 464 |
+
|
| 465 |
+
# Final comparison table
|
| 466 |
+
eval_df = pd.DataFrame(eval_results)
|
| 467 |
+
eval_df.to_csv(str(RESULTS_DIR / 'evaluation_summary.csv'), index=False)
|
| 468 |
+
|
| 469 |
+
print(f"\n{'='*55}")
|
| 470 |
+
print("EVALUATION SUMMARY — All architectures")
|
| 471 |
+
print(f"{'='*55}")
|
| 472 |
+
print(eval_df[['arch', 'mae', 'mse', 'corr',
|
| 473 |
+
'bias', 'n_outliers', 'rank_corr']].to_string(index=False))
|
| 474 |
+
|
| 475 |
+
# MAE comparison bar chart
|
| 476 |
+
plt.figure(figsize=(8, 5))
|
| 477 |
+
plt.bar(eval_df['arch'], eval_df['mae'], color='steelblue', alpha=0.8)
|
| 478 |
+
plt.axhline(eval_df['mae'].min(), color='red', lw=1.5,
|
| 479 |
+
linestyle='--', label=f"Best MAE={eval_df['mae'].min():.4f}")
|
| 480 |
+
plt.xlabel('Architecture')
|
| 481 |
+
plt.ylabel('Test MAE')
|
| 482 |
+
plt.title('MAE Comparison — Dense vs CNN vs LSTM vs GRU')
|
| 483 |
+
plt.legend()
|
| 484 |
+
plt.tight_layout()
|
| 485 |
+
plt.close()
|
| 486 |
+
|
| 487 |
+
|
| 488 |
+
# Save best model with pipeline-ready filenames
|
| 489 |
+
import shutil
|
| 490 |
+
import json
|
| 491 |
+
|
| 492 |
+
best = results_df.iloc[0]
|
| 493 |
+
best_run = best['run']
|
| 494 |
+
|
| 495 |
+
# Copy best model to pipeline folder with standard names
|
| 496 |
+
pipeline_model = Path('models/scoring_model.keras')
|
| 497 |
+
pipeline_scaler = Path('models/scoring_scaler.pkl')
|
| 498 |
+
|
| 499 |
+
shutil.copy(
|
| 500 |
+
str(RESULTS_DIR / f'{best_run}_model.keras'),
|
| 501 |
+
str(pipeline_model)
|
| 502 |
+
)
|
| 503 |
+
shutil.copy(
|
| 504 |
+
str(RESULTS_DIR / f'{best_run}_scaler.pkl'),
|
| 505 |
+
str(pipeline_scaler)
|
| 506 |
+
)
|
| 507 |
+
print(f"\nPipeline models saved:")
|
| 508 |
+
print(f" {pipeline_model}")
|
| 509 |
+
print(f" {pipeline_scaler}")
|
| 510 |
+
|
| 511 |
+
# Save training summary JSON
|
| 512 |
+
training_summary = {
|
| 513 |
+
"best_architecture": best['arch'],
|
| 514 |
+
"best_optimizer": best['optimizer'],
|
| 515 |
+
"best_lr": best['lr'],
|
| 516 |
+
"best_batch": int(best['batch']),
|
| 517 |
+
"cv_folds": N_FOLDS,
|
| 518 |
+
"cv_mae": round(float(best['cv_mae']), 4),
|
| 519 |
+
"cv_std": round(float(best['cv_std']), 4),
|
| 520 |
+
"test_mae": round(float(best['test_mae']), 4),
|
| 521 |
+
"test_mse": round(float(best['test_mse']), 4),
|
| 522 |
+
"correlation": round(float(best['corr']), 4),
|
| 523 |
+
"n_params": int(best['n_params']),
|
| 524 |
+
"n_training_videos": len(y_tv),
|
| 525 |
+
"n_test_videos": len(y_te),
|
| 526 |
+
"score_range_min": round(float(y.min()), 4),
|
| 527 |
+
"score_range_max": round(float(y.max()), 4),
|
| 528 |
+
"model_path": str(pipeline_model),
|
| 529 |
+
"scaler_path": str(pipeline_scaler),
|
| 530 |
+
}
|
| 531 |
+
|
| 532 |
+
with open(str(RESULTS_DIR / 'training_summary.json'), 'w') as f:
|
| 533 |
+
json.dump(training_summary, f, indent=2)
|
| 534 |
+
print(f" training_summary.json saved")
|
A15_results/all_results.csv
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
run,arch,optimizer,lr,batch,cv_mae,cv_std,test_mae,test_mse,corr,n_params
|
| 2 |
+
Dense_medium_rmsprop_lr0.001_bs8,Dense_medium,rmsprop,0.001,8,0.17867028568932555,0.01529392863717864,0.4350904098589761,0.3338162749835856,0.7168566910699684,25089
|
| 3 |
+
LSTM_medium_adam_lr0.001_bs8,LSTM_medium,adam,0.001,8,0.1800716594358689,0.01907819290805095,0.4805076428678716,0.4124168857722268,0.7258798100859596,27681
|
| 4 |
+
GRU_medium_adam_lr0.001_bs8,GRU_medium,adam,0.001,8,0.18263240969208713,0.008196262408457389,0.4978374472530364,0.4069309667568563,0.6983978761262384,21217
|
| 5 |
+
Dense_medium_rmsprop_lr0.001_bs16,Dense_medium,rmsprop,0.001,16,0.1877385429114006,0.018550727682078424,0.42501829051224843,0.33953634865447563,0.7370373436700469,25089
|
| 6 |
+
Dense_medium_adam_lr0.001_bs16,Dense_medium,adam,0.001,16,0.18988567024918745,0.001548777988492739,0.4961737122017996,0.41969392892013935,0.731547477636405,25089
|
| 7 |
+
Dense_medium_adam_lr0.001_bs8,Dense_medium,adam,0.001,8,0.19060111297218044,0.01560567318679147,0.4658023339707511,0.3775509658186632,0.6705145799092879,25089
|
| 8 |
+
Dense_medium_adam_lr0.0005_bs8,Dense_medium,adam,0.0005,8,0.19079687280255472,0.029916400935477372,0.3761711538455418,0.2352022066750933,0.8000819557382105,25089
|
| 9 |
+
Dense_medium_rmsprop_lr0.0005_bs8,Dense_medium,rmsprop,0.0005,8,0.20083483859942042,0.009282649201182965,0.4413911361852918,0.31739790576399757,0.7204620896049767,25089
|
| 10 |
+
LSTM_medium_rmsprop_lr0.001_bs8,LSTM_medium,rmsprop,0.001,8,0.20152651777800049,0.004763963073973094,0.4696366921086516,0.39474805179898986,0.7011867033316856,27681
|
| 11 |
+
GRU_medium_rmsprop_lr0.001_bs16,GRU_medium,rmsprop,0.001,16,0.20239707731713608,0.013629937002842233,0.4510719499625887,0.32731626310025036,0.7519712076931833,21217
|
| 12 |
+
GRU_medium_rmsprop_lr0.001_bs8,GRU_medium,rmsprop,0.001,8,0.20630214497045385,0.009780695700014809,0.44075304910801477,0.3310617033303087,0.7605136066868842,21217
|
| 13 |
+
GRU_medium_adam_lr0.001_bs16,GRU_medium,adam,0.001,16,0.2063551227056627,0.013487118326759714,0.494405919065203,0.3949171820533429,0.7198953513505101,21217
|
| 14 |
+
LSTM_medium_adam_lr0.001_bs16,LSTM_medium,adam,0.001,16,0.2079605364644723,0.014460704355983768,0.456883504573822,0.3987971082331363,0.7089352686114521,27681
|
| 15 |
+
GRU_medium_adam_lr0.0005_bs8,GRU_medium,adam,0.0005,8,0.21039528386056186,0.004901703627277558,0.4482039950861794,0.2881349385559845,0.780106240619348,21217
|
| 16 |
+
Dense_medium_rmsprop_lr0.0005_bs16,Dense_medium,rmsprop,0.0005,16,0.2111129631534634,0.015007425115871706,0.4921905490336826,0.40891206796966467,0.6633640800300157,25089
|
| 17 |
+
LSTM_medium_rmsprop_lr0.001_bs16,LSTM_medium,rmsprop,0.001,16,0.21137395496762798,0.010707092202506378,0.46608733073185515,0.4002934102535384,0.7051678882798852,27681
|
| 18 |
+
LSTM_medium_rmsprop_lr0.0005_bs8,LSTM_medium,rmsprop,0.0005,8,0.217335375455326,0.011669527571121326,0.4589455251426425,0.3448251500350271,0.7418823501546107,27681
|
| 19 |
+
Dense_medium_adam_lr0.0005_bs16,Dense_medium,adam,0.0005,16,0.21756713379551182,0.008133126107412092,0.46598718850228443,0.38463025350075686,0.751449832459239,25089
|
| 20 |
+
LSTM_medium_adam_lr0.0005_bs16,LSTM_medium,adam,0.0005,16,0.21862562539476812,0.010282812481596933,0.5099848002554483,0.42968556591673346,0.705365321939554,27681
|
| 21 |
+
LSTM_medium_adam_lr0.0005_bs8,LSTM_medium,adam,0.0005,8,0.23204322868509408,0.02518791873798407,0.47374836393838604,0.3986904886217605,0.729635290562879,27681
|
| 22 |
+
LSTM_medium_rmsprop_lr0.0005_bs16,LSTM_medium,rmsprop,0.0005,16,0.23517766923521133,0.020267075121995874,0.44964375989973887,0.34462169496354345,0.7326593774590189,27681
|
| 23 |
+
GRU_medium_adam_lr0.0005_bs16,GRU_medium,adam,0.0005,16,0.23567194684088325,0.0194789652592315,0.5086262896612166,0.41456995959644577,0.6875901471849727,21217
|
| 24 |
+
CNN_medium_adam_lr0.001_bs8,CNN_medium,adam,0.001,8,0.23723444295437923,0.010365907818715457,0.4783251710640498,0.32755894077115477,0.7722593550383435,4321
|
| 25 |
+
GRU_medium_rmsprop_lr0.0005_bs8,GRU_medium,rmsprop,0.0005,8,0.23941935354969715,0.002894718049385843,0.40105145198734826,0.28634726316363457,0.7678085757898963,21217
|
| 26 |
+
GRU_medium_rmsprop_lr0.0005_bs16,GRU_medium,rmsprop,0.0005,16,0.2465236894238624,0.018683170604196282,0.4230347317207064,0.2721733432506233,0.7808945943652076,21217
|
| 27 |
+
CNN_medium_rmsprop_lr0.001_bs8,CNN_medium,rmsprop,0.001,8,0.25199918095740403,0.010106387957420356,0.4463405985034942,0.3258374232173171,0.7173870954827496,4321
|
| 28 |
+
Dense_large_adam_lr0.001_bs8,Dense_large,adam,0.001,8,0.2538258124754538,0.02907010310737792,0.43742392549705506,0.2770107431366515,0.7555282593504543,58369
|
| 29 |
+
CNN_medium_adam_lr0.0005_bs8,CNN_medium,adam,0.0005,8,0.25481424120102786,0.007748835407335269,0.5277492756642477,0.412444919660116,0.7008204070743222,4321
|
| 30 |
+
CNN_medium_rmsprop_lr0.001_bs16,CNN_medium,rmsprop,0.001,16,0.25668880493108753,0.005031040637623877,0.523228017603302,0.44140205335544047,0.646463377257413,4321
|
| 31 |
+
CNN_medium_rmsprop_lr0.0005_bs8,CNN_medium,rmsprop,0.0005,8,0.2685415490695615,0.017443280567834944,0.46146210634514945,0.3354740710690343,0.7153146666917323,4321
|
| 32 |
+
CNN_medium_adam_lr0.0005_bs16,CNN_medium,adam,0.0005,16,0.2785586420020754,0.013256419952107077,0.47950867409575326,0.3673868333347743,0.6953515113472469,4321
|
| 33 |
+
CNN_medium_rmsprop_lr0.0005_bs16,CNN_medium,rmsprop,0.0005,16,0.2791581450204998,0.007236256831082151,0.4384497751406533,0.2913168907854327,0.6844588435787191,4321
|
| 34 |
+
Dense_large_rmsprop_lr0.001_bs8,Dense_large,rmsprop,0.001,8,0.28022082255159436,0.03004320028683914,0.5265716969017028,0.4214863557823573,0.6596226079809696,58369
|
| 35 |
+
CNN_medium_adam_lr0.001_bs16,CNN_medium,adam,0.001,16,0.2820429420055424,0.01594926177103665,0.5064092923989432,0.35869886040396165,0.6976602816117252,4321
|
| 36 |
+
Dense_large_adam_lr0.001_bs16,Dense_large,adam,0.001,16,0.30281243667522856,0.0374916758407071,0.4223720319159372,0.29176918907534777,0.7675867029252396,58369
|
| 37 |
+
Dense_large_adam_lr0.0005_bs16,Dense_large,adam,0.0005,16,0.321730621546243,0.007274738265215329,0.46684504484612604,0.35707777256124545,0.6666760166097051,58369
|
| 38 |
+
Dense_large_rmsprop_lr0.0005_bs8,Dense_large,rmsprop,0.0005,8,0.3263416762466717,0.02766273132206714,0.41900325738274713,0.26371439658727935,0.7461207601801227,58369
|
| 39 |
+
Dense_large_rmsprop_lr0.001_bs16,Dense_large,rmsprop,0.001,16,0.3272037176865324,0.029779367203374926,0.45033489762878415,0.31702474735447067,0.6820311525266298,58369
|
| 40 |
+
Dense_large_adam_lr0.0005_bs8,Dense_large,adam,0.0005,8,0.3575283280063643,0.05092991187954022,0.4301565907345907,0.3140201824279853,0.7243132861438427,58369
|
| 41 |
+
Dense_large_rmsprop_lr0.0005_bs16,Dense_large,rmsprop,0.0005,16,0.3805917744419858,0.009189916037306376,0.4720974719660077,0.36935708664679406,0.7135904697899167,58369
|
A15_results/evaluation_summary.csv
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
mae,mse,corr,bias,n_outliers,rank_corr,upper_loa,lower_loa,arch
|
| 2 |
+
0.41830469029399325,0.3073028257250196,0.7245079055232034,0.09640383504431588,7,-0.2311783745953985,0.9735643231954378,-1.1663719932840697,Dense
|
| 3 |
+
0.4376067773976462,0.26021160020795403,0.7845161250987035,0.06429411723245892,4,-0.32478348350975417,0.92754696515129,-1.0561351996162078,CNN
|
| 4 |
+
0.38735818531526833,0.2607502802134924,0.7798450999539759,0.029285585423605782,5,0.3200944799230163,0.969915868469999,-1.0284870393172105,LSTM
|
| 5 |
+
0.42879032916826515,0.2905454631620759,0.7427105287980181,0.01394214754758561,5,0.19524101128510193,1.042188861235619,-1.0700731563307901,GRU
|
A15_results/training_summary.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"best_architecture": "Dense_medium",
|
| 3 |
+
"best_optimizer": "rmsprop",
|
| 4 |
+
"best_lr": 0.001,
|
| 5 |
+
"best_batch": 8,
|
| 6 |
+
"cv_folds": 3,
|
| 7 |
+
"cv_mae": 0.1787,
|
| 8 |
+
"cv_std": 0.0153,
|
| 9 |
+
"test_mae": 0.4351,
|
| 10 |
+
"test_mse": 0.3338,
|
| 11 |
+
"correlation": 0.7169,
|
| 12 |
+
"n_params": 25089,
|
| 13 |
+
"n_training_videos": 670,
|
| 14 |
+
"n_test_videos": 70,
|
| 15 |
+
"score_range_min": 0.0,
|
| 16 |
+
"score_range_max": 4.0,
|
| 17 |
+
"model_path": "models/scoring_model.keras",
|
| 18 |
+
"scaler_path": "models/scoring_scaler.pkl"
|
| 19 |
+
}
|
models/scoring_model.keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:62ed250eb929131c4ba2a12ddc1d24d855b4d07d47bcb15bfe8f0dd85078bd84
|
| 3 |
+
size 224646
|
models/scoring_scaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:81c22ab8188ff194dbcef116756fbdaa44dafd7ca38a4d703823b8fc4d590909
|
| 3 |
+
size 9975
|