콘텐츠로 이동

데이터와 학습 파이프라인

ML pipeline의 목적은 notebook을 길게 연결하는 것이 아니라 같은 입력과 설정에서 같은 산출물을 만들고, 실패한 단계만 다시 실행할 수 있게 하는 것입니다.

데이터 계약

학습 전에 최소한 다음 값을 고정합니다.

  • sample과 subject 식별자
  • label의 의미와 허용 값
  • 입력 column, type, nullable 여부
  • source와 수집 시점
  • dataset, feature schema, reference DB version
  • train/validation/test split manifest

schema가 맞지 않으면 자동 보정부터 하지 않고 어떤 계약이 깨졌는지 먼저 기록합니다.

Pipeline 경계

validate input
→ build features
→ validate features
→ split
→ fit preprocessing and model
→ evaluate
→ package artifacts
  • feature filtering, scaling, selection은 train fold 내부에서 학습합니다.
  • 데이터, code, config, container version을 분리해 기록합니다.
  • 각 단계는 다음 단계가 검사할 수 있는 명시적인 산출물을 냅니다.
  • 작은 fixture로 전체 경로를 실행하는 smoke test를 먼저 만듭니다.

산출물 계약

단계 최소 산출물 실패 조건
ingest immutable raw URI, checksum, manifest file 누락, checksum 불일치
validate validation report schema/type/range 위반
feature matrix, feature schema, lineage sample 중복, schema version 불일치
split train/validation/test manifest subject·cohort가 split 사이에 겹침
train config, log, fitted pipeline seed·dependency·input version 누락
evaluate prediction, metric, subgroup report test를 model 선택에 재사용
package model bundle, signature, limitations smoke prediction 실패

데이터가 바뀌었을 때 모든 단계를 다시 실행하는 대신, 입력과 설정의 fingerprint가 같은 완료 artifact를 재사용합니다. cache는 성능 기능이기 전에 lineage가 맞는지 검증하는 경계입니다.

최소 검증

  • manifest의 식별자 uniqueness와 파일 존재 여부
  • label 허용 값과 nullable column
  • train/test의 subject·cohort 교집합이 비어 있는지
  • feature column 순서와 dtype이 model signature와 같은지
  • 작은 fixture가 validate부터 package까지 통과하는지

FunOMIC2 Nextflow Pipeline에서 다룬 module, container, resume 경험을 후속 ML 프로젝트의 feature pipeline에 적용합니다.

참고