Exemple #1
0
leg0 = []
leg1 = []
for i, outvec in enumerate(output_VEC):
    trainRMSE, testRMSE = A.getTrainTestDependence(outvec)

    ax[0].plot(variable,
               testRMSE,
               linestyle=linestyles[i],
               linewidth=3,
               marker='.',
               markersize=8)
    leg0.append(feature_opt_vec[i])

    # Coefficients Dependence Multi
    featarray, relevant_feats = A.getCoefDependence(outvec,
                                                    threshold=0.01,
                                                    invert_sign=True)
    for j in range(len(relevant_feats)):
        ax[1].plot(variable,
                   featarray[:, j],
                   linestyle=styles[i][0],
                   marker=styles[i][1],
                   linewidth=2.5,
                   markersize=7)
    leg = ax[1].legend(latexify_varcoef(relevant_feats, cdf=False),
                       bbox_to_anchor=(.98, 1),
                       fontsize=14)

ax[0].set_xlabel(xlabel, fontsize=14)
ax[0].set_ylabel('RMSE', fontsize=14)
ax[0].legend(leg0)
linestyles = ['solid', 'dashed', 'dashdot', 'dotted']
marker = ['o', 'v', 's',
          '*']  #, '^', '>', '<', 'x', 'D', '1', '.', '2', '3', '4']
styles = [[l, m] for l in linestyles for m in marker]

mse = [min(out['alpha_mse_path']) for out in output_vec]

ax[0].plot(variable, testRMSE, '.-', linewidth=3, markersize=8)
# ax[0].plot(variable, mse, '*-', linewidth=3, markersize=8)
ax[0].set_xlabel('$N_{MC}$, Number of Realizations', fontsize=14)
ax[0].set_ylabel('RMSE on $\mathcal D_\t{test}$', fontsize=14)
# ax[0].legend(['Test Error', 'MSE'])

# Coefficients Dependence Multi
featarray, relevant_feats = A.getCoefDependence(output_vec,
                                                threshold=threshold,
                                                invert_sign=invert_sign)
for i in range(len(relevant_feats)):
    ax[1].plot(variable,
               featarray[:, i],
               linestyle=styles[i][0],
               marker=styles[i][1],
               linewidth=2.5,
               markersize=7)
ax[1].set_xlabel('$N_{MC}$, Number of Realizations', fontsize=14)
ax[1].set_ylabel('Coefficients', fontsize=14)
leg = ax[1].legend(latexify_varcoef(relevant_feats, cdf=cdf),
                   bbox_to_anchor=(1, 1),
                   fontsize=14)
leg.get_frame().set_linewidth(0.0)