# ============================================================
# 빈집 예측 파이프라인 설정 파일
# ============================================================

# 기본 설정
pipeline:
  name: "빈집 예측 파이프라인"
  version: "1.7"
  
# 경로 설정
paths:
  base_path: "C:/Users/server/Desktop/유틸/vacant_pr/데이터"
  xy_mapper_path: "C:/Users/server/Desktop/유틸/vacant_pr/데이터/매핑/집계구_shp/bnd_oa_00_2024_2Q.shp"
  external_oa_path: "C:/Users/server/Desktop/유틸/vacant_pr/데이터/외부데이터/외부_집계구_v1.csv"
  external_facility_path: "C:/Users/server/Desktop/유틸/vacant_pr/데이터/외부데이터/외부_시설_외국인_기초수급_v1.csv"

# Oracle DB 설정 (MAIN_DATA, ENERGY_DATA)
oracle:
  enable: true
  host: "10.2.14.103"
  port: 1521
  service_name: "KREICDB"
  user: "BIS_WEB"
  password: "Rhdrks12!@"
  # Oracle Instant Client 경로 (Windows)
  client_path: "C:/Program Files/QGIS 3.40.11/bin"
  # 테이블명
  tables:
    main_data: "ML_BIS_WEB_TOT_BLDG_MAIN"
    energy_data: "ENGY_USE_YEAR_PT"

# PostgreSQL DB 설정 (결과 저장)
postgresql:
  enable: true
  host: "10.2.61.197"
  port: 5432
  database: "bts_ai"
  user: "bts_ai"
  password: "reb123!@#"

# Step 1: 데이터 통합 설정
step1:
  distance_threshold_km: 2.0
  remove_unmapped: true
  pu_learning:
    enable: true
    target_vacancy_rate: 0.007  # 한국 빈집률 약 0.7%
    model_type: "lightgbm"

# Step 2: 피처 엔지니어링 설정
step2:
  feature_groups:
    building: true
    land: true
    energy: true
    external_oa: true
    facility: true
  correlation_threshold: 0.99

# Step 3: 클러스터링 설정
step3:
  k_range_min: 2
  k_range_max: 10
  k_final: null  # null이면 자동 선택
  random_state: 42
  clustering_features: null  # null이면 자동 선택

# Step 4: 모델링 설정
step4:
  test_size: 0.2
  random_state: 42
  use_two_stage: true
  top_n_features: 30
  use_gwr: true
  gwr_sample_limit: 10000
  
  # XGBoost 파라미터
  xgboost:
    n_estimators: 300
    max_depth: 7
    learning_rate: 0.05
    subsample: 0.8
    colsample_bytree: 0.8
    min_child_weight: 3
    gamma: 0.1
    reg_alpha: 0.1
    reg_lambda: 1.0
    
  # LightGBM 파라미터
  lightgbm:
    n_estimators: 300
    max_depth: 8
    learning_rate: 0.03
    subsample: 0.8
    colsample_bytree: 0.8
    reg_alpha: 0.1
    reg_lambda: 1.0
    
  # CatBoost 파라미터
  catboost:
    iterations: 300
    depth: 7
    learning_rate: 0.05
    l2_leaf_reg: 3

# Step 5: 앙상블 설정
step5:
  ensemble_method: "weighted_average"
  weights:
    xgboost: 0.3
    lightgbm: 0.35
    catboost: 0.25
    gwr: 0.1
  use_cluster_ensemble: true
  
  # 빈집 인덱스 기준
  index_method: "std_based"  # std_based 또는 quantile_based
  index_levels: 4  # 4단계 (안전, 주의, 경고, 위험)

# 시스템 설정
system:
  n_jobs: -1  # -1이면 모든 CPU 사용
  batch_size_multiplier: 2  # CPU 코어 수 * multiplier
  memory_limit_gb: 200
  checkpoint_enabled: true
  verbose: true
  
# 로깅 설정
logging:
  level: "INFO"
  format: "[%(asctime)s] %(levelname)s - %(message)s"
  file: "logs/pipeline.log"
  
# 출력 설정
output:
  save_parquet: true
  save_csv: true
  save_to_db: true
  sample_csv_rows: 10000  # CSV 샘플 저장 행 수
