예측 탭의 구현을 완성합니다. - #13
Merged
Merged
Conversation
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.
Situation
예측 탭은 원래 CoreML 기반 온디바이스 학습 모델을 사용자가 직접 생성/교체/삭제하는 구조로 설계되어 있었습니다. 하지만 CoreML 도입 과정에서 iOS에서 실제로 사용 가능한 학습 방식(Updatable Neural Network)이 Python 도구 체인을 필요로 하는 등 프로젝트 규모에 비해 과도하게 무거워졌고, 실제 구현해보니 데이터가 적은 가계부 특성상 정확도가 불안정했습니다. 또한 카테고리별 예측 차트에서 막대가 왜곡되어 그려지거나 겹쳐 보이는 등 여러 렌더링 버그가 있었고, 설정탭에는 데이터를 초기화할 방법이 없었습니다.
Task
Action
Prediction네이밍으로 통일, 인사이트(이상지출/예고/미기록 감지) 기능도 함께 제거PredictionStrategy프로토콜과 다중 구현체 구조를 걷어내고, 통계 계산만 담당하는StatisticsPredictor구체 클래스로 단순화PredictionModel이 계산 결과(dailyPredictions/categoryPredictions)를 직접 저장하고,recalculate()하나로 생성과 갱신을 모두 처리predictDaily의 기준을weekOfMonth(매달 경계가 흔들리는 값)에서dayOfMonth(정기결제 패턴) +weekday(습관성 소비 패턴)로 교체하고, 표본 수·변동계수 검증을 추가해 1회성 우연한 지출을 패턴으로 오인하지 않도록 함CategoryPredictionCardView의BarMark렌더링 로직을 세 차례 반복 검증하며 수정: 고정 최소 길이(1000)로 인한 비율 왜곡 제거, 0원 예측값의 막대/라벨이 실제 막대와 겹쳐 보이던 문제 수정, 값이 전혀 없는 카테고리가 빈 행으로 노출되던 문제 수정ExpenseRepositoryProtocol.deleteAll()/PredictionRepositoryProtocol.deleteModel()을 새로 정의해 지출·카테고리·예측을 한 번에 초기화하도록 연결PredictionModel스키마 변경 시 SwiftData 마이그레이션이 조용히 실패해 데이터가 유실되는 위험을 인지할 수 있도록SceneDelegate에 로깅 추가Result