<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Next.js |</title><link>https://inhyuk2000.github.io/tags/next.js/</link><atom:link href="https://inhyuk2000.github.io/tags/next.js/index.xml" rel="self" type="application/rss+xml"/><description>Next.js</description><generator>HugoBlox Kit (https://hugoblox.com)</generator><language>en-us</language><lastBuildDate>Fri, 20 Sep 2024 00:00:00 +0900</lastBuildDate><image><url>https://inhyuk2000.github.io/media/icon_hu_eee4a95885829ab2.png</url><title>Next.js</title><link>https://inhyuk2000.github.io/tags/next.js/</link></image><item><title>공간 데이터 기반 재난 임시주거시설 최적 후보지 추천 시스템 개발</title><link>https://inhyuk2000.github.io/projects/disaster-shelter/</link><pubDate>Fri, 20 Sep 2024 00:00:00 +0900</pubDate><guid>https://inhyuk2000.github.io/projects/disaster-shelter/</guid><description>
&lt;div class="callout flex px-4 py-3 mb-6 rounded-md border-l-4 bg-orange-100 dark:bg-orange-900 border-orange-500"
data-callout="warning"
data-callout-metadata=""&gt;
&lt;span class="callout-icon pr-3 pt-1 text-orange-600 dark:text-orange-300"&gt;
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0zM12 15.75h.007v.008H12z"/&gt;&lt;/svg&gt;
&lt;/span&gt;
&lt;div class="callout-content dark:text-neutral-300"&gt;
&lt;div class="callout-title font-semibold mb-1"&gt;정리예정입니다.&lt;/div&gt;
&lt;div class="callout-body"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>역세권 데이터 기반 7호선 급행열차 최적 정차역 선정 시스템 개발</title><link>https://inhyuk2000.github.io/projects/subway/</link><pubDate>Fri, 20 Sep 2024 00:00:00 +0900</pubDate><guid>https://inhyuk2000.github.io/projects/subway/</guid><description>&lt;h2 id="문제-정의"&gt;문제 정의&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;먼저 &lt;code&gt;좋은 급행 정차역&lt;/code&gt;이 무엇인지 정의함. &lt;span class="high-mark"&gt;&lt;strong&gt;편익 기준&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class="border-l-4 border-neutral-300 dark:border-neutral-600 pl-4 italic text-neutral-600 dark:text-neutral-400 my-6"&gt;
&lt;p&gt;&lt;u&gt;&lt;strong&gt;사람이 많이 이용&lt;/strong&gt;&lt;/u&gt;하고, &lt;u&gt;&lt;strong&gt;주변에 중요한 시설이 많은 역&lt;/strong&gt;&lt;/u&gt;일수록 급행이 서야 하지 않을까?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="데이터-수집"&gt;데이터 수집&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Q. &lt;code&gt;1000m&lt;/code&gt; 반경으로 최종 결정한 근거가 뭔지?
&lt;ul&gt;
&lt;li&gt;그 당시에는 200m나 500m 기반으로 했을때는, 값이 거의 0이 많이 나왔음. 그래서 수집이 의미없다고 판단해서 반경을 그냥 늘린거였음. 많은 고민 안하고&amp;hellip; &lt;strong&gt;(이 부분 어떻게 답변 전략 생각해야 할 지 고민 필요)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="전처리-및-eda"&gt;전처리 및 EDA&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;데이터 단위 맞추기 위한 &lt;code&gt;Standard Scaling&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ex. 경찰서 수 = 3, 병원 수 = 15, 인구 = 50000&lt;/code&gt; 처럼 변수마다 숫자의 크기가 완전히 다름. 그대로 모델에 넣으면 인구처럼 숫자가 큰 변수가 지나치게 큰 영향을 줄 수 있어서, &lt;code&gt;Standard Scaling&lt;/code&gt; 표준화를 진행함.&lt;/li&gt;
&lt;li&gt;즉, 각 변수의 평균을 0 근처로 만들고, 서로 비슷한 크기의 척도로 변경&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span class="high-mark"&gt;&lt;strong&gt;다중공선성 해결&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;처음 &lt;strong&gt;독립 변수&lt;/strong&gt;는 24개.&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class="border-l-4 border-neutral-300 dark:border-neutral-600 pl-4 italic text-neutral-600 dark:text-neutral-400 my-6"&gt;
&lt;p&gt;아파트 수가 많은 지역 - 총 인구도 많을 가능성이 높음 - 주택 수도 많음 - 편의점이나 음식점 수도 많을 수 있음&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;VIF (Variation Inflation Factor)&lt;/code&gt; 계산
&lt;ul&gt;
&lt;li&gt;총 인구: 138, 주택/단독 주택/아파트/연립주택/다세대 주택: &lt;code&gt;inf&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;비슷한 변수들을 &lt;code&gt;PCA&lt;/code&gt; 압축
&lt;ul&gt;
&lt;li&gt;음식점/카페/편의점 - &lt;code&gt;상업 시설&lt;/code&gt;로 압축&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;상관계수&lt;/code&gt;가 &lt;strong&gt;지나치게 높은 변수 제거&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0.7&lt;/code&gt; 이상인 변수 제거&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span class="high-mark"&gt;&lt;strong&gt;회귀분석을 통해 실제 승하차 인원과 관계있는 변수 찾기&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;처음 24개의 독립 변수를 전부 사용한 경우 모델:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;R²&lt;/code&gt; = &lt;strong&gt;0.89&lt;/strong&gt;, &lt;code&gt;Adjusted R²&lt;/code&gt; = &lt;strong&gt;0.74&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;변수 정리 후 16개의 독립 변수를 사용한 경우 모델:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;R²&lt;/code&gt; = &lt;strong&gt;0.80&lt;/strong&gt;, &lt;code&gt;Adjusted R²&lt;/code&gt; = &lt;strong&gt;0.70&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="callout flex px-4 py-3 mb-6 rounded-md border-l-4 bg-blue-100 dark:bg-blue-900 border-blue-500"
data-callout="note"
data-callout-metadata=""&gt;
&lt;span class="callout-icon pr-3 pt-1 text-blue-600 dark:text-blue-300"&gt;
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m16.862 4.487l1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8l.8-2.685a4.5 4.5 0 0 1 1.13-1.897zm0 0L19.5 7.125"/&gt;&lt;/svg&gt;
&lt;/span&gt;
&lt;div class="callout-content dark:text-neutral-300"&gt;
&lt;div class="callout-title font-semibold mb-1"&gt;불필요하고 겹치는 변수를 많이 제거하면서도 대부분의 설명력을 유지함.&lt;/div&gt;
&lt;div class="callout-body"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span class="high-mark"&gt;&lt;strong&gt;회귀분석 결과, p-value 이용해 의미 있는 변수 선정&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;p-value&lt;/code&gt; &amp;lt; &lt;code&gt;0.05&lt;/code&gt; 이하인 유의미한 변수 선정&lt;/li&gt;
&lt;li&gt;최종, &lt;code&gt;에스컬레이터&lt;/code&gt;, &lt;code&gt;경찰서&lt;/code&gt;, &lt;code&gt;도서관&lt;/code&gt;, &lt;code&gt;은행&lt;/code&gt;, &lt;code&gt;병원&lt;/code&gt;, &lt;code&gt;상업시설(PCA)&lt;/code&gt; 선정&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class="border-l-4 border-neutral-300 dark:border-neutral-600 pl-4 italic text-neutral-600 dark:text-neutral-400 my-6"&gt;
&lt;p&gt;어떤 특성을 가진 역이 중요한지는 어느 정도 알았다.. 하지만 모든 역을 그냥 중요도 순으로 1, 2, 3등으로 줄 세우면 문제가 있음. 예를 들어, &lt;code&gt;강남권의 대형 상업역&lt;/code&gt;, &lt;code&gt;중간 규모 생활권 역&lt;/code&gt;, &lt;code&gt;비교적 작은 지역 역&lt;/code&gt;은 역할 자체가 서로 다름. 그래서 &lt;u&gt;&lt;strong&gt;비슷한 특징을 가진 역끼리 그룹을 만들어보자.&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="계층적-클러스터링-진행"&gt;계층적 클러스터링 진행&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;u&gt;&lt;strong&gt;선택 이유&lt;/strong&gt;&lt;/u&gt; : &lt;strong&gt;표본 수가 약 200개 이하인 데이터에 적합&lt;/strong&gt;하고, 미리 클러스터 개수를 &lt;strong&gt;정확하게 지정하지 않아도 분석할 수 있다&lt;/strong&gt;는 점.&lt;/li&gt;
&lt;li&gt;앞에서 선정한 역새권 특성들이 비슷한 역끼리 군집화됨.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;군집 1&lt;/code&gt;. 상대적으로 중요한 역.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;군집 2&lt;/code&gt;. 중간 정도 역.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;군집 3&lt;/code&gt;. 상대적으로 중요도가 낮은 역.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span class="high-mark"&gt;&lt;strong&gt;각 군집에 가중치를 줌&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;blockquote class="border-l-4 border-neutral-300 dark:border-neutral-600 pl-4 italic text-neutral-600 dark:text-neutral-400 my-6"&gt;
&lt;p&gt;중요한 군집에 속한 역은 최대한 정차시키고, 덜 중요한 군집은 상대적으로 덜 정차시키자.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="callout flex px-4 py-3 mb-6 rounded-md border-l-4 bg-yellow-100 dark:bg-yellow-900 border-yellow-500"
data-callout="question"
data-callout-metadata=""&gt;
&lt;span class="callout-icon pr-3 pt-1 text-yellow-700 dark:text-yellow-300"&gt;
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9.879 7.519c1.172-1.025 3.071-1.025 4.243 0c1.171 1.025 1.171 2.687 0 3.712q-.308.268-.67.442c-.746.361-1.452.999-1.452 1.827v.75M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0m-9 5.25h.008v.008H12z"/&gt;&lt;/svg&gt;
&lt;/span&gt;
&lt;div class="callout-content dark:text-neutral-300"&gt;
&lt;div class="callout-title font-semibold mb-1"&gt;이 가중치는 어느 기준으로 어떻게 이 값이 나온거지?&lt;/div&gt;
&lt;div class="callout-body"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;군집 별 가중치:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;군집 1&lt;/code&gt;. &lt;code&gt;0.649&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;군집 2&lt;/code&gt;. &lt;code&gt;0.232&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;군집 3&lt;/code&gt;. &lt;code&gt;0.119&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="급행-정차역-선정을-최적화-문제로-바꿈"&gt;급행 정차역 선정을 최적화 문제로 바꿈&lt;/h2&gt;
&lt;blockquote class="border-l-4 border-neutral-300 dark:border-neutral-600 pl-4 italic text-neutral-600 dark:text-neutral-400 my-6"&gt;
&lt;p&gt;가중치 높은 역을 다 세우자! 라고 하면 급행 열차가 아님. 하지만 모든 역에 서면 일반 열차와 똑같음. 따라서 아래와 같은 제약 조건을 넣어줌.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;일반 열차의 운행 시간은 약 &lt;code&gt;84.5분(5070초)&lt;/code&gt;이고, 급행은 이를 약 35% 단축한 &lt;code&gt;53분(3180초)&lt;/code&gt; 수준으로 설정.&lt;/p&gt;
&lt;div class="callout flex px-4 py-3 mb-6 rounded-md border-l-4 bg-blue-100 dark:bg-blue-900 border-blue-500"
data-callout="note"
data-callout-metadata=""&gt;
&lt;span class="callout-icon pr-3 pt-1 text-blue-600 dark:text-blue-300"&gt;
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m16.862 4.487l1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8l.8-2.685a4.5 4.5 0 0 1 1.13-1.897zm0 0L19.5 7.125"/&gt;&lt;/svg&gt;
&lt;/span&gt;
&lt;div class="callout-content dark:text-neutral-300"&gt;
&lt;div class="callout-title font-semibold mb-1"&gt;운행 시간은 53분을 넘지 않음녀서, 최대한 중요한 역에 많이 정차하라.&lt;/div&gt;
&lt;div class="callout-body"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span class="high-mark"&gt;&lt;strong&gt;슬라이딩 윈도우 기반 최적화 알고리즘&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;각 역의 정차 여부를 &lt;code&gt;0/1&lt;/code&gt;로 정의함.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;1&lt;/code&gt;: 급행 열차 정차&lt;/li&gt;
&lt;li&gt;&lt;code&gt;0&lt;/code&gt;: 통과&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;운행시간 &lt;code&gt;53분 이내&lt;/code&gt;라는 &lt;strong&gt;제약조건 설정&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;각 후보 조합에 대해 &lt;code&gt;역 중요도 가중치&lt;/code&gt; X &lt;code&gt;승하차 인원&lt;/code&gt;을 기준으로 &lt;strong&gt;점수 계산&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;시간 제약을 만족하는 조합 중 &lt;strong&gt;목적함수 값이 가장 높은 정차역 조합을 선택&lt;/strong&gt;함.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="최종-결과"&gt;최종 결과&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;급행 정차역: &lt;code&gt;17개&lt;/code&gt; 역&lt;/li&gt;
&lt;li&gt;기존 일반 열차: &lt;code&gt;5070초&lt;/code&gt; (약 &lt;code&gt;84.5분&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;급행 열차: &lt;code&gt;3180초&lt;/code&gt; (약 &lt;code&gt;53분&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;운행 시간 약 &lt;code&gt;37%&lt;/code&gt; 감소&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="callout flex px-4 py-3 mb-6 rounded-md border-l-4 bg-blue-100 dark:bg-blue-900 border-blue-500"
data-callout="note"
data-callout-metadata=""&gt;
&lt;span class="callout-icon pr-3 pt-1 text-blue-600 dark:text-blue-300"&gt;
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m16.862 4.487l1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8l.8-2.685a4.5 4.5 0 0 1 1.13-1.897zm0 0L19.5 7.125"/&gt;&lt;/svg&gt;
&lt;/span&gt;
&lt;div class="callout-content dark:text-neutral-300"&gt;
&lt;div class="callout-title font-semibold mb-1"&gt;운행 시간 제약을 만족하면서 주요 수요역을 최대한 포함하도록 최적 정차역을 선정함.&lt;/div&gt;
&lt;div class="callout-body"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item></channel></rss>