From cba87a151abef0b71b47c6a5356543dd65d89d6a Mon Sep 17 00:00:00 2001 From: sanginnwoo Date: Mon, 17 Oct 2022 20:43:26 +0900 Subject: [PATCH] From SW's laptop --- Error Analysis.py | 291 ++++++++++++++++++++++++++++++++ batch_process.py | 41 ++++- data/1_S-12.csv | 144 ---------------- data/1_SP-11.csv | 125 -------------- data/1_SP-23.csv | 125 -------------- data/3_SP3-65.csv | 183 -------------------- data/3_SP3-68.csv | 128 -------------- data/4_S-11.csv | 158 ----------------- settle_prediction_steps_main.py | 97 +++++------ 9 files changed, 368 insertions(+), 924 deletions(-) create mode 100644 Error Analysis.py delete mode 100644 data/1_S-12.csv delete mode 100644 data/1_SP-11.csv delete mode 100644 data/1_SP-23.csv delete mode 100644 data/3_SP3-65.csv delete mode 100644 data/3_SP3-68.csv delete mode 100644 data/4_S-11.csv diff --git a/Error Analysis.py b/Error Analysis.py new file mode 100644 index 0000000..af5f818 --- /dev/null +++ b/Error Analysis.py @@ -0,0 +1,291 @@ +import pandas as pd +import numpy as np +import matplotlib.pyplot as plt + + +''' +데이터 구조: Error_overall.csv +'File', 'Data_usage', +'RMSE_hyper_original', 'RMSE_hyper_nonlinear', +'Final_error_hyper_original', 'Final_error_hyper_nonlinear'] +''' + +# CSV 파일 읽기 +df_overall = pd.read_csv('Error_overall.csv', encoding='euc-kr') + +# 통계량 저장소 +# 열 mean / median / percentile +# 행 RMSE (O) / RMSE (NL) / FE (O) / FE (NL) +statistic =[] + +count = 0 + +# 최종 성토 단계에서 각 침하 데이터 사용 영역에 대해서 다음을 수행 +for data_usage in range(20, 100, 10): + + # 전체 Error 분석을 위한 Dataframe 설정 + df_overall_sel = df_overall.loc[df_overall['Data_usage'] == data_usage] + + # RMSE 및 FE를 불러서 메모리에 저장 + RMSE_hyper_original = df_overall_sel['RMSE_hyper_original'].to_numpy() + RMSE_hyper_nonlinear = df_overall_sel['RMSE_hyper_nonlinear'].to_numpy() + 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), + np.percentile(RMSE_hyper_original, 90)]) + 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), + np.percentile(FE_hyper_original, 90)]) + 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') + + # 각 Subplot의 제목 설정 + ax1.set_xlabel('RMSE (Original Hyperbolic) (cm)') + ax2.set_xlabel('RMSE (Nonlinear Hyperbolic) (cm)') + ax3.set_xlabel('FE (Original Hyperbolic) (cm)') + ax4.set_xlabel('FE (Nonliner Hyperbolic) (cm)') + + # 각 subplot에 히스토그램 작성 + ax1.hist(RMSE_hyper_original, 5, density=True, facecolor='r', edgecolor='k', alpha=0.75) + ax2.hist(RMSE_hyper_nonlinear, 5, density=True, facecolor='b', edgecolor='k', alpha=0.75) + ax3.hist(FE_hyper_original, 5, density=True, facecolor='r', edgecolor='k', alpha=0.75) + ax4.hist(FE_hyper_nonlinear, 5, density=True, facecolor='b', edgecolor='k', alpha=0.75) + + # 각 subplot을 포함한 리스트 설정 + axes = [ax1, ax2, ax3, ax4] + + # 공통 사항 적용 + for i in range(len(axes)): + ax = axes[i] + ax.text(10, 0.4, 'Mean = ' + "{:0.2f}".format(statistic[count * 4 + i][0]) + '\n' + + 'Median = ' + "{:0.2f}".format(statistic[count * 4 + i][1]) + '\n' + + '90% Percentile = ' + "{:0.2f}".format(statistic[count * 4 + 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_nonstep(%i percent).png' % data_usage, + bbox_inches='tight') + +data_usages = range(20, 100, 10) +statistic = np.array(statistic) + +fig, ((ax1, ax2), (ax3, ax4), (ax5, ax6)) = plt.subplots(3, 2, figsize = (8, 12)) + +fig.suptitle("Original Hyperbolic vs. Nonlinear Hyperbolic") + +# mean 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 +ax2.set_ylabel('Mean(FE) (cm)') +ax2.plot(data_usages, statistic[2::4, 0]) +ax2.plot(data_usages, statistic[3::4, 0]) + +# median 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 +ax4.set_ylabel('Median(FE) (cm)') +ax4.plot(data_usages, statistic[2::4, 1]) +ax4.plot(data_usages, statistic[3::4, 1]) + +# percentile rmse +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 +ax6.set_ylabel('90% Percentile(FE) (cm)') +ax6.plot(data_usages, statistic[2::4, 2]) +ax6.plot(data_usages, statistic[3::4, 2]) + +axes = [ax1, ax2, ax3, ax4, ax5, ax6] + +# 공통 사항 적용 +for ax in axes: + ax.set_xlabel("Data Usage (%)") + ax.grid(color="gray", alpha=.5, linestyle='--') + ax.tick_params(direction='in') + ax.set_xlim(0, 100) + ax.set_ylim(0, 50) + +# 그래프 저장 (SVG 및 PNG) +plt.savefig('error_analysis/error_overall.png', bbox_inches='tight') + + +''' +데이터 구조: Error_multi_step.csv +'File', 'Data_usage', +'RMSE_hyper_original', 'RMSE_hyper_nonlinear', 'RMSE_step', +'Final_error_hyper_original', 'Final_error_hyper_nonlinear', 'Final_error_step' +''' + +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 + +# 최종 성토 단계에서 각 침하 데이터 사용 영역에 대해서 다음을 수행 +for data_usage in range(20, 100, 10): + + # 전체 Error 분석을 위한 Dataframe 설정 + df_multi_step_sel = df_multi_step.loc[df_multi_step['Data_usage'] == data_usage] + + # RMSE 및 FE를 불러서 메모리에 저장 + RMSE_hyper_original = df_multi_step_sel['RMSE_hyper_original'].to_numpy() + RMSE_hyper_nonlinear = df_multi_step_sel['RMSE_hyper_nonlinear'].to_numpy() + RMSE_step = df_multi_step_sel['RMSE_step'].to_numpy() + FE_hyper_original = df_multi_step_sel['Final_error_hyper_original'].to_numpy() + FE_hyper_nonlinear = df_multi_step_sel['Final_error_hyper_nonlinear'].to_numpy() + 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)]) + + # 그래프 설정 (2 by 2) + fig, ((ax1, ax2, ax3), (ax4, ax5, ax6)) = plt.subplots(2, 3, figsize = (12, 8)) + + # 그래프 제목 설정 + fig.suptitle('Histograms: ' + str(data_usage) + + '% of Settlement Data Used in the Final Step') + + # 각 Subplot의 제목 설정 + ax1.set_xlabel('RMSE (Original Hyperbolic) (cm)') + ax2.set_xlabel('RMSE (Nonlinear Hyperbolic) (cm)') + ax3.set_xlabel('RMSE (Step) (cm)') + ax4.set_xlabel('FE (Original Hyperbolic) (cm)') + ax5.set_xlabel('FE (Nonliner Hyperbolic) (cm)') + ax6.set_xlabel('FE (Step) (cm)') + + # 각 subplot에 히스토그램 작성 + ax1.hist(RMSE_hyper_original, 5, density=True, facecolor='r', edgecolor='k', alpha=0.75) + ax2.hist(RMSE_hyper_nonlinear, 5, density=True, facecolor='b', edgecolor='k', alpha=0.75) + ax3.hist(RMSE_step, 5, density=True, facecolor='g', edgecolor='k', alpha=0.75) + ax4.hist(FE_hyper_original, 5, density=True, facecolor='r', edgecolor='k', alpha=0.75) + ax5.hist(FE_hyper_nonlinear, 5, density=True, facecolor='b', edgecolor='k', alpha=0.75) + ax6.hist(FE_step, 5, density=True, facecolor='g', edgecolor='k', alpha=0.75) + + # 각 subplot을 포함한 리스트 설정 + axes = [ax1, ax2, ax3, ax4, ax5, ax6] + + # 공통 사항 적용 + 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.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) + +fig, ((ax1, ax2), (ax3, ax4), (ax5, ax6)) = plt.subplots(3, 2, figsize = (8, 12)) + +fig.suptitle("Hyperbolic vs. Step loading") + +# mean 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.legend() + +# mean 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') + +# median 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') + +# median 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') + +# percentile rmse +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') + +# percentile fe +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') + +axes = [ax1, ax2, ax3, ax4, ax5, ax6] + +# 공통 사항 적용 +for ax in axes: + ax.set_xlabel("Data Usage (%)") + ax.grid(color="gray", alpha=.5, linestyle='--') + ax.tick_params(direction='in') + ax.set_xlim(0, 100) + ax.set_ylim(0, 50) + +# 그래프 저장 (SVG 및 PNG) +plt.savefig('error_analysis/error_step.png', bbox_inches='tight') \ No newline at end of file diff --git a/batch_process.py b/batch_process.py index 8bb5ede..8a92e61 100644 --- a/batch_process.py +++ b/batch_process.py @@ -2,11 +2,17 @@ import settle_prediction_steps_main import pandas as pd import os -input_dir = 'data' -output_dir = 'output' +input_dir = 'data_1' +output_dir = 'output_1' input_files = [] -df = pd.DataFrame(columns=['File', 'Data_usage', +df_overall = pd.DataFrame(columns=['File', 'Data_usage', + 'RMSE_hyper_original', + 'RMSE_hyper_nonlinear', + 'Final_error_hyper_original', + 'Final_error_hyper_nonlinear']) + +df_multi_step = pd.DataFrame(columns=['File', 'Data_usage', 'RMSE_hyper_original', 'RMSE_hyper_nonlinear', 'RMSE_step', @@ -14,16 +20,33 @@ df = pd.DataFrame(columns=['File', 'Data_usage', 'Final_error_hyper_nonlinear', 'Final_error_step']) + for (root, directories, files) in os.walk(input_dir): for file in files: file_path = os.path.join(root, file) input_files.append(file_path) for input_file in input_files: - for i in range(20, 100, 20): - ERROR = settle_prediction_steps_main.run_settle_prediction(input_file, - output_dir, i, 100, False, False) - df.loc[len(df.index)] = [input_file, i, ERROR[0], ERROR[1], ERROR[2], - ERROR[3], ERROR[4], ERROR[5]] + for i in range(20, 100, 10): -df.to_csv('Error.csv') \ No newline at end of file + RETURN_VALUES = settle_prediction_steps_main.\ + run_settle_prediction(input_file, output_dir, i, 100, False, False) + + df_overall.loc[len(df_overall.index)] = [input_file, i, + RETURN_VALUES[0], + RETURN_VALUES[1], + RETURN_VALUES[3], + RETURN_VALUES[4]] + + if RETURN_VALUES[6]: + df_multi_step.loc[len(df_overall.index)] = [input_file, i, + RETURN_VALUES[0], + RETURN_VALUES[1], + RETURN_VALUES[2], + RETURN_VALUES[3], + RETURN_VALUES[4], + RETURN_VALUES[5]] + +# 에러 파일 출력 +df_overall.to_csv('Error_overall.csv') +df_multi_step.to_csv('Error_multi_step.csv') diff --git a/data/1_S-12.csv b/data/1_S-12.csv deleted file mode 100644 index 6f61dd4..0000000 --- a/data/1_S-12.csv +++ /dev/null @@ -1,144 +0,0 @@ -Time,Settle,Surcharge -0,0,3.52 -2,1.2,3.52 -5,3.1,3.52 -8,5.4,3.52 -15,9.6,3.52 -21,21.5,4.835 -26,28.7,4.835 -28,31.4,4.835 -34,38.3,4.835 -37,41.7,4.835 -40,44.6,4.835 -43,47.3,4.835 -47,51.2,4.835 -50,54.1,4.835 -54,57.3,4.835 -57,59.7,4.835 -61,63,4.835 -64,64.7,4.835 -68,66.9,4.835 -70,68.2,4.835 -72,69.6,4.835 -75,71.5,4.835 -76,72.2,4.835 -77,72.9,4.835 -78,73.5,4.835 -79,74.1,4.835 -82,75.3,4.835 -83,75.7,4.835 -84,76.1,4.835 -85,76.5,4.835 -89,78.4,4.835 -90,78.9,4.835 -92,79.9,4.835 -96,81.8,4.835 -98,82.8,4.835 -99,83.2,4.835 -105,85.8,4.835 -106,86.2,4.835 -107,86.6,4.835 -110,87.8,4.835 -112,88.6,4.835 -114,89.4,4.835 -117,90.6,4.835 -119,91.4,4.835 -121,92.2,4.835 -128,95.2,4.835 -131,96.4,4.835 -134,97.6,4.835 -138,99,4.835 -140,99.6,4.835 -147,101.4,4.835 -149,102,4.835 -153,103.2,4.835 -155,103.8,4.835 -159,105.1,4.835 -162,106,4.835 -166,110.4,6.05 -167,111.3,6.05 -168,112.2,6.05 -169,113.1,6.05 -170,114,6.05 -173,116.7,6.05 -174,117.5,6.05 -177,119.9,6.05 -181,123.1,6.05 -182,123.9,6.05 -183,124.7,6.05 -184,125.4,6.05 -187,127.5,6.05 -188,128.1,6.05 -189,128.7,6.05 -190,129.2,6.05 -191,129.7,6.05 -194,131.2,6.05 -195,131.7,6.05 -196,132.2,6.05 -197,132.7,6.05 -198,133.1,6.05 -201,134.3,6.05 -202,134.7,6.05 -203,135.1,6.05 -204,135.5,6.05 -205,135.9,6.05 -208,137.1,6.05 -211,138.3,6.05 -215,139.5,6.05 -217,140.1,6.05 -219,140.7,6.05 -222,141.6,6.05 -225,142.5,6.05 -229,143.7,6.05 -233,144.9,6.05 -237,146.1,6.05 -239,146.7,6.05 -243,147.9,6.05 -246,148.8,6.05 -250,150,6.05 -253,150.9,6.05 -257,152.1,6.05 -261,153.3,6.05 -264,154.2,6.05 -267,155.1,6.05 -271,155.9,6.05 -275,156.7,6.05 -278,157.3,6.05 -281,157.9,6.05 -285,158.7,6.05 -292,160.1,6.05 -295,160.7,6.05 -299,161.5,6.05 -302,162.1,6.05 -306,162.9,6.05 -309,163.5,6.05 -313,164.3,6.05 -316,164.9,6.05 -320,165.7,6.05 -324,166.1,6.05 -327,166.4,6.05 -329,166.6,6.05 -334,167.1,6.05 -337,167.4,6.05 -341,167.8,6.05 -344,168.1,6.05 -348,168.5,6.05 -351,168.8,6.05 -355,169.2,6.05 -358,169.5,6.05 -362,169.9,6.05 -369,170.6,6.05 -372,170.9,6.05 -376,171.3,6.05 -380,171.7,6.05 -383,172,6.05 -386,172.3,6.05 -390,172.7,6.05 -393,173,6.05 -397,173.4,6.05 -400,173.7,6.05 -404,174,6.05 -407,174.2,6.05 -411,174.5,6.05 -414,174.7,6.05 -422,175.2,6.05 diff --git a/data/1_SP-11.csv b/data/1_SP-11.csv deleted file mode 100644 index f333aa6..0000000 --- a/data/1_SP-11.csv +++ /dev/null @@ -1,125 +0,0 @@ -Time,Settle,Surcharge -0,0,1.5 -5,17.4,1.5 -7,23.9,1.5 -11,32.2,1.5 -14,41.7,1.5 -21,64.1,1.5 -28,72.5,1.5 -35,78.8,1.5 -42,93.3,1.5 -48,102.5,1.5 -53,108,3.002 -54,109.2,3.002 -55,110.4,3.002 -56,111.6,3.002 -59,117.3,3.002 -60,119.2,3.002 -61,121.1,3.002 -62,122.7,3.002 -67,130.2,3.002 -68,131.9,3.002 -69,133.6,3.002 -70,135.4,3.002 -74,141.4,3.002 -75,142.9,3.002 -76,144.4,3.002 -77,146.2,3.002 -80,149.2,3.002 -81,150.2,3.002 -82,151.2,3.002 -83,152.2,3.002 -91,162.8,3.002 -98,170,3.002 -105,177,3.002 -112,182.4,3.002 -115,185,3.002 -117,186.5,3.002 -118,187.3,3.002 -122,202.9,4.095 -124,210.5,4.095 -125,214.5,4.095 -126,218.6,4.095 -129,222.4,4.095 -130,223.7,4.095 -131,225,4.095 -132,226.3,4.095 -133,227.5,4.095 -136,231.7,4.095 -137,233.1,4.095 -138,234.5,4.095 -139,235.9,4.095 -140,237.3,4.095 -143,240.7,4.095 -147,245.5,4.095 -151,249.7,4.095 -154,252.8,4.095 -158,257.8,4.095 -161,261.1,4.095 -164,264.1,4.095 -168,268,4.095 -172,272.2,4.095 -175,275.5,4.095 -181,283.5,4.095 -192,293.5,4.095 -195,296.2,4.095 -199,301.3,4.095 -202,304.6,4.095 -209,311.1,4.095 -216,316,4.095 -223,322.3,4.095 -230,326.5,4.095 -237,331.6,4.095 -244,336.5,4.095 -251,341.2,4.095 -258,346.1,4.095 -266,350.9,4.095 -273,354,4.095 -280,356,4.095 -286,358,4.095 -294,360.9,4.095 -300,363,5.256 -301,363.4,5.256 -304,365.8,5.256 -305,366.5,5.256 -306,367.2,5.256 -307,367.9,5.256 -308,368.5,5.256 -311,369.5,5.256 -312,369.8,5.256 -313,370.1,5.256 -314,370.4,5.256 -327,377.4,5.256 -329,378.5,5.256 -336,381.8,5.256 -343,385.5,5.256 -350,388.4,5.256 -357,391.1,5.256 -364,394.1,5.256 -371,397.1,5.256 -377,399.5,5.256 -385,401.4,5.256 -388,402.3,5.256 -389,402.6,5.256 -390,402.9,5.256 -391,403.2,5.256 -392,403.5,5.256 -395,404.4,5.256 -397,405,5.256 -398,405.3,5.256 -402,406.5,5.256 -404,407.1,5.256 -405,407.4,5.256 -406,407.6,5.256 -409,408.2,5.256 -411,408.6,5.256 -419,410.2,5.256 -420,410.5,5.256 -425,411.5,5.256 -426,411.7,5.256 -434,413.3,5.256 -440,414.5,5.256 -447,415.9,5.256 -455,417.5,5.256 -461,418.7,5.256 -468,420,5.256 diff --git a/data/1_SP-23.csv b/data/1_SP-23.csv deleted file mode 100644 index 7ef06f8..0000000 --- a/data/1_SP-23.csv +++ /dev/null @@ -1,125 +0,0 @@ -Time,Settle,Surcharge -0,0,1.5 -5,6.7,1.5 -8,10.2,1.5 -14,20.5,1.5 -22,28.2,1.5 -29,43.2,1.5 -35,47.4,1.5 -43,57.1,1.5 -50,63.5,1.5 -57,70.5,1.5 -64,77.7,1.5 -70,83.5,1.5 -78,92.4,1.5 -85,97.6,1.5 -92,103.5,1.5 -99,108.4,1.5 -106,113.49,1.5 -113,118.4,1.5 -116,118.4,2.871 -120,122.8,2.871 -124,123,2.871 -125,125.2,2.871 -126,127.4,2.871 -127,129.6,2.871 -130,132.9,2.871 -131,134,2.871 -132,135.1,2.871 -133,136.2,2.871 -144,145.6,2.871 -145,146.5,2.871 -146,147.4,2.871 -147,148.3,2.871 -154,153.4,2.871 -161,159.2,2.871 -168,163.9,2.871 -175,169.8,2.871 -182,174.9,2.871 -189,180.7,2.871 -196,185.4,2.871 -203,191.2,2.871 -210,196.1,3.606 -218,201.7,3.606 -225,205.9,3.606 -232,210.1,3.606 -238,213.7,3.606 -246,217.9,3.606 -253,221.2,3.606 -260,225.2,3.606 -266,228.4,3.606 -281,239.2,3.606 -288,243.1,3.606 -295,246.6,3.606 -302,250.4,3.606 -309,254,3.606 -316,257.3,3.606 -323,260.5,3.606 -329,263.3,3.606 -337,266.4,3.606 -344,269,3.606 -350,271.2,3.606 -358,274,3.606 -361,275.2,3.606 -363,276,3.606 -371,279.2,3.606 -372,279.6,3.606 -377,281.1,3.606 -378,281.4,3.606 -383,282.9,3.606 -384,283.2,3.606 -385,283.5,3.606 -386,283.8,3.606 -389,284.7,3.606 -390,285,3.606 -391,285.4,3.606 -392,285.8,3.606 -397,287.4,3.606 -398,287.7,3.606 -399,288,3.606 -403,289.2,3.606 -404,289.5,3.606 -405,289.8,3.606 -406,290.1,3.606 -407,290.4,3.606 -410,291,3.606 -411,291.2,3.606 -413,291.6,3.606 -420,293.1,3.606 -421,293.4,3.606 -424,294.3,3.606 -431,296.4,3.606 -435,298.4,4.896 -438,302,4.896 -441,305.1,4.896 -445,309.4,4.896 -448,313.7,4.896 -455,320.1,4.896 -462,325.4,4.896 -469,330.9,4.896 -473,334.3,4.896 -475,335.8,4.896 -476,336.5,4.896 -477,337.2,4.896 -480,338.8,4.896 -481,339.3,4.896 -483,340.3,4.896 -488,343.6,4.896 -497,348.6,4.896 -502,351.6,4.896 -504,352.3,4.896 -509,354.8,4.896 -512,356.1,4.896 -516,358.7,4.896 -518,359,4.896 -525,362.6,4.896 -530,364.6,4.896 -532,365.7,4.896 -540,368.4,4.896 -544,369.4,4.896 -547,370.2,4.896 -550,371,4.896 -553,372.4,4.896 -560,374.1,4.896 -565,375.2,4.896 -568,375.5,4.896 diff --git a/data/3_SP3-65.csv b/data/3_SP3-65.csv deleted file mode 100644 index e93e993..0000000 --- a/data/3_SP3-65.csv +++ /dev/null @@ -1,183 +0,0 @@ -Time,Settle,Surcharge -0,0,1.33 -4,7.7,1.33 -8,10.7,1.33 -11,20.4,1.33 -15,29.5,1.33 -17,36.5,1.33 -22,42.9,1.33 -24,48,1.33 -29,53.4,1.33 -31,58.6,1.33 -36,66,1.33 -38,69.5,1.33 -42,70.9,1.33 -45,77.7,1.33 -50,83.7,1.33 -53,89.2,1.33 -56,92.5,1.33 -59,95.4,1.33 -63,96.6,1.33 -66,97.4,1.33 -70,98.7,1.33 -73,100.6,1.33 -77,109.0583333,1.33 -80,115.825,1.33 -84,120.9,1.33 -87,122.6,1.33 -90,125.7,1.33 -94,129.7,1.33 -97,132.5,1.33 -100,135,1.33 -104,138,1.33 -107,141.5,1.33 -120,154.4,1.33 -122,156.2,1.33 -125,159.3,1.33 -128,162.2,1.33 -132,164.4,1.33 -135,167.3,1.33 -139,170.6,1.33 -142,173.3090909,1.33 -147,175.5,1.33 -150,177.6,1.33 -154,181.4,1.33 -156,183.8,1.33 -160,185.6,1.33 -163,188,1.33 -167,190.7,1.33 -170,192.6,1.33 -175,193.7,1.33 -178,195.2,1.33 -181,199.9,1.33 -184,201.9,1.33 -188,204,1.33 -191,205.9,1.33 -195,208.3,1.33 -198,210.3,1.33 -203,212.6,1.33 -207,214.3,1.33 -213,216.7,1.33 -216,218.5,1.33 -221,220.6,1.33 -224,222.3,1.33 -227,224.6,1.33 -230,226.4,1.33 -234,228.1,1.33 -238,230.4,1.33 -241,232.3,1.33 -245,233.9,1.33 -248,235,1.33 -252,236.9,1.33 -255,237.7,1.33 -258,239.2,1.33 -261,240.5,1.33 -265,242.2,1.33 -268,243.2,1.33 -272,244.4,1.33 -275,245.6,1.33 -279,247.1,1.33 -282,248,1.33 -286,249.3,1.33 -289,250.3,1.33 -293,252.1,1.33 -296,253.5,1.33 -300,255.4,1.33 -303,256.9,1.33 -308,259.2,1.33 -311,262.9,1.33 -315,268.3,1.33 -318,272.9,1.33 -322,279.5,1.33 -325,284.6,1.33 -328,288.7,1.33 -331,290.7,1.33 -338,292.9,1.33 -342,294.6,2.287 -345,295.9,2.287 -349,297.7,2.287 -352,299.2,2.287 -357,306.5,3.92 -361,311.9,3.92 -364,317,3.92 -367,321.9,3.92 -371,326.4,3.92 -374,329.9,3.92 -378,333.6,3.92 -381,336,3.92 -384,337.6,3.92 -387,338.9,3.92 -391,343.3,3.92 -394,346.1,3.92 -398,349.6,3.92 -401,352.7,3.92 -405,355.6,3.92 -408,357.5,3.92 -413,360.8,3.92 -415,362.1,3.92 -420,366.1,3.92 -423,368.3,3.92 -426,370.7,3.92 -429,372.7,3.92 -433,375.4,3.92 -436,377.4,3.92 -440,380,3.92 -444,382.3,3.92 -447,383.8,3.92 -450,385.5,3.92 -455,388.2,3.92 -457,389.1,3.92 -461,391.5,3.92 -464,393.2,3.92 -471,397.3,3.92 -475,399.8,3.92 -479,402.1,3.92 -483,404.2,3.92 -486,405.6,3.92 -489,407.3,3.92 -492,408.3,5.2 -496,412.3,5.2 -499,415.7,5.2 -504,418.7,5.2 -507,421,5.2 -511,423.7,5.2 -514,426,5.2 -517,428.6,5.2 -520,430.8,5.2 -525,433.7,5.2 -528,436.1,5.2 -532,437,5.2 -534,438.3,5.2 -538,440.8,5.2 -541,442,5.2 -545,444.1,5.2 -548,445.6,5.2 -552,448.1,5.2 -555,449.7,5.2 -559,451.9,5.2 -562,454.7,5.2 -566,456.5,5.2 -569,458.4,5.2 -573,460.2,5.2 -576,461.5,5.2 -580,463.2,5.2 -583,464.3,5.2 -588,468.2,5.2 -590,470.3,5.2 -595,470.7,5.2 -598,470.9,5.2 -602,471.9,5.2 -605,472.6,5.2 -609,473.8,5.2 -612,474.6,5.2 -615,475.2,5.2 -618,475.8,5.2 -623,476.8,5.2 -626,477.6,5.2 -629,478.3,5.2 -632,479.2,5.2 -636,480.6,5.2 -639,480.6,5.2 -643,480.7,5.2 -646,480.7,5.2 -650,480.7,5.2 diff --git a/data/3_SP3-68.csv b/data/3_SP3-68.csv deleted file mode 100644 index e9dbb1e..0000000 --- a/data/3_SP3-68.csv +++ /dev/null @@ -1,128 +0,0 @@ -Time,Settle,Surcharge -0,0,1.887 -3,41,1.887 -6,61.5,1.887 -10,73.1,1.887 -13,81.6,1.887 -17,86.9,1.887 -20,91.9,1.887 -23,96.7,1.887 -26,101.6,1.887 -30,107.7,2.94 -33,113,2.94 -37,119.4,2.94 -40,122.8,2.94 -44,128.4,2.94 -47,131.9,2.94 -52,139.5,2.94 -54,140.5,2.94 -59,148,2.94 -62,151,2.94 -65,153.8,2.94 -68,156.6,2.94 -72,160,2.94 -75,162.5,2.94 -79,166,2.94 -83,169.1,2.94 -86,172,2.94 -89,174.7,2.94 -94,180.3,2.94 -96,182.1,2.94 -100,185.5,2.94 -103,188.4,2.94 -110,195.8,2.94 -114,198.7,2.94 -118,201.1,2.94 -122,205,2.94 -125,206.9,2.94 -128,209.3,2.94 -131,211.8,2.94 -135,214.2,2.94 -138,216.2,2.94 -143,217.4,2.94 -146,218.3,2.94 -150,219.1,2.94 -153,219.9,2.94 -156,220.9,2.94 -159,222,2.94 -164,227.7,2.94 -167,230.7,2.94 -171,234.8,3.48 -173,236.5,3.48 -177,239.7,3.48 -180,241.8,3.48 -184,243.9,3.48 -187,246.3,3.48 -191,249.6,3.48 -194,252.1,3.48 -198,255.5,3.48 -201,258.9,3.48 -205,261.2,3.48 -208,263.4,3.48 -212,265.8,3.48 -215,267.1,3.48 -219,268.9,3.48 -222,270.2,3.48 -227,273.4,3.48 -229,275,3.48 -234,277.3,3.48 -237,278.1,3.48 -241,280,3.48 -244,281.2,3.48 -248,283.2,3.48 -251,284.6,3.48 -254,286.1,3.48 -257,287.5,3.48 -262,289.5,3.48 -265,290.7,3.48 -268,292,3.48 -271,293.2,3.48 -275,294.7,3.48 -278,295.3,3.48 -282,296.3,3.48 -285,296.7,3.48 -289,297.6,3.48 -292,298.5,3.48 -296,299.8,3.48 -299,300.6,3.48 -303,302.2,3.48 -306,303.5,3.48 -310,312.8,5.608 -313,318.1,5.608 -317,322.8,6.794 -320,328.9,6.794 -324,335.3,6.794 -328,340.5,6.794 -331,342.9,6.794 -334,345.5,6.794 -339,348,6.794 -342,350.6,6.794 -345,353.1,6.794 -348,355.6,6.794 -352,358.9,6.794 -355,361,6.794 -362,365.6,6.794 -367,369,6.794 -370,370.5,6.794 -373,372.2,6.794 -376,373.8,6.794 -381,376.4,6.794 -384,378.5,6.794 -387,380.4,6.794 -390,382.4,6.794 -394,385.8,6.794 -397,388,6.794 -402,389.9,6.794 -405,390.9,6.794 -409,392.6,6.794 -412,394,6.794 -415,396.7,6.794 -418,397.5,6.794 -422,398.7,6.794 -425,399.1,6.794 -429,399.8,6.794 -432,400.9,6.794 -436,403.6,6.794 -439,405.6,6.794 -443,408.2,6.794 -446,409.4,6.794 diff --git a/data/4_S-11.csv b/data/4_S-11.csv deleted file mode 100644 index 7d8184e..0000000 --- a/data/4_S-11.csv +++ /dev/null @@ -1,158 +0,0 @@ -Time,Settle,Surcharge -0,0,3 -9,14.4,3 -14,31.4,3 -24,33.3,3 -27,34.1,3 -28,34.5,3 -29,34.7,3 -31,34.9,3 -34,35.3,3 -36,35.7,3 -38,36,3.5 -41,36.3,3.5 -43,45.8,3.5 -45,50.6,3.5 -48,55.3,3.5 -50,79.1,3.5 -52,91,3.5 -55,96.9,3.5 -57,99.9,3.5 -59,102.9,3.5 -66,134,3.5 -72,142,3.5 -78,150.7,3.5 -83,154.2,3.5 -84,155.9,3.5 -86,157.7,3.5 -90,160,3.5 -92,161.1,3.5 -94,162.3,3.5 -97,160.3,3.5 -98,159.3,3.5 -99,158.8,3.5 -101,158.3,3.5 -104,158.6,3.5 -106,158.6,3.5 -108,158.6,3.5 -111,158.7,3.5 -113,158.9,3.5 -115,160.2,3.5 -118,160.8,3.5 -120,161.5,3.5 -121,162.8,3.5 -122,164.2,3.5 -123,165.5,3.5 -125,166.9,3.5 -127,169.7,3.5 -127,176.6,4 -128,180.1,4 -129,181.9,4 -132,182.7,4 -134,183.6,4 -135,199.5,5.11 -136,207.5,5.11 -136,211.5,5.11 -139,213.5,5.11 -142,215.5,5.11 -143,219.8,5.11 -146,221.9,5.11 -148,224,5.11 -150,226.9,5.11 -153,228.4,5.11 -155,229.8,5.11 -157,236.7,5.11 -160,243.1,5.11 -161,249.1,5.11 -162,257.3,5.11 -163,261.6,5.11 -164,263.7,5.11 -167,264.7,5.11 -169,265.8,5.11 -171,272.2,5.11 -174,275.4,5.11 -176,278.6,5.11 -177,281.8,5.11 -178,283.4,5.11 -181,284.2,5.11 -182,285,5.11 -183,288.3,5.11 -184,289.9,5.11 -185,290.7,5.11 -188,291.1,5.11 -190,291.3,5.11 -192,291.5,5.11 -195,294.7,5.11 -197,297.9,5.11 -202,304.3,5.11 -210,309.3,5.11 -217,314.4,5.11 -224,321,5.11 -231,327.8,5.11 -246,336.9,5.11 -253,341.1,5.11 -259,344.7,5.11 -267,350.4,5.11 -273,354.5,5.11 -280,359,5.11 -287,363.3,5.11 -293,366.9,5.11 -301,371.1,5.11 -308,374.7,5.11 -318,379.7,5.11 -325,382.3,5.11 -332,384.8,5.11 -339,387.3,5.11 -346,389.8,5.11 -352,392.1,5.11 -356,395.3,5.11 -364,401.5,5.11 -373,408.3,5.11 -380,410.8,5.11 -386,413.5,5.11 -392,416.1,5.11 -399,419,5.11 -407,420.3,5.11 -412,421,5.11 -420,422,5.11 -428,423,5.11 -435,428.8,5.11 -440,431.4,5.11 -442,432.2,5.11 -444,433.7,5.61 -447,435,5.61 -448,435.3,5.61 -457,437.8,5.61 -464,439.6,5.61 -470,440.8,5.61 -476,441.8,5.61 -484,443.2,5.61 -491,444.3,5.61 -498,448.8,5.61 -505,453.3,5.61 -513,457.3,5.61 -520,459.5,5.61 -524,460.6,5.61 -531,461.9,5.61 -538,463.1,5.61 -546,464.4,5.61 -552,465.4,5.61 -560,466.7,5.61 -569,468,5.61 -576,469.1,5.61 -581,469.8,5.61 -591,471.3,5.61 -598,472.4,5.61 -605,473.5,5.61 -612,474.5,5.61 -619,475.3,5.61 -625,476.1,5.61 -631,476.9,5.61 -640,478,5.61 -644,478.4,5.61 -651,479,5.61 -658,479.6,5.61 -664,480.1,5.61 -672,480.7,5.61 -680,481.2,5.61 -689,481.7,5.61 diff --git a/settle_prediction_steps_main.py b/settle_prediction_steps_main.py index 2581068..5e8b730 100644 --- a/settle_prediction_steps_main.py +++ b/settle_prediction_steps_main.py @@ -10,8 +10,6 @@ The methodologies used are 1) superposition of time-settlement curves and 2) nonlinear regression for hyperbolic curves. """ - - # ================= # Import 섹션 # ================= @@ -23,7 +21,6 @@ import matplotlib.pyplot as plt from scipy.optimize import least_squares - # ================= # Function 섹션 # ================= @@ -32,14 +29,17 @@ from scipy.optimize import least_squares def generate_data_hyper(px, pt): return pt / (px[0] * pt + px[1]) + # 회귀식과 측정치와의 잔차 반환 (비선형 쌍곡선) def fun_hyper_nonlinear(px, pt, py): return pt / (px[0] * pt + px[1]) - py + # 회귀식과 측정치와의 잔차 반환 (기존 쌍곡선) def fun_hyper_original(px, pt, py): return px[0] * pt + px[1] - pt / py + # RMSE 산정 def fun_rmse(py1, py2): mse = np.square(np.subtract(py1, py2)).mean() @@ -48,8 +48,11 @@ def fun_rmse(py1, py2): def run_settle_prediction(input_file, output_dir, final_step_predict_percent, additional_predict_percent, - plot_show, print_values): - + plot_show, + print_values, + run_original_hyperbolic='True', + run_nonlinear_hyperbolic='True', + run_step_prediction='True'): # ==================== # 파일 읽기, 데이터 설정 # ==================== @@ -58,7 +61,7 @@ def run_settle_prediction(input_file, output_dir, print("Working on " + input_file) # CSV 파일 읽기 - data = pd.read_csv(input_file, encoding='euc-kr') + data = pd.read_csv(input_file, encoding='euc-kr') # 시간, 침하량, 성토고 배열 생성 time = data['Time'].to_numpy() @@ -67,12 +70,9 @@ def run_settle_prediction(input_file, output_dir, # 데이터 닫기 - # 마지막 계측 데이터 index + 1 파악 final_index = time.size - - # ================= # 성토 단계 구분 # ================= @@ -94,28 +94,23 @@ def run_settle_prediction(input_file, output_dir, # 만일 성토고의 변화가 있을 경우, if surcharge[index] != current_surcharge: - step_end_index.append(index) step_start_index.append(index) current_surcharge = surcharge[index] - # 마지막 성토 단계 끝 index 추가 step_end_index.append(len(surcharge) - 1) - - # ================= # 성토 단계 조정 # ================= - # 다음 경우를 제외하고 해석을 수행할 필요가 있음 - # 성토고 유지 기간이 매우 짧을 경우 - # 성토고 유지 기간 중 계측 데이터 수가 작을 경우 + # 성토고 유지 기간이 매우 짧을 경우, 해석 단계에서 제외 - # + # 조정 성토 시작 및 끝 인덱스 리스트 초기화 step_start_index_adjust = [] step_end_index_adjust = [] + # 각 성토 단계 별로 분석 for i in range(0, len(step_start_index)): # 현 단계 성토 시작일 / 끝일 파악 @@ -126,20 +121,22 @@ def run_settle_prediction(input_file, output_dir, step_span = step_end_date - step_start_date step_data_num = step_end_index[i] - step_start_index[i] + 1 - if (step_span > 50 and step_data_num > 15): + # 성토고 유지일 및 데이터 개수 기준 적용 + if step_span > 30 and step_data_num > 5: step_start_index_adjust.append((step_start_index[i])) step_end_index_adjust.append((step_end_index[i])) + # 성토 시작 및 끝 인덱스 리스트 업데이트 step_start_index = step_start_index_adjust step_end_index = step_end_index_adjust + # 침하 예측을 수행할 단계 설정 (현재 끝에서 2단계 이용) + step_start_index = step_start_index[-2:] + step_end_index = step_end_index[-2:] # 성토 단계 횟수 파악 및 저장 num_steps = len(step_start_index) - - - # =========================== # 최종 단계 데이터 사용 범위 조정 # =========================== @@ -165,8 +162,6 @@ def run_settle_prediction(input_file, output_dir, final_step_monitor_end_index = step_end_index[num_steps - 1] step_end_index[num_steps - 1] = final_step_predict_end_index - - # ================= # 추가 예측 구간 반영 # ================= @@ -189,8 +184,6 @@ def run_settle_prediction(input_file, output_dir, # 마지막 인덱스값 재조정 final_index = time.size - - # ============================= # Settlement Prediction (Step) # ============================= @@ -234,7 +227,6 @@ def run_settle_prediction(input_file, output_dir, # 회귀분석 시행 res_lsq_hyper_nonlinear \ = least_squares(fun_hyper_nonlinear, x0, - bounds=((0, 0),(np.inf, np.inf)), args=(tm_this_step, sm_this_step)) # 쌍곡선 계수 저장 및 출력 @@ -249,18 +241,16 @@ def run_settle_prediction(input_file, output_dir, sp_step[step_start_index[i]:final_index] = \ sp_step[step_start_index[i]:final_index] + sp_to_end_update + s0_this_step - - # ========================================================= # Settlement prediction (nonliner and original hyperbolic) # ========================================================= # 성토 마지막 데이터 추출 - tm_hyper = time[step_start_index[num_steps-1]:step_end_index[num_steps-1]] - sm_hyper = settle[step_start_index[num_steps-1]:step_end_index[num_steps-1]] + tm_hyper = time[step_start_index[num_steps - 1]:step_end_index[num_steps - 1]] + sm_hyper = settle[step_start_index[num_steps - 1]:step_end_index[num_steps - 1]] # 현재 단계 시작 부터 끝까지 시간 데이터 추출 - time_hyper = time[step_start_index[num_steps-1]:final_index] + time_hyper = time[step_start_index[num_steps - 1]:final_index] # 초기 시점 및 침하량 산정 t0_hyper = tm_hyper[0] @@ -300,8 +290,6 @@ def run_settle_prediction(input_file, output_dir, sp_hyper_original = sp_hyper_original + s0_hyper time_hyper = time_hyper + t0_hyper - - # ========== # 에러 산정 # ========== @@ -327,23 +315,20 @@ def run_settle_prediction(input_file, output_dir, # RMSE 출력 (단계, 비선형 쌍곡선, 기존 쌍곡선) if print_values: - print("RMSE (Nonlinear Hyper + Step): %0.3f" %RMSE_step) - print("RMSE (Nonlinear Hyperbolic): %0.3f" %RMSE_hyper_nonlinear) - print("RMSE (Original Hyperbolic): %0.3f" %RMSE_hyper_original) + print("RMSE (Nonlinear Hyper + Step): %0.3f" % RMSE_step) + print("RMSE (Nonlinear Hyperbolic): %0.3f" % RMSE_hyper_nonlinear) + print("RMSE (Original Hyperbolic): %0.3f" % RMSE_hyper_original) # (최종 계측 침하량 - 예측 침하량) 계산 - - final_error_step = settle[-1] - sp_step_rmse[-1] - final_error_hyper_nonlinear = settle[-1] - sp_hyper_nonlinear_rmse[-1] - final_error_hyper_original = settle[-1] - sp_hyper_original_rmse[-1] + final_error_step = np.abs(settle[-1] - sp_step_rmse[-1]) + final_error_hyper_nonlinear = np.abs(settle[-1] - sp_hyper_nonlinear_rmse[-1]) + final_error_hyper_original = np.abs(settle[-1] - sp_hyper_original_rmse[-1]) # (최종 계측 침하량 - 예측 침하량) 출력 (단계, 비선형 쌍곡선, 기존 쌍곡선) if print_values: - print("Error in Final Settlement (Nonlinear Hyper + Step): %0.3f" %final_error_step) - print("Error in Final Settlement (Nonlinear Hyperbolic): %0.3f" %final_error_hyper_nonlinear) - print("Error in Final Settlement (Original Hyperbolic): %0.3f" %final_error_hyper_original) - - + print("Error in Final Settlement (Nonlinear Hyper + Step): %0.3f" % final_error_step) + print("Error in Final Settlement (Nonlinear Hyperbolic): %0.3f" % final_error_hyper_nonlinear) + print("Error in Final Settlement (Original Hyperbolic): %0.3f" % final_error_hyper_original) # ===================== # Post-Processing @@ -351,7 +336,7 @@ def run_settle_prediction(input_file, output_dir, # 그래프 크기, 서브 그래프 개수 및 비율 설정 fig, axes = plt.subplots(2, 1, figsize=(12, 9), - gridspec_kw={'height_ratios':[1,3]}) + gridspec_kw={'height_ratios': [1, 3]}) # 성토고 그래프 표시 axes[0].plot(time, surcharge, color='black', label='surcharge height') @@ -364,7 +349,8 @@ def run_settle_prediction(input_file, output_dir, # 계측 및 예측 침하량 표시 axes[1].scatter(time[0:settle.size], -settle, s=50, facecolors='white', edgecolors='black', label='measured data') - axes[1].plot(time[step_start_index[0]:], -sp_step[step_start_index[0]:], linestyle='-', color='blue', label='Nonlinear + Step Loading') + axes[1].plot(time[step_start_index[0]:], -sp_step[step_start_index[0]:], linestyle='-', color='blue', + label='Nonlinear + Step Loading') axes[1].plot(time_hyper, -sp_hyper_nonlinear, linestyle='--', color='green', label='Nonlinear Hyperbolic') axes[1].plot(time_hyper, -sp_hyper_original, @@ -478,8 +464,8 @@ def run_settle_prediction(input_file, output_dir, plt.title(filename + ": up to %i%% data used in the final step" % final_step_predict_percent) # 그래프 저장 (SVG 및 PNG) - #plt.savefig(output_dir + '/' + filename +' %i percent (SVG).svg' %final_step_predict_percent, bbox_inches='tight') - plt.savefig(output_dir + '/' + filename +' %i percent (PNG).png' %final_step_predict_percent, bbox_inches='tight') + # plt.savefig(output_dir + '/' + filename +' %i percent (SVG).svg' %final_step_predict_percent, bbox_inches='tight') + plt.savefig(output_dir + '/' + filename + ' %i percent (PNG).png' % final_step_predict_percent, bbox_inches='tight') # 그래프 출력 if plot_show: @@ -492,9 +478,16 @@ def run_settle_prediction(input_file, output_dir, print("Settlement prediction is done for " + filename + " with " + str(final_step_predict_percent) + "% data usage") - # 산정 에러값 반환 + # 단계 성토 고려 여부 표시 + is_multi_step = True + if len(step_start_index) == 1: + is_multi_step = False + + # 반환 return [RMSE_hyper_original, RMSE_hyper_nonlinear, RMSE_step, final_error_hyper_original, final_error_hyper_nonlinear, - final_error_step] + final_error_step, is_multi_step] -run_settle_prediction('data/1_S-8.csv', 'output', 80, 100, False, False) \ No newline at end of file + +#run_settle_prediction('data_1/1_SP-16.csv', 'output', +# 80, 100, True, True)