From the mac

master
sanginnwoo 2022-10-21 12:18:07 +09:00
parent cba87a151a
commit b96bda38cc
1 changed files with 93 additions and 81 deletions

View File

@ -10,15 +10,18 @@ import matplotlib.pyplot as plt
'Final_error_hyper_original', 'Final_error_hyper_nonlinear']
'''
# CSV 파일 읽기
# CSV 파일 읽기 (일단, 다단 성토 포함)
df_overall = pd.read_csv('Error_overall.csv', encoding='euc-kr')
# 통계량 저장소
# 열 mean / median / percentile
# 행 RMSE (O) / RMSE (NL) / FE (O) / FE (NL)
# 통계량 저장소 statistics 초기화
statistic =[]
count = 0
# 통계량 저장소 statistics 데이터 구조
# mean / median / percentile
# RMSE (O)
# RMSE (NL)
# FE (O)
# FE (NL)
# 최종 성토 단계에서 각 침하 데이터 사용 영역에 대해서 다음을 수행
for data_usage in range(20, 100, 10):
@ -32,26 +35,21 @@ for data_usage in range(20, 100, 10):
FE_hyper_original = df_overall_sel['Final_error_hyper_original'].to_numpy()
FE_hyper_nonlinear = df_overall_sel['Final_error_hyper_nonlinear'].to_numpy()
# 중앙값, 평균, 90% percentile 산정 및 저장
statistic.append([np.mean(RMSE_hyper_original),
np.median(RMSE_hyper_original),
# 평균, 중앙값, 90% percentile 산정 및 저장
statistic.append([np.mean(RMSE_hyper_original), np.median(RMSE_hyper_original),
np.percentile(RMSE_hyper_original, 90)])
statistic.append([np.mean(RMSE_hyper_nonlinear),
np.median(RMSE_hyper_nonlinear),
statistic.append([np.mean(RMSE_hyper_nonlinear), np.median(RMSE_hyper_nonlinear),
np.percentile(RMSE_hyper_nonlinear, 90)])
statistic.append([np.mean(FE_hyper_original),
np.median(FE_hyper_original),
statistic.append([np.mean(FE_hyper_original), np.median(FE_hyper_original),
np.percentile(FE_hyper_original, 90)])
statistic.append([np.mean(FE_hyper_nonlinear),
np.median(FE_hyper_nonlinear),
statistic.append([np.mean(FE_hyper_nonlinear), np.median(FE_hyper_nonlinear),
np.percentile(FE_hyper_nonlinear, 90)])
# 그래프 설정 (2 by 2)
fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, figsize = (8, 8))
# 그래프 제목 설정
fig.suptitle('Histograms: ' + str(data_usage) +
'% of Settlement Data Used in the Final Step')
fig.suptitle('Histograms: ' + str(data_usage) + '% of Settlement Data Used in the Final Step')
# 각 Subplot의 제목 설정
ax1.set_xlabel('RMSE (Original Hyperbolic) (cm)')
@ -81,50 +79,54 @@ for data_usage in range(20, 100, 10):
ax.set_xlim(0, 50)
ax.set_ylim(0, 0.5)
count = count + 1
# 그래프 저장 (SVG 및 PNG)
plt.savefig('error_analysis/error_nonstep(%i percent).png' % data_usage,
bbox_inches='tight')
# 데이터 사용 영역 설정
data_usages = range(20, 100, 10)
# 통계량 배열을 numpy 배열로 전환
statistic = np.array(statistic)
# 그래프 설정 (총 4개의 그래프)
fig, ((ax1, ax2), (ax3, ax4), (ax5, ax6)) = plt.subplots(3, 2, figsize = (8, 12))
# 그래프 전체 제목 설정
fig.suptitle("Original Hyperbolic vs. Nonlinear Hyperbolic")
# mean rmse
# 데이터 사용량 대비 RMSE 평균값 변화 도시
ax1.set_ylabel('Mean(RMSE) (cm)')
ax1.plot(data_usages, statistic[0::4, 0], label = 'Original Hyperbolic')
ax1.plot(data_usages, statistic[1::4, 0], label = 'Nonlinear Hyperbolic')
ax1.legend()
# mean fe
# 데이터 사용량 대비 FE 평균값 변화 도시
ax2.set_ylabel('Mean(FE) (cm)')
ax2.plot(data_usages, statistic[2::4, 0])
ax2.plot(data_usages, statistic[3::4, 0])
ax2.plot(data_usages, statistic[2::4, 0], label = 'Original Hyperbolic')
ax2.plot(data_usages, statistic[3::4, 0], label = 'Nonlinear Hyperbolic')
# median rmse
# 데이터 사용량 대비 RMSE 중앙값 변화 도시
ax3.set_ylabel('Median(RMSE) (cm)')
ax3.plot(data_usages, statistic[0::4, 1])
ax3.plot(data_usages, statistic[1::4, 1])
# median fe
# 데이터 사용량 대비 FE 중앙값 변화 도시
ax4.set_ylabel('Median(FE) (cm)')
ax4.plot(data_usages, statistic[2::4, 1])
ax4.plot(data_usages, statistic[3::4, 1])
# percentile rmse
# 데이터 사용량 대비 RMSE의 90% Percentile 변화 도시
ax5.set_ylabel('90% Percentile(RMSE) (cm)')
ax5.plot(data_usages, statistic[0::4, 2])
ax5.plot(data_usages, statistic[1::4, 2])
# percentile fe
# 데이터 사용량 대비 FE의 90% Percentile 변화 도시
ax6.set_ylabel('90% Percentile(FE) (cm)')
ax6.plot(data_usages, statistic[2::4, 2])
ax6.plot(data_usages, statistic[3::4, 2])
# 각 subplot을 포함한 리스트 설정
axes = [ax1, ax2, ax3, ax4, ax5, ax6]
# 공통 사항 적용
@ -146,13 +148,20 @@ plt.savefig('error_analysis/error_overall.png', bbox_inches='tight')
'Final_error_hyper_original', 'Final_error_hyper_nonlinear', 'Final_error_step'
'''
# CSV 파일 읽기 (다단 성토만)
df_multi_step = pd.read_csv('Error_multi_step.csv', encoding='euc-kr')
# 통계량 저장소
# 열 mean / median / percentile
# 행 RMSE (O) / RMSE (NL) / RMSE(S) / FE (O) / FE (NL) / FE (S)
statistic2 =[]
count = 0
# 통계량 저장소 statistics 초기화
statistic_step =[]
# 통계량 저장소 statistics 데이터 구조
# mean / median / percentile
# RMSE (O)
# RMSE (NL)
# RMSE (S)
# FE (O)
# FE (NL)
# FE (S)
# 최종 성토 단계에서 각 침하 데이터 사용 영역에 대해서 다음을 수행
for data_usage in range(20, 100, 10):
@ -169,24 +178,24 @@ for data_usage in range(20, 100, 10):
FE_step = df_multi_step_sel['Final_error_step'].to_numpy()
# 중앙값, 평균, 90% percentile 산정 및 저장
statistic2.append([np.mean(RMSE_hyper_original),
np.median(RMSE_hyper_original),
np.percentile(RMSE_hyper_original, 90)])
statistic2.append([np.mean(RMSE_hyper_nonlinear),
np.median(RMSE_hyper_nonlinear),
np.percentile(RMSE_hyper_nonlinear, 90)])
statistic2.append([np.mean(RMSE_step),
np.median(RMSE_step),
np.percentile(RMSE_step, 90)])
statistic2.append([np.mean(FE_hyper_original),
np.median(FE_hyper_original),
np.percentile(FE_hyper_original, 90)])
statistic2.append([np.mean(FE_hyper_nonlinear),
np.median(FE_hyper_nonlinear),
np.percentile(FE_hyper_nonlinear, 90)])
statistic2.append([np.mean(FE_step),
np.median(FE_step),
np.percentile(FE_step, 90)])
statistic_step.append([np.mean(RMSE_hyper_original),
np.median(RMSE_hyper_original),
np.percentile(RMSE_hyper_original, 90)])
statistic_step.append([np.mean(RMSE_hyper_nonlinear),
np.median(RMSE_hyper_nonlinear),
np.percentile(RMSE_hyper_nonlinear, 90)])
statistic_step.append([np.mean(RMSE_step),
np.median(RMSE_step),
np.percentile(RMSE_step, 90)])
statistic_step.append([np.mean(FE_hyper_original),
np.median(FE_hyper_original),
np.percentile(FE_hyper_original, 90)])
statistic_step.append([np.mean(FE_hyper_nonlinear),
np.median(FE_hyper_nonlinear),
np.percentile(FE_hyper_nonlinear, 90)])
statistic_step.append([np.mean(FE_step),
np.median(FE_step),
np.percentile(FE_step, 90)])
# 그래프 설정 (2 by 2)
fig, ((ax1, ax2, ax3), (ax4, ax5, ax6)) = plt.subplots(2, 3, figsize = (12, 8))
@ -217,66 +226,69 @@ for data_usage in range(20, 100, 10):
# 공통 사항 적용
for i in range(len(axes)):
ax = axes[i]
ax.text(10, 0.4, 'Mean = ' + "{:0.2f}".format(statistic2[count * 6 + i][0]) + '\n' +
'Median = ' + "{:0.2f}".format(statistic2[count * 6 + i][1]) + '\n' +
'90% Percentile = ' + "{:0.2f}".format(statistic2[count * 6 + i][2]))
ax.text(10, 0.4, 'Mean = ' + "{:0.2f}".format(statistic_step[count * 6 + i][0]) + '\n' +
'Median = ' + "{:0.2f}".format(statistic_step[count * 6 + i][1]) + '\n' +
'90% Percentile = ' + "{:0.2f}".format(statistic_step[count * 6 + i][2]))
ax.set_ylabel("Probability")
ax.grid(color="gray", alpha=.5, linestyle='--')
ax.tick_params(direction='in')
ax.set_xlim(0, 50)
ax.set_ylim(0, 0.5)
count = count + 1
# 그래프 저장 (SVG 및 PNG)
plt.savefig('error_analysis/error_step(%i percent).png' % data_usage,
bbox_inches='tight')
# 데이터 사용 영역 배열 설정
data_usages = range(20, 100, 10)
statistic2 = np.array(statistic2)
# 통계량 배열을 numpy 배열로 전환
statistic_step = np.array(statistic_step)
# 그래프 설정 (총 6개의 그래프)
fig, ((ax1, ax2), (ax3, ax4), (ax5, ax6)) = plt.subplots(3, 2, figsize = (8, 12))
fig.suptitle("Hyperbolic vs. Step loading")
# 그래프 전체 제목 설정
fig.suptitle("Hyperbolic methods vs. Step loading")
# mean rmse
# 데이터 사용량 대비 RMSE 평균값 변화 도시
ax1.set_ylabel('Mean(RMSE) (cm)')
ax1.plot(data_usages, statistic2[0::6, 0], label = 'Original Hyperbolic')
ax1.plot(data_usages, statistic2[1::6, 0], label = 'Nonlinear Hyperbolic')
ax1.plot(data_usages, statistic2[2::6, 0], color='k', label = 'Step Loading')
ax1.plot(data_usages, statistic_step[0::6, 0], label ='Original Hyperbolic')
ax1.plot(data_usages, statistic_step[1::6, 0], label ='Nonlinear Hyperbolic')
ax1.plot(data_usages, statistic_step[2::6, 0], color='k', label ='Step Loading')
ax1.legend()
# mean fe
# 데이터 사용량 대비 FE 평균값 변화 도시
ax2.set_ylabel('Mean(FE) (cm)')
ax2.plot(data_usages, statistic2[3::6, 0])
ax2.plot(data_usages, statistic2[4::6, 0])
ax2.plot(data_usages, statistic2[5::6, 0], color='k')
ax2.plot(data_usages, statistic_step[3::6, 0])
ax2.plot(data_usages, statistic_step[4::6, 0])
ax2.plot(data_usages, statistic_step[5::6, 0], color='k')
# median rmse
# 데이터 사용량 대비 RMSE 중앙값 변화 도시
ax3.set_ylabel('Median(RMSE) (cm)')
ax3.plot(data_usages, statistic2[0::6, 1])
ax3.plot(data_usages, statistic2[1::6, 1])
ax3.plot(data_usages, statistic2[2::6, 1], color='k')
ax3.plot(data_usages, statistic_step[0::6, 1])
ax3.plot(data_usages, statistic_step[1::6, 1])
ax3.plot(data_usages, statistic_step[2::6, 1], color='k')
# median fe
# 데이터 사용량 대비 FE 중앙값 변화 도시
ax4.set_ylabel('Median(FE) (cm)')
ax4.plot(data_usages, statistic2[3::6, 1])
ax4.plot(data_usages, statistic2[4::6, 1])
ax4.plot(data_usages, statistic2[5::6, 1], color='k')
ax4.plot(data_usages, statistic_step[3::6, 1])
ax4.plot(data_usages, statistic_step[4::6, 1])
ax4.plot(data_usages, statistic_step[5::6, 1], color='k')
# percentile rmse
# 데이터 사용량 대비 RMSE의 90% Percentile 변화 도시
ax5.set_ylabel('90% Percentile(RMSE) (cm)')
ax5.plot(data_usages, statistic2[0::6, 2])
ax5.plot(data_usages, statistic2[1::6, 2])
ax5.plot(data_usages, statistic2[2::6, 2], color='k')
ax5.plot(data_usages, statistic_step[0::6, 2])
ax5.plot(data_usages, statistic_step[1::6, 2])
ax5.plot(data_usages, statistic_step[2::6, 2], color='k')
# percentile fe
# 데이터 사용량 대비 FE의 90% Percentile 변화 도시
ax6.set_ylabel('90% Percentile(FE) (cm)')
ax6.plot(data_usages, statistic2[3::6, 2])
ax6.plot(data_usages, statistic2[4::6, 2])
ax6.plot(data_usages, statistic2[5::6, 2], color='k')
ax6.plot(data_usages, statistic_step[3::6, 2])
ax6.plot(data_usages, statistic_step[4::6, 2])
ax6.plot(data_usages, statistic_step[5::6, 2], color='k')
# 각 subplot을 포함한 리스트 설정
axes = [ax1, ax2, ax3, ax4, ax5, ax6]
# 공통 사항 적용