졸업작품을 진행하며 남긴 기록들을 블로그로 옮긴 글입니다. 따라서 블로그에는 졸업작품을 완성하기 위해 적용한 글들만 옮기려고 합니다.
전체적인 내용을 확인하시려면 아래 링크로 이동해주세요 !
1. 개요
A. 전처리
- waveform이 안정적인 부분만 사용하자
전처리시 평균적인 범위를 벗어나는 waveform을 제거.
(All_Waveform_{avg} - Part_Waveform_{avg}) ≥ 일정범위
인 경우 제거.
1개의 waveform 중에 +1300, -1200을 포함하는 waveform은 제거.
f'(x)=f(x) - M_{avg}
f(x)
에서 전체 평균값을 빼서 전체 waveform의 평균값을 0으로 맞춰준다.
B. 정규화
- 정규화 방식의 변경
- 전체
f'(x)
값을 1024로 나눠서 정규화
- 정규화한 값이 1 이상으로 나올수도 있음
2. 전처리
A. 해야할 것 분류
- Waveform 평균 구하기
- 전체 Waveform의 평균 구하기
- 부분 Waveform의 평균 구하기
- 이상치 제거하기
- 전체 Waveform +-250 범위를 벗어나는 부분 Waveform을 학습 데이터 셋에서 제외하기
- 부분 Waveform의 값에 -1200, 1300이 하나라도 있으면 제외하기
- Waveform 값 수정
- 전체 Waveform의 평균을 0으로 가지는 Waveform을 만들기 위해 Wavefom 값에서 전체 평균값 빼기
B. 진행 과정
a. Waveform 평균 구하기
- 전체 Waveform의 평균
print("spo2_wave_all :", spo2_wave_all)
spo2_wave_all_avg = spo2_wave_all / len(choice_num_1_use.loc[:, 'SpO2 Wave'])
print("spo2_wave_all / len :", spo2_wave_all_avg)
spo2_wave_all_avg_list.append(spo2_wave_all_avg)
spo2_wave_all_avg_list :
[-4.570168404170008, 7.24468085106383, 16.752676425606293, 5.030131400090621,
11.40900900900901, 22.893231441048034, 3.2114035087719297, -9.150355871886122,
1.8936216688510266, 20.694971327745918, 20.229468599033815, 11.901439162668993,
-7.041894353369763, 4.54444201790784, 1.3987523992322457, 45.01651903279866,
-5.9517453798767965, 13.602459916538546, 2.3132803632236096, 12.722792607802875,
25.144794064978257, 0.7584922200306816, -3.7489567318251704, 26.03598858898398,
-1.3336248360297334]
- 부분 Waveform의 평균
select_wave_one_avg = select_wave_one_one / len(select_wave_one)
print("select_wave_one_avg :", select_wave_one_avg)
...
select_wave_one_avg_list.append(select_wave_one_avg)
...
select_wave_full_avg_list.append(select_wave_one_avg_list)
select_wave_full_avg_list :
[
[-2.8046875, -49.4375, -28.1953125, 102.7421875, 38.9296875, 5.078125, -486.875,
52.6875, 206.765625, 230.5625, 334.5, 156.6015625, -88.28125, 76.390625, -78.4609375,
-63.921875, 1.4140625, 198.9921875, -56.9375, -337.8671875, -17.71875, 331.3203125],
[48.1640625, -45.15625, 73.0078125, 91.1015625, 202.984375, 14.921875, -148.4609375,
121.3046875, 50.265625, 109.90625, -32.40625, -64.5703125, 57.0, 8.7890625, 34.28125,
12.9921875, 236.9765625, -35.015625, -74.08469951923075, 56.9140625, 173.4296875,
-73.4140625, -63.234375, -24.3125, 36.671875, 25.34375, 59.71875],
[125.0703125, 65.140625, -88.8203125, -632.0256315104167, 364.59375, 268.4765625,
-132.30986778846153, 154.4609375, -147.8984375, 300.6015625, 1.7421875, 154.0546875,
297.9921875, -80.7265625, -300.0, -86.78125, 141.3828125, 467.625, 95.1328125,
-245.0078125, -186.421875, 3.1171875, 373.1015625, 219.625, 55.96875, -324.59375,
61.7890625, 27.6875],
[157.609375, -501.296875, 236.59375, 42.61328725961539, 94.0703125, 176.8828125,
196.2421875, -15.527500000000003, -240.453125, -126.9453125, -184.703125, 125.3046875,
494.3828125, 151.56204927884616, -232.4921875, -420.875, -103.171875, 172.6796875,
479.71875, 111.2109375, -159.7578125, -19.34375, 176.1484375, -35.22145432692308,
-61.078125, -182.484375, -229.8984375, -45.5, 243.0390625, -81.77868990384616],
[155.1328125, -32.7734375, 203.1484375, -107.203125, -155.375, 14.71875, 198.328125,
129.58210336538463, -196.640625, -43.3515625, 26.6796875, 25.734375, 106.578125,
-85.03685697115384, -20.90625, 81.9921875, 195.1796875, 98.7890625, -175.703125,
56.1015625, 8.4375, -0.375, -45.6875, -54.2890625, 54.296875],
[-19.6484375, -77.9591466346154, -199.55162259615383, 57.49575120192307, 469.4921875,
105.20695312499998, -219.6953125, -127.796875, 232.6953125, -180.15625, 65.8984375,
16.734375, 141.0078125, 211.3671875, 248.6484375, 50.1484375, -27.65625, -341.40625,
170.8984375, 386.09375, 276.38798076923075, -162.375, -37.671875, 231.5625,
-140.1285877403846, -118.1953125, 70.390625],
...
[168.234375, -4.0, 3.7890625, 27.515625, -17.7890625, 21.1328125, -19.234375, -17.390625,
15.8828125, -31.2109375, 1.96875, -47.6484375, 33.3828125, -38.515625, -56.921875,
13.390625, -24.1484375, 43.4765625, 7.340108173076928, 1.8046875, -105.359375,
-36.21875, -17.3515625, 38.0, 43.46875, 45.296875, -40.8046875, -82.109375,
55.9921875, 69.1015625, 22.6953125, -45.09375],
[-49.703125, -66.015625, 88.0703125, 100.6484375, 101.0, -8.171875, -64.171875,
97.234375, 14.9296875, -10.7578125, 73.890625, -98.7734375, -156.0390625,
40.796875, 83.5078125, -68.9765625, 87.359375, -42.828125, 181.828125, 96.359375,
-37.09375, -10.234375, 232.6328125, -114.0078125, -154.2578125, -93.29419471153847,
118.78125, 181.5859375],
[160.140625, 236.5703125, 35.1171875, -35.4921875, 14.59375, 26.734375,
-78.83302884615384, -124.703125, -126.96875, -40.671875, 74.6640625, 60.125,
18.1015625, 37.3628485576923, 153.7578125, 138.21496995192308, -102.16114783653846,
-69.2578125, -39.5625, 43.1171875, 46.546875, -26.1875, -30.1328125, -396.625,
-29.3359375, 47.25, -39.685534855769234, -12.109375, 266.640625, 230.4140625],
[119.3984375, 2.578125, -48.5078125, -5.421875, -42.7890625, 3.6015625, 10.4140625,
13.515625, 42.7109375, -52.65272235576923, -65.6796875, 104.7265625, 45.8515625,
115.65625, 46.0859375, -122.921875, 93.234375, 260.6796875, -176.6171875, -150.890625,
-113.0625, 37.9765625, -55.4296875, 122.5234375, 278.1015625, 48.5078125, 91.546875,
1.421875, -166.7109375, -105.453125, -78.4296875]
]
b. 이상치 제거하기
"""
값중에 1300이나 -1200이 들어가면 continue
"""
print("unique :", select_wave_one.unique())
if 1300 in select_wave_one.unique():
continue
if -1200 in select_wave_one.unique():
continue
"""
부분 waveform 평균값이 전체 waveform 평균값 +- 250을 벗어난다면 continue
"""
if ((select_wave_one_avg - spo2_wave_all_avg) > 250) or ((select_wave_one_avg - spo2_wave_all_avg) < -250):
continue
- waveform이 안정적인 부분만 사용하자
전처리시 평균적인 범위를 벗어나는 waveform을 제거.
(All_Waveform_{avg} - Part_Waveform_{avg}) ≥ 일정범위
인 경우 제거.1개의 waveform 중에 +1300, -1200을 포함하는 waveform은 제거.
f'(x)=f(x) - M_{avg}
f(x)
에서 전체 평균값을 빼서 전체 waveform의 평균값을 0으로 맞춰준다.
B. 정규화
- 정규화 방식의 변경
- 전체
f'(x)
값을 1024로 나눠서 정규화
- 정규화한 값이 1 이상으로 나올수도 있음
2. 전처리
A. 해야할 것 분류
- Waveform 평균 구하기
- 전체 Waveform의 평균 구하기
- 부분 Waveform의 평균 구하기
- 이상치 제거하기
- 전체 Waveform +-250 범위를 벗어나는 부분 Waveform을 학습 데이터 셋에서 제외하기
- 부분 Waveform의 값에 -1200, 1300이 하나라도 있으면 제외하기
- Waveform 값 수정
- 전체 Waveform의 평균을 0으로 가지는 Waveform을 만들기 위해 Wavefom 값에서 전체 평균값 빼기
B. 진행 과정
a. Waveform 평균 구하기
- 전체 Waveform의 평균
print("spo2_wave_all :", spo2_wave_all)
spo2_wave_all_avg = spo2_wave_all / len(choice_num_1_use.loc[:, 'SpO2 Wave'])
print("spo2_wave_all / len :", spo2_wave_all_avg)
spo2_wave_all_avg_list.append(spo2_wave_all_avg)
spo2_wave_all_avg_list :
[-4.570168404170008, 7.24468085106383, 16.752676425606293, 5.030131400090621,
11.40900900900901, 22.893231441048034, 3.2114035087719297, -9.150355871886122,
1.8936216688510266, 20.694971327745918, 20.229468599033815, 11.901439162668993,
-7.041894353369763, 4.54444201790784, 1.3987523992322457, 45.01651903279866,
-5.9517453798767965, 13.602459916538546, 2.3132803632236096, 12.722792607802875,
25.144794064978257, 0.7584922200306816, -3.7489567318251704, 26.03598858898398,
-1.3336248360297334]
- 부분 Waveform의 평균
select_wave_one_avg = select_wave_one_one / len(select_wave_one)
print("select_wave_one_avg :", select_wave_one_avg)
...
select_wave_one_avg_list.append(select_wave_one_avg)
...
select_wave_full_avg_list.append(select_wave_one_avg_list)
select_wave_full_avg_list :
[
[-2.8046875, -49.4375, -28.1953125, 102.7421875, 38.9296875, 5.078125, -486.875,
52.6875, 206.765625, 230.5625, 334.5, 156.6015625, -88.28125, 76.390625, -78.4609375,
-63.921875, 1.4140625, 198.9921875, -56.9375, -337.8671875, -17.71875, 331.3203125],
[48.1640625, -45.15625, 73.0078125, 91.1015625, 202.984375, 14.921875, -148.4609375,
121.3046875, 50.265625, 109.90625, -32.40625, -64.5703125, 57.0, 8.7890625, 34.28125,
12.9921875, 236.9765625, -35.015625, -74.08469951923075, 56.9140625, 173.4296875,
-73.4140625, -63.234375, -24.3125, 36.671875, 25.34375, 59.71875],
[125.0703125, 65.140625, -88.8203125, -632.0256315104167, 364.59375, 268.4765625,
-132.30986778846153, 154.4609375, -147.8984375, 300.6015625, 1.7421875, 154.0546875,
297.9921875, -80.7265625, -300.0, -86.78125, 141.3828125, 467.625, 95.1328125,
-245.0078125, -186.421875, 3.1171875, 373.1015625, 219.625, 55.96875, -324.59375,
61.7890625, 27.6875],
[157.609375, -501.296875, 236.59375, 42.61328725961539, 94.0703125, 176.8828125,
196.2421875, -15.527500000000003, -240.453125, -126.9453125, -184.703125, 125.3046875,
494.3828125, 151.56204927884616, -232.4921875, -420.875, -103.171875, 172.6796875,
479.71875, 111.2109375, -159.7578125, -19.34375, 176.1484375, -35.22145432692308,
-61.078125, -182.484375, -229.8984375, -45.5, 243.0390625, -81.77868990384616],
[155.1328125, -32.7734375, 203.1484375, -107.203125, -155.375, 14.71875, 198.328125,
129.58210336538463, -196.640625, -43.3515625, 26.6796875, 25.734375, 106.578125,
-85.03685697115384, -20.90625, 81.9921875, 195.1796875, 98.7890625, -175.703125,
56.1015625, 8.4375, -0.375, -45.6875, -54.2890625, 54.296875],
[-19.6484375, -77.9591466346154, -199.55162259615383, 57.49575120192307, 469.4921875,
105.20695312499998, -219.6953125, -127.796875, 232.6953125, -180.15625, 65.8984375,
16.734375, 141.0078125, 211.3671875, 248.6484375, 50.1484375, -27.65625, -341.40625,
170.8984375, 386.09375, 276.38798076923075, -162.375, -37.671875, 231.5625,
-140.1285877403846, -118.1953125, 70.390625],
...
[168.234375, -4.0, 3.7890625, 27.515625, -17.7890625, 21.1328125, -19.234375, -17.390625,
15.8828125, -31.2109375, 1.96875, -47.6484375, 33.3828125, -38.515625, -56.921875,
13.390625, -24.1484375, 43.4765625, 7.340108173076928, 1.8046875, -105.359375,
-36.21875, -17.3515625, 38.0, 43.46875, 45.296875, -40.8046875, -82.109375,
55.9921875, 69.1015625, 22.6953125, -45.09375],
[-49.703125, -66.015625, 88.0703125, 100.6484375, 101.0, -8.171875, -64.171875,
97.234375, 14.9296875, -10.7578125, 73.890625, -98.7734375, -156.0390625,
40.796875, 83.5078125, -68.9765625, 87.359375, -42.828125, 181.828125, 96.359375,
-37.09375, -10.234375, 232.6328125, -114.0078125, -154.2578125, -93.29419471153847,
118.78125, 181.5859375],
[160.140625, 236.5703125, 35.1171875, -35.4921875, 14.59375, 26.734375,
-78.83302884615384, -124.703125, -126.96875, -40.671875, 74.6640625, 60.125,
18.1015625, 37.3628485576923, 153.7578125, 138.21496995192308, -102.16114783653846,
-69.2578125, -39.5625, 43.1171875, 46.546875, -26.1875, -30.1328125, -396.625,
-29.3359375, 47.25, -39.685534855769234, -12.109375, 266.640625, 230.4140625],
[119.3984375, 2.578125, -48.5078125, -5.421875, -42.7890625, 3.6015625, 10.4140625,
13.515625, 42.7109375, -52.65272235576923, -65.6796875, 104.7265625, 45.8515625,
115.65625, 46.0859375, -122.921875, 93.234375, 260.6796875, -176.6171875, -150.890625,
-113.0625, 37.9765625, -55.4296875, 122.5234375, 278.1015625, 48.5078125, 91.546875,
1.421875, -166.7109375, -105.453125, -78.4296875]
]
b. 이상치 제거하기
"""
값중에 1300이나 -1200이 들어가면 continue
"""
print("unique :", select_wave_one.unique())
if 1300 in select_wave_one.unique():
continue
if -1200 in select_wave_one.unique():
continue
"""
부분 waveform 평균값이 전체 waveform 평균값 +- 250을 벗어난다면 continue
"""
if ((select_wave_one_avg - spo2_wave_all_avg) > 250) or ((select_wave_one_avg - spo2_wave_all_avg) < -250):
continue
- 전체
f'(x)
값을 1024로 나눠서 정규화- 정규화한 값이 1 이상으로 나올수도 있음
A. 해야할 것 분류
- Waveform 평균 구하기
- 전체 Waveform의 평균 구하기
- 부분 Waveform의 평균 구하기
- 이상치 제거하기
- 전체 Waveform +-250 범위를 벗어나는 부분 Waveform을 학습 데이터 셋에서 제외하기
- 부분 Waveform의 값에 -1200, 1300이 하나라도 있으면 제외하기
- Waveform 값 수정
- 전체 Waveform의 평균을 0으로 가지는 Waveform을 만들기 위해 Wavefom 값에서 전체 평균값 빼기
B. 진행 과정
a. Waveform 평균 구하기
- 전체 Waveform의 평균
print("spo2_wave_all :", spo2_wave_all)
spo2_wave_all_avg = spo2_wave_all / len(choice_num_1_use.loc[:, 'SpO2 Wave'])
print("spo2_wave_all / len :", spo2_wave_all_avg)
spo2_wave_all_avg_list.append(spo2_wave_all_avg)
spo2_wave_all_avg_list :
[-4.570168404170008, 7.24468085106383, 16.752676425606293, 5.030131400090621,
11.40900900900901, 22.893231441048034, 3.2114035087719297, -9.150355871886122,
1.8936216688510266, 20.694971327745918, 20.229468599033815, 11.901439162668993,
-7.041894353369763, 4.54444201790784, 1.3987523992322457, 45.01651903279866,
-5.9517453798767965, 13.602459916538546, 2.3132803632236096, 12.722792607802875,
25.144794064978257, 0.7584922200306816, -3.7489567318251704, 26.03598858898398,
-1.3336248360297334]
- 부분 Waveform의 평균
select_wave_one_avg = select_wave_one_one / len(select_wave_one)
print("select_wave_one_avg :", select_wave_one_avg)
...
select_wave_one_avg_list.append(select_wave_one_avg)
...
select_wave_full_avg_list.append(select_wave_one_avg_list)
select_wave_full_avg_list :
[
[-2.8046875, -49.4375, -28.1953125, 102.7421875, 38.9296875, 5.078125, -486.875,
52.6875, 206.765625, 230.5625, 334.5, 156.6015625, -88.28125, 76.390625, -78.4609375,
-63.921875, 1.4140625, 198.9921875, -56.9375, -337.8671875, -17.71875, 331.3203125],
[48.1640625, -45.15625, 73.0078125, 91.1015625, 202.984375, 14.921875, -148.4609375,
121.3046875, 50.265625, 109.90625, -32.40625, -64.5703125, 57.0, 8.7890625, 34.28125,
12.9921875, 236.9765625, -35.015625, -74.08469951923075, 56.9140625, 173.4296875,
-73.4140625, -63.234375, -24.3125, 36.671875, 25.34375, 59.71875],
[125.0703125, 65.140625, -88.8203125, -632.0256315104167, 364.59375, 268.4765625,
-132.30986778846153, 154.4609375, -147.8984375, 300.6015625, 1.7421875, 154.0546875,
297.9921875, -80.7265625, -300.0, -86.78125, 141.3828125, 467.625, 95.1328125,
-245.0078125, -186.421875, 3.1171875, 373.1015625, 219.625, 55.96875, -324.59375,
61.7890625, 27.6875],
[157.609375, -501.296875, 236.59375, 42.61328725961539, 94.0703125, 176.8828125,
196.2421875, -15.527500000000003, -240.453125, -126.9453125, -184.703125, 125.3046875,
494.3828125, 151.56204927884616, -232.4921875, -420.875, -103.171875, 172.6796875,
479.71875, 111.2109375, -159.7578125, -19.34375, 176.1484375, -35.22145432692308,
-61.078125, -182.484375, -229.8984375, -45.5, 243.0390625, -81.77868990384616],
[155.1328125, -32.7734375, 203.1484375, -107.203125, -155.375, 14.71875, 198.328125,
129.58210336538463, -196.640625, -43.3515625, 26.6796875, 25.734375, 106.578125,
-85.03685697115384, -20.90625, 81.9921875, 195.1796875, 98.7890625, -175.703125,
56.1015625, 8.4375, -0.375, -45.6875, -54.2890625, 54.296875],
[-19.6484375, -77.9591466346154, -199.55162259615383, 57.49575120192307, 469.4921875,
105.20695312499998, -219.6953125, -127.796875, 232.6953125, -180.15625, 65.8984375,
16.734375, 141.0078125, 211.3671875, 248.6484375, 50.1484375, -27.65625, -341.40625,
170.8984375, 386.09375, 276.38798076923075, -162.375, -37.671875, 231.5625,
-140.1285877403846, -118.1953125, 70.390625],
...
[168.234375, -4.0, 3.7890625, 27.515625, -17.7890625, 21.1328125, -19.234375, -17.390625,
15.8828125, -31.2109375, 1.96875, -47.6484375, 33.3828125, -38.515625, -56.921875,
13.390625, -24.1484375, 43.4765625, 7.340108173076928, 1.8046875, -105.359375,
-36.21875, -17.3515625, 38.0, 43.46875, 45.296875, -40.8046875, -82.109375,
55.9921875, 69.1015625, 22.6953125, -45.09375],
[-49.703125, -66.015625, 88.0703125, 100.6484375, 101.0, -8.171875, -64.171875,
97.234375, 14.9296875, -10.7578125, 73.890625, -98.7734375, -156.0390625,
40.796875, 83.5078125, -68.9765625, 87.359375, -42.828125, 181.828125, 96.359375,
-37.09375, -10.234375, 232.6328125, -114.0078125, -154.2578125, -93.29419471153847,
118.78125, 181.5859375],
[160.140625, 236.5703125, 35.1171875, -35.4921875, 14.59375, 26.734375,
-78.83302884615384, -124.703125, -126.96875, -40.671875, 74.6640625, 60.125,
18.1015625, 37.3628485576923, 153.7578125, 138.21496995192308, -102.16114783653846,
-69.2578125, -39.5625, 43.1171875, 46.546875, -26.1875, -30.1328125, -396.625,
-29.3359375, 47.25, -39.685534855769234, -12.109375, 266.640625, 230.4140625],
[119.3984375, 2.578125, -48.5078125, -5.421875, -42.7890625, 3.6015625, 10.4140625,
13.515625, 42.7109375, -52.65272235576923, -65.6796875, 104.7265625, 45.8515625,
115.65625, 46.0859375, -122.921875, 93.234375, 260.6796875, -176.6171875, -150.890625,
-113.0625, 37.9765625, -55.4296875, 122.5234375, 278.1015625, 48.5078125, 91.546875,
1.421875, -166.7109375, -105.453125, -78.4296875]
]
b. 이상치 제거하기
"""
값중에 1300이나 -1200이 들어가면 continue
"""
print("unique :", select_wave_one.unique())
if 1300 in select_wave_one.unique():
continue
if -1200 in select_wave_one.unique():
continue
"""
부분 waveform 평균값이 전체 waveform 평균값 +- 250을 벗어난다면 continue
"""
if ((select_wave_one_avg - spo2_wave_all_avg) > 250) or ((select_wave_one_avg - spo2_wave_all_avg) < -250):
continue
- 전체 Waveform의 평균 구하기
- 부분 Waveform의 평균 구하기
- 전체 Waveform +-250 범위를 벗어나는 부분 Waveform을 학습 데이터 셋에서 제외하기
- 부분 Waveform의 값에 -1200, 1300이 하나라도 있으면 제외하기
- 전체 Waveform의 평균을 0으로 가지는 Waveform을 만들기 위해 Wavefom 값에서 전체 평균값 빼기
a. Waveform 평균 구하기
- 전체 Waveform의 평균
print("spo2_wave_all :", spo2_wave_all)
spo2_wave_all_avg = spo2_wave_all / len(choice_num_1_use.loc[:, 'SpO2 Wave'])
print("spo2_wave_all / len :", spo2_wave_all_avg)
spo2_wave_all_avg_list.append(spo2_wave_all_avg)
spo2_wave_all_avg_list :
[-4.570168404170008, 7.24468085106383, 16.752676425606293, 5.030131400090621,
11.40900900900901, 22.893231441048034, 3.2114035087719297, -9.150355871886122,
1.8936216688510266, 20.694971327745918, 20.229468599033815, 11.901439162668993,
-7.041894353369763, 4.54444201790784, 1.3987523992322457, 45.01651903279866,
-5.9517453798767965, 13.602459916538546, 2.3132803632236096, 12.722792607802875,
25.144794064978257, 0.7584922200306816, -3.7489567318251704, 26.03598858898398,
-1.3336248360297334]
- 부분 Waveform의 평균
select_wave_one_avg = select_wave_one_one / len(select_wave_one)
print("select_wave_one_avg :", select_wave_one_avg)
...
select_wave_one_avg_list.append(select_wave_one_avg)
...
select_wave_full_avg_list.append(select_wave_one_avg_list)
select_wave_full_avg_list :
[
[-2.8046875, -49.4375, -28.1953125, 102.7421875, 38.9296875, 5.078125, -486.875,
52.6875, 206.765625, 230.5625, 334.5, 156.6015625, -88.28125, 76.390625, -78.4609375,
-63.921875, 1.4140625, 198.9921875, -56.9375, -337.8671875, -17.71875, 331.3203125],
[48.1640625, -45.15625, 73.0078125, 91.1015625, 202.984375, 14.921875, -148.4609375,
121.3046875, 50.265625, 109.90625, -32.40625, -64.5703125, 57.0, 8.7890625, 34.28125,
12.9921875, 236.9765625, -35.015625, -74.08469951923075, 56.9140625, 173.4296875,
-73.4140625, -63.234375, -24.3125, 36.671875, 25.34375, 59.71875],
[125.0703125, 65.140625, -88.8203125, -632.0256315104167, 364.59375, 268.4765625,
-132.30986778846153, 154.4609375, -147.8984375, 300.6015625, 1.7421875, 154.0546875,
297.9921875, -80.7265625, -300.0, -86.78125, 141.3828125, 467.625, 95.1328125,
-245.0078125, -186.421875, 3.1171875, 373.1015625, 219.625, 55.96875, -324.59375,
61.7890625, 27.6875],
[157.609375, -501.296875, 236.59375, 42.61328725961539, 94.0703125, 176.8828125,
196.2421875, -15.527500000000003, -240.453125, -126.9453125, -184.703125, 125.3046875,
494.3828125, 151.56204927884616, -232.4921875, -420.875, -103.171875, 172.6796875,
479.71875, 111.2109375, -159.7578125, -19.34375, 176.1484375, -35.22145432692308,
-61.078125, -182.484375, -229.8984375, -45.5, 243.0390625, -81.77868990384616],
[155.1328125, -32.7734375, 203.1484375, -107.203125, -155.375, 14.71875, 198.328125,
129.58210336538463, -196.640625, -43.3515625, 26.6796875, 25.734375, 106.578125,
-85.03685697115384, -20.90625, 81.9921875, 195.1796875, 98.7890625, -175.703125,
56.1015625, 8.4375, -0.375, -45.6875, -54.2890625, 54.296875],
[-19.6484375, -77.9591466346154, -199.55162259615383, 57.49575120192307, 469.4921875,
105.20695312499998, -219.6953125, -127.796875, 232.6953125, -180.15625, 65.8984375,
16.734375, 141.0078125, 211.3671875, 248.6484375, 50.1484375, -27.65625, -341.40625,
170.8984375, 386.09375, 276.38798076923075, -162.375, -37.671875, 231.5625,
-140.1285877403846, -118.1953125, 70.390625],
...
[168.234375, -4.0, 3.7890625, 27.515625, -17.7890625, 21.1328125, -19.234375, -17.390625,
15.8828125, -31.2109375, 1.96875, -47.6484375, 33.3828125, -38.515625, -56.921875,
13.390625, -24.1484375, 43.4765625, 7.340108173076928, 1.8046875, -105.359375,
-36.21875, -17.3515625, 38.0, 43.46875, 45.296875, -40.8046875, -82.109375,
55.9921875, 69.1015625, 22.6953125, -45.09375],
[-49.703125, -66.015625, 88.0703125, 100.6484375, 101.0, -8.171875, -64.171875,
97.234375, 14.9296875, -10.7578125, 73.890625, -98.7734375, -156.0390625,
40.796875, 83.5078125, -68.9765625, 87.359375, -42.828125, 181.828125, 96.359375,
-37.09375, -10.234375, 232.6328125, -114.0078125, -154.2578125, -93.29419471153847,
118.78125, 181.5859375],
[160.140625, 236.5703125, 35.1171875, -35.4921875, 14.59375, 26.734375,
-78.83302884615384, -124.703125, -126.96875, -40.671875, 74.6640625, 60.125,
18.1015625, 37.3628485576923, 153.7578125, 138.21496995192308, -102.16114783653846,
-69.2578125, -39.5625, 43.1171875, 46.546875, -26.1875, -30.1328125, -396.625,
-29.3359375, 47.25, -39.685534855769234, -12.109375, 266.640625, 230.4140625],
[119.3984375, 2.578125, -48.5078125, -5.421875, -42.7890625, 3.6015625, 10.4140625,
13.515625, 42.7109375, -52.65272235576923, -65.6796875, 104.7265625, 45.8515625,
115.65625, 46.0859375, -122.921875, 93.234375, 260.6796875, -176.6171875, -150.890625,
-113.0625, 37.9765625, -55.4296875, 122.5234375, 278.1015625, 48.5078125, 91.546875,
1.421875, -166.7109375, -105.453125, -78.4296875]
]
b. 이상치 제거하기
"""
값중에 1300이나 -1200이 들어가면 continue
"""
print("unique :", select_wave_one.unique())
if 1300 in select_wave_one.unique():
continue
if -1200 in select_wave_one.unique():
continue
"""
부분 waveform 평균값이 전체 waveform 평균값 +- 250을 벗어난다면 continue
"""
if ((select_wave_one_avg - spo2_wave_all_avg) > 250) or ((select_wave_one_avg - spo2_wave_all_avg) < -250):
continue
print("spo2_wave_all :", spo2_wave_all)
spo2_wave_all_avg = spo2_wave_all / len(choice_num_1_use.loc[:, 'SpO2 Wave'])
print("spo2_wave_all / len :", spo2_wave_all_avg)
spo2_wave_all_avg_list.append(spo2_wave_all_avg)
spo2_wave_all_avg_list :
[-4.570168404170008, 7.24468085106383, 16.752676425606293, 5.030131400090621,
11.40900900900901, 22.893231441048034, 3.2114035087719297, -9.150355871886122,
1.8936216688510266, 20.694971327745918, 20.229468599033815, 11.901439162668993,
-7.041894353369763, 4.54444201790784, 1.3987523992322457, 45.01651903279866,
-5.9517453798767965, 13.602459916538546, 2.3132803632236096, 12.722792607802875,
25.144794064978257, 0.7584922200306816, -3.7489567318251704, 26.03598858898398,
-1.3336248360297334]
select_wave_one_avg = select_wave_one_one / len(select_wave_one)
print("select_wave_one_avg :", select_wave_one_avg)
...
select_wave_one_avg_list.append(select_wave_one_avg)
...
select_wave_full_avg_list.append(select_wave_one_avg_list)
select_wave_full_avg_list :
[
[-2.8046875, -49.4375, -28.1953125, 102.7421875, 38.9296875, 5.078125, -486.875,
52.6875, 206.765625, 230.5625, 334.5, 156.6015625, -88.28125, 76.390625, -78.4609375,
-63.921875, 1.4140625, 198.9921875, -56.9375, -337.8671875, -17.71875, 331.3203125],
[48.1640625, -45.15625, 73.0078125, 91.1015625, 202.984375, 14.921875, -148.4609375,
121.3046875, 50.265625, 109.90625, -32.40625, -64.5703125, 57.0, 8.7890625, 34.28125,
12.9921875, 236.9765625, -35.015625, -74.08469951923075, 56.9140625, 173.4296875,
-73.4140625, -63.234375, -24.3125, 36.671875, 25.34375, 59.71875],
[125.0703125, 65.140625, -88.8203125, -632.0256315104167, 364.59375, 268.4765625,
-132.30986778846153, 154.4609375, -147.8984375, 300.6015625, 1.7421875, 154.0546875,
297.9921875, -80.7265625, -300.0, -86.78125, 141.3828125, 467.625, 95.1328125,
-245.0078125, -186.421875, 3.1171875, 373.1015625, 219.625, 55.96875, -324.59375,
61.7890625, 27.6875],
[157.609375, -501.296875, 236.59375, 42.61328725961539, 94.0703125, 176.8828125,
196.2421875, -15.527500000000003, -240.453125, -126.9453125, -184.703125, 125.3046875,
494.3828125, 151.56204927884616, -232.4921875, -420.875, -103.171875, 172.6796875,
479.71875, 111.2109375, -159.7578125, -19.34375, 176.1484375, -35.22145432692308,
-61.078125, -182.484375, -229.8984375, -45.5, 243.0390625, -81.77868990384616],
[155.1328125, -32.7734375, 203.1484375, -107.203125, -155.375, 14.71875, 198.328125,
129.58210336538463, -196.640625, -43.3515625, 26.6796875, 25.734375, 106.578125,
-85.03685697115384, -20.90625, 81.9921875, 195.1796875, 98.7890625, -175.703125,
56.1015625, 8.4375, -0.375, -45.6875, -54.2890625, 54.296875],
[-19.6484375, -77.9591466346154, -199.55162259615383, 57.49575120192307, 469.4921875,
105.20695312499998, -219.6953125, -127.796875, 232.6953125, -180.15625, 65.8984375,
16.734375, 141.0078125, 211.3671875, 248.6484375, 50.1484375, -27.65625, -341.40625,
170.8984375, 386.09375, 276.38798076923075, -162.375, -37.671875, 231.5625,
-140.1285877403846, -118.1953125, 70.390625],
...
[168.234375, -4.0, 3.7890625, 27.515625, -17.7890625, 21.1328125, -19.234375, -17.390625,
15.8828125, -31.2109375, 1.96875, -47.6484375, 33.3828125, -38.515625, -56.921875,
13.390625, -24.1484375, 43.4765625, 7.340108173076928, 1.8046875, -105.359375,
-36.21875, -17.3515625, 38.0, 43.46875, 45.296875, -40.8046875, -82.109375,
55.9921875, 69.1015625, 22.6953125, -45.09375],
[-49.703125, -66.015625, 88.0703125, 100.6484375, 101.0, -8.171875, -64.171875,
97.234375, 14.9296875, -10.7578125, 73.890625, -98.7734375, -156.0390625,
40.796875, 83.5078125, -68.9765625, 87.359375, -42.828125, 181.828125, 96.359375,
-37.09375, -10.234375, 232.6328125, -114.0078125, -154.2578125, -93.29419471153847,
118.78125, 181.5859375],
[160.140625, 236.5703125, 35.1171875, -35.4921875, 14.59375, 26.734375,
-78.83302884615384, -124.703125, -126.96875, -40.671875, 74.6640625, 60.125,
18.1015625, 37.3628485576923, 153.7578125, 138.21496995192308, -102.16114783653846,
-69.2578125, -39.5625, 43.1171875, 46.546875, -26.1875, -30.1328125, -396.625,
-29.3359375, 47.25, -39.685534855769234, -12.109375, 266.640625, 230.4140625],
[119.3984375, 2.578125, -48.5078125, -5.421875, -42.7890625, 3.6015625, 10.4140625,
13.515625, 42.7109375, -52.65272235576923, -65.6796875, 104.7265625, 45.8515625,
115.65625, 46.0859375, -122.921875, 93.234375, 260.6796875, -176.6171875, -150.890625,
-113.0625, 37.9765625, -55.4296875, 122.5234375, 278.1015625, 48.5078125, 91.546875,
1.421875, -166.7109375, -105.453125, -78.4296875]
]
"""
값중에 1300이나 -1200이 들어가면 continue
"""
print("unique :", select_wave_one.unique())
if 1300 in select_wave_one.unique():
continue
if -1200 in select_wave_one.unique():
continue
"""
부분 waveform 평균값이 전체 waveform 평균값 +- 250을 벗어난다면 continue
"""
if ((select_wave_one_avg - spo2_wave_all_avg) > 250) or ((select_wave_one_avg - spo2_wave_all_avg) < -250):
continue
c. Waveform 값 수정
for s in range(len(select_wave_one)):
select_wave_one.iloc[s] = select_wave_one.iloc[s] - spo2_wave_all_avg
3. 정규화
A. 해야할 것 분류
- 정규화 방식의 변경
- 값을 1024로 나눈다
B. 진행 과정
a. 정규화 방식의 변경
"""
1024로 나누는 정규화
"""
for q in range(len(select_wave_one)):
select_wave_one.iloc[q] = select_wave_one.iloc[q]/1024
for s in range(len(select_wave_one)):
select_wave_one.iloc[s] = select_wave_one.iloc[s] - spo2_wave_all_avg
A. 해야할 것 분류
- 정규화 방식의 변경
- 값을 1024로 나눈다
B. 진행 과정
a. 정규화 방식의 변경
"""
1024로 나누는 정규화
"""
for q in range(len(select_wave_one)):
select_wave_one.iloc[q] = select_wave_one.iloc[q]/1024
- 값을 1024로 나눈다
a. 정규화 방식의 변경
"""
1024로 나누는 정규화
"""
for q in range(len(select_wave_one)):
select_wave_one.iloc[q] = select_wave_one.iloc[q]/1024
"""
1024로 나누는 정규화
"""
for q in range(len(select_wave_one)):
select_wave_one.iloc[q] = select_wave_one.iloc[q]/1024
Ghost