File size: 3,976 Bytes
4d18cf9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
"""
backend/config.py
─────────────────────────────────────────────
ConfiguraciΓ³n centralizada del backend.
Variables de entorno, paths y constantes.
─────────────────────────────────────────────
"""

import os
from pathlib import Path

# ─────────────────────────────────────────────
# Paths
# ─────────────────────────────────────────────
PROJECT_ROOT = Path(__file__).parent.parent
MODELS_DIR = PROJECT_ROOT / "models"

# Model files
XGBOOST_MODEL_PATH = MODELS_DIR / "xgboost.pkl"
LSTM_MODEL_PATH    = MODELS_DIR / "lstm.pt"
LOGREG_MODEL_PATH  = MODELS_DIR / "logistic_regression.pkl"
SCALER_PATH        = MODELS_DIR / "scaler_lr.pkl"

# ─────────────────────────────────────────────
# Riot API
# ─────────────────────────────────────────────

RIOT_API_KEY: str = os.environ.get("HF_SECRET")

if not RIOT_API_KEY:
    raise ValueError("HF_SECRET no estΓ‘ configurado en el entorno")

# Riot API routing
RIOT_REGION = "americas"  # Regional routing for Match-V5
RIOT_PLATFORM = "na1"     # Platform routing
RIOT_BASE_URL = f"https://{RIOT_REGION}.api.riotgames.com"
RIOT_PLATFORM_URL = f"https://{RIOT_PLATFORM}.api.riotgames.com"

# ─────────────────────────────────────────────
# Model constants (must match training)
# ─────────────────────────────────────────────
LSTM_HIDDEN_DIM = 64
LSTM_DROPOUT = 0.3
LSTM_MAX_SEQ_LEN = 20
SEED = 42

# ─────────────────────────────────────────────
# Feature columns (80 features, exact order from training)
# Excludes: match_id, blue_win
# ─────────────────────────────────────────────
FEATURE_COLUMNS = [
    "minute",
    "blue_totalGold", "red_totalGold", "goldDiff",
    "blue_totalXP", "red_totalXP", "xpDiff",
    "blue_totalLevel", "red_totalLevel", "levelDiff",
    "blue_totalMinions", "red_totalMinions", "minionsDiff",
    "blue_totalDmgChamp", "red_totalDmgChamp", "dmgChampDiff",
    "blue_totalDmgTaken", "red_totalDmgTaken", "dmgTakenDiff",
    "blue_kills", "red_kills", "killsDiff",
    "blue_assists", "red_assists", "assistsDiff",
    "blue_wardsPlaced", "red_wardsPlaced", "wardsPlacedDiff",
    "blue_wardsKilled", "red_wardsKilled", "wardsKilledDiff",
    "blue_dragons", "red_dragons", "dragonsDiff",
    "blue_barons", "red_barons", "baronsDiff",
    "blue_towers", "red_towers", "towersDiff",
    "blue_inhibitors", "red_inhibitors", "inhibitorsDiff",
    "blue_heralds", "red_heralds", "heraldsDiff",
    "blue_grubs", "red_grubs", "grubsDiff",
    "first_blood", "first_tower", "first_dragon", "first_baron",
    "blue_baron_active", "red_baron_active",
    "blue_goldPerMin", "red_goldPerMin", "blue_killsPerMin",
    "gold_ratio", "xp_ratio",
    "blue_kda", "red_kda",
    "goldDiff_3min_delta", "xpDiff_3min_delta", "killsDiff_3min_delta",
    "blue_dragons_weighted", "red_dragons_weighted",
    "blue_gold_share",
    "blue_dmg_efficiency", "red_dmg_efficiency", "dmg_efficiency_diff",
    "blue_obj_conversion", "red_obj_conversion", "obj_conversion_diff",
    "blue_vision_density", "red_vision_density", "vision_density_diff",
    "blue_teamwork_score", "red_teamwork_score", "teamwork_diff",
]