feat: rolling window 로더 추가 및 hub_only 제거#10
Open
pkhyrn268 wants to merge 5 commits into
Open
Conversation
ohchanju3
reviewed
May 30, 2026
| airport_map: build_airport_map()으로 생성한 공항→int 맵 | ||
|
|
||
| Returns: | ||
| 정수 ID 리스트. airport_map에 없는 코드는 무시한다. |
Collaborator
There was a problem hiding this comment.
bases_to_ids() Returns 설명에 "없는 코드는 무시한다"라고 되어있는데, 실제 코드는 없는 코드가 있으면 raise ValueError 하고 있는데 어떤걸 의도한거야 ??
Comment on lines
+152
to
+153
| df["dep_time"] = df["CRS_DEP_TIME"].apply(convert_time) | ||
| df["arr_time"] = df["CRS_ARR_TIME"].apply(convert_time) |
Collaborator
There was a problem hiding this comment.
overnight 항공편(23:30 출발 → 00:30 도착)은 arr_time < dep_time이 돼서 비행시간이 음수가 나올 수 있을 것 같아! BTS 데이터에 CRS_ELAPSED_TIME(분 단위)이 있으니까 arr_time = dep_time + CRS_ELAPSED_TIME / 60으로 바꾸면 될 것 같은데 어때 ??
ohchanju3
added a commit
that referenced
this pull request
May 30, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
개요
BTS 데이터 로딩 방식을 multi-base 학습에 맞게 전면 수정함.
hub_only 필터 제거, 동일 데이터 복제 문제 해결, 공항 ID 불일치 문제 수정,
crew base 명시적 입력을 위한 함수 추가.
loader의 주 파이프라인은:
build_airport_map() → bases_to_ids() → load_flights_rolling()
1. hub_only 필터 제거
기존 코드 문제점
MIN_REST = 8.0부분이 하드코딩되어 있어constraints.py기준 9.5h와 불일치 함.수정
load_flights()에서hub_only파라미터 및 관련 블록 전체 제거.load_flights_multiday()함수 자체 제거. 동일 데이터 반복이 문제의 본질이므로 하위 호환을 위한 유지도 불필요하다고 판단.load_flights_rolling()으로 대체.base 복귀는 environment의 BASE_PENALTY가 담당 예정(찬주 확인 부탁!!)
2. 에피소드마다 동일한 데이터 반복
기존 코드 문제점
수정
load_flights_rolling(path, window_days, offset_days, airport_map)추가offset_days를 에피소드마다 다르게 지정하면 서로 다른 날짜 구간의 flight를 학습한다.window 안에서 랜덤 샘플링하면 시간 연속성이 깨지기 때문에 flight 수는window_days`로만 제어한다.3. 에피소드 간 공항 ID 불일치 버그 (load_flights_rolling)
기존 문제
load_flights()내부에서 로드된 subset 기준으로 airport_map을 재계산했다. rolling window를 쓰면 윈도우마다 포함되는 공항 집합이 달라지므로 같은 "BOS"가 윈도우 1에서 ID=3, 윈도우 2에서 ID=7이 될 수 있었다. 모델의airport_emb는 ID를 인덱스로 사용하므로 ID가 바뀌면 embedding 학습이 무의미해진다.수정
build_airport_map(path)신설. 전체 CSV 기준으로 고정 맵을 한 번 만든다. 이후 모든load_flights_rolling()호출에airport_map=파라미터로 주입하면 어떤 윈도우를 쓰더라도 ATL=0, DTW=1, MSP=2가 항상 보장된다.4. load_flights() 자체의 airport_map 버그
기존 문제점
load_flights(limit=50)과load_flights(limit=200)이 서로 다른 airport_map을 생성한다. 학습에limit=200, 평가에limit=50을 쓰면 공항 ID가 달라져 embedding이 완전히 다른 공항을 가리킨다.수정
df.head(limit)이전에 전체 df 기준으로 airport_map을 먼저 계산한다.5. bases_to_ids() 추가 — crew base 명시적 입력
기존 문제
기존코드에서는 빈도 기반으로 자동 계산(
get_bases())하거나base_airport=0을 고정으로 썼다. 이를 crew base가 어디인지 외부에서 명시적으로 입력받도록 수정.수정
build_airport_map()으로 만든 전체 CSV 기준 맵을 통해 문자열 코드를 정수 ID로 변환한다. 없는 코드가 있으면 즉시 오류를 발생시켜 잘못된 base 입력을 조기에 감지한다.get_bases(flights, n_bases)함수는 유지했고, 주 파이프라인에서는bases_to_ids()를 통한 명시적 입력이 우선되도록 하였다.