comp = pd.DataFrame([
{'modele': 'M12 HAR-RV-J (OLS)', 'params': 7, 'angle': 'strategie (Sharpe)', 'beats': 'BEATS, deploye', 'n': 'prod'},
{'modele': 'M4 DLinear', 'params': 22, 'angle': 'prevision (MSE)', 'beats': '5/21', 'n': '21'},
{'modele': 'M15 Log-LSTM h=32', 'params': 4769, 'angle': 'strategie (Sharpe)', 'beats': 'BEATS, non-deploye', 'n': 'keeper'},
{'modele': 'M9 TFT', 'params': 110801, 'angle': 'prevision (DirAcc)', 'beats': '0/6', 'n': '6'},
])
ys = [4, 3, 2, 1]
fig, ax = plt.subplots(figsize=(7.5, 3.8))
ax.scatter(comp['params'], ys, s=[120, 140, 160, 220],
c=['#2ecc71', '#3498db', '#f39c12', '#e74c3c'], edgecolor='k', linewidth=0.8, zorder=3)
for i, r in comp.iterrows():
ax.annotate(r['beats'], (r['params'], ys[i]),
xytext=(8, 0), textcoords='offset points', fontsize=9, va='center')
ax.set_xscale('log')
ax.set_yticks([1, 2, 3, 4])
ax.set_yticklabels(['M9 TFT', 'M15 LSTM', 'M4 DLinear', 'M12 OLS'])
ax.set_xlabel('Nombre de parametres (echelle log)')
ax.set_title('Courbe d expressivite inversee : plus de params = moins de succes sur ce benchmark')
ax.axvline(7, color='green', linewidth=0.6, linestyle=':', alpha=0.5)
ax.axvline(110801, color='red', linewidth=0.6, linestyle=':', alpha=0.5)
plt.tight_layout()
plt.show()
print('Vert (M12 OLS, 7p) = deploye. Rouge (M9 TFT, 110Kp) = 0/6 BEATS. L expressivite nuit a la generalisation.')