Created
April 3, 2022 17:50
-
-
Save rishi-a/36bf0d2db91ce682ab035e5ec3f9ba60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# plots to be manullly made using results from sheet | |
#Cloth Mask | |
#get final numbers by running the ML pipeline above | |
rf_pe= [3.5,4.7,5.2] #MAE for healthy with Random Forest | |
lr_pe = [3.2,6.7,6.3] | |
svr_pe = [8.2,9.7,8.2] | |
rf_std= [1.5,2.2,1.1] #STD for healthy with Random Forest | |
lr_std = [1.3,2.2,1.5] | |
svr_std = [2.6,4.5,4.2] | |
rf_pe_u= [6.2,6.8,6.5] #MAE for unhealthy with Random Forest | |
lr_pe_u = [9.3,8.6,7.8] | |
svr_pe_u = [2.8,10.1,3.21] | |
figname = 'revised-overall-error-cloth' | |
lt.latexify(columns=2, fig_height=2) | |
labels = ['PEF', 'FEV1', 'FVC'] | |
x = np.arange(len(labels)) # the label locations | |
width = 0.30 # the width of the bars | |
fig, ax = plt.subplots(1,2) | |
rects1 = ax[0].bar(x, rf_pe, width, label='Random Forest', yerr=rf_std, ecolor='black', capsize=2.5, align='center') | |
rects2 = ax[0].bar(x + width, lr_pe, width, label='Linear Regression', yerr=lr_std, ecolor='black', capsize=2.5, align='center') | |
rects3 = ax[0].bar(x + width*2, svr_pe, width, label='Support Vector Regressor', yerr=svr_std, ecolor='black', capsize=2.5, align='center') | |
# Add some text for labels, title and custom x-axis tick labels, etc. | |
ax[0].set_title("Overall Eror For All Participants") | |
ax[0].set_ylabel('Percentage Error\n (Lower is better)',fontsize=12) | |
#ax.set_title('Percentage Error For Differnet Type of Mask', fontsize=12) | |
ax[0].set_xticks(x) | |
ax[0].set_xticklabels(labels, fontsize=12) | |
ax[0].set_ylim(0,13) | |
#ax[0].legend(bbox_to_anchor=[0.55,1.2],ncol=3, fontsize=12, loc='center') | |
#ax[0].annotate(' Result For Cloth Mask',xy=(0, 0), xytext=(60, 190),xycoords=('axes fraction', 'axes fraction'),textcoords='offset points',size=14, ha='center', va='bottom', weight='bold') | |
lt.format_axes(ax[0]) | |
rects1 = ax[1].bar(x, rf_pe_u, width, label='Random Forest', ecolor='black', capsize=2.5, align='center') | |
rects2 = ax[1].bar(x + width, lr_pe_u, width, label='Linear Regression', ecolor='black', capsize=2.5, align='center') | |
rects3 = ax[1].bar(x + width*2, svr_pe_u, width, label='Support Vector Regressor', ecolor='black', capsize=2.5, align='center') | |
ax[1].set_title("Average Error For Participants With Lung Discomfort") | |
#ax[1].set_ylabel('Percentage Error',fontsize=12) | |
#ax.set_title('Percentage Error For Differnet Type of Mask', fontsize=12) | |
ax[1].set_xticks(x) | |
ax[1].set_xticklabels(labels, fontsize=12) | |
ax[1].set_ylim(0,13) | |
ax[1].legend(bbox_to_anchor=[0.3,1.5],ncol=3, fontsize=12, loc='center') | |
lt.format_axes(ax[1]) | |
#fig.tight_layout() | |
plt.savefig(figname+'.pdf', bbox_inches='tight') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment