Skip to content

20260313 # 306 워치리스트 기능 개선#337

Merged
twq110 merged 7 commits intomainfrom
20260313-#-306-워치리스트-기능-개선
Mar 26, 2026

Hidden character warning

The head ref may contain hidden characters: "20260313-#-306-\uc6cc\uce58\ub9ac\uc2a4\ud2b8-\uae30\ub2a5-\uac1c\uc120"
Merged

20260313 # 306 워치리스트 기능 개선#337
twq110 merged 7 commits intomainfrom
20260313-#-306-워치리스트-기능-개선

Conversation

@twq110
Copy link
Contributor

@twq110 twq110 commented Mar 26, 2026

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • PatchTST 모델에 향상된 훈련 및 예측 인터페이스 추가
    • iTransformer 모델 훈련을 위한 커맨드라인 인터페이스(CLI) 지원 추가
  • 개선

    • 모델 저장 및 로드 메커니즘 개선
    • 훈련 구성 단순화 및 최적화
    • 모델 디바이스 처리 강화

@twq110 twq110 requested a review from discipline24 as a code owner March 26, 2026 05:36
@twq110 twq110 merged commit abd0d5a into main Mar 26, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 26, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 069fafe6-cfc6-46d4-824e-fe6ce7cb96cd

📥 Commits

Reviewing files that changed from the base of the PR and between c079e08 and 6738658.

📒 Files selected for processing (5)
  • .gitignore
  • AI/modules/signal/models/PatchTST/train.py
  • AI/modules/signal/models/PatchTST/wrapper.py
  • AI/modules/signal/models/itransformer/train.py
  • AI/modules/signal/models/itransformer/wrapper.py

Walkthrough

PatchTST 및 ITransformer 모델의 훈련 및 추론 API를 재설계하여 설정 기반 접근에서 ndarray 중심 인터페이스로 전환했습니다. 새 run_training() 진입점, 제거된 스케일러 직렬화, 그리고 단순화된 모델 저장/로드 메커니즘을 도입했습니다.

Changes

Cohort / File(s) Summary
Build Configuration
.gitignore
.gitignore에서 빈 줄 제거 (패턴 변경 없음).
PatchTST Training API
AI/modules/signal/models/PatchTST/train.py
설정 단순화 (학습 관련 필드 제거, input_features, batch_size, learning_rate, patience 추가), 새 _default_model_save_path() 헬퍼 추가, 외부 run_training(X_train, y_train, X_val, y_val) 진입점 추가, 스케일러 저장 블록 제거. 병합 충돌 마커(<<<<<<< HEAD 등) 포함.
PatchTST Wrapper Refactoring
AI/modules/signal/models/PatchTST/wrapper.py
클래스 전체 재구현: ndarray 기반 train(), predict() 메서드 추가, DataFrame 로직 제거, get_signals() 메서드 추가, 상태 사전만 저장하는 save()/load() 변경. 병합 충돌 마커 포함.
ITransformer Training Enhancement
AI/modules/signal/models/itransformer/train.py
CLI 인자 파싱(--save-dir, --artifact-mode) 추가, _resolve_itransformer_artifacts() 도입으로 아티팩트 경로 집중화, 스케일러 직렬화를 NumPy .npz에서 pickle로 변경, save_training_metadata() 서명 수정.
ITransformer Wrapper Modernization
AI/modules/signal/models/itransformer/wrapper.py
클래스명 ITransformerSignalModelITransformerWrapper (별칭 유지), ndarray 입력 강제화, _normalize_input_array() 추가, pickle 기반 스케일러 로딩, resolve_model_artifacts() 활용, predict() 서명 단순화 (ticker_id/sector_id 정수형), get_signals() 직렬화 방식 변경.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant PatchTST_train
    participant DataLoader
    participant Model
    participant Device

    Client->>PatchTST_train: run_training(X_train, y_train, X_val, y_val)
    PatchTST_train->>DataLoader: TensorDataset(X_train, y_train) → DataLoader
    PatchTST_train->>Device: Select CUDA/CPU device
    PatchTST_train->>Model: train_model(train_loader, val_loader)
    Model->>Model: Train epochs with batch_size
    Model-->>Client: Return trained model

    participant Wrapper
    Client->>Wrapper: predict(X_input: ndarray)
    Wrapper->>Model: Forward pass
    Model->>Wrapper: Sigmoid probabilities
    Wrapper-->>Client: Return ndarray

    Client->>Wrapper: get_signals(df)
    Wrapper->>Wrapper: Validate & prepare window
    Wrapper->>Wrapper: predict() → score
    Wrapper-->>Client: Return {patchtst_1d: score}
Loading
sequenceDiagram
    participant CLI
    participant train_single_pipeline
    participant ArtifactResolver
    participant TrainingPipeline
    participant Serializer

    CLI->>train_single_pipeline: --save-dir=X --artifact-mode=prod
    train_single_pipeline->>ArtifactResolver: _resolve_itransformer_artifacts(save_dir, artifact_mode)
    ArtifactResolver->>ArtifactResolver: Load trading_config if no save_dir
    ArtifactResolver-->>train_single_pipeline: (weights_dir, scaler_path, metadata_path, ...)
    train_single_pipeline->>TrainingPipeline: train_single_pipeline(resolved paths)
    TrainingPipeline->>TrainingPipeline: Train model
    TrainingPipeline->>Serializer: pickle.dump(scaler) to scaler_path
    Serializer-->>TrainingPipeline: ✓
    TrainingPipeline->>Serializer: save_training_metadata(metadata_path)
    Serializer-->>CLI: Training complete
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

Suggested labels

AI

Suggested reviewers

  • discipline24
  • Kosw6

Poem

🐰 모델의 옷을 갈아입다
Tensor를 품에 안으니 반갑고,
Scaler는 pickle 항아리에 담겨,
새로운 흐름이 춤을 춘다네.
훈련과 예측, 단순하고 맑으니—
하이브리드 대신 순수함을 택하다! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 20260313-#-306-워치리스트-기능-개선

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant