fix: canonicalize score brackets and assessments
This commit is contained in:
+4
-9
@@ -26,6 +26,8 @@ from sklearn.metrics import (
|
||||
from sklearn.model_selection import TimeSeriesSplit
|
||||
from sklearn.preprocessing import StandardScaler
|
||||
|
||||
from scoring.policy import SCORE_BRACKETS, score_in_bracket
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s [%(name)s] %(levelname)s: %(message)s",
|
||||
@@ -117,14 +119,7 @@ INTERACTION_FEATURES = ["mvrv_x_nupl", "puell_x_reserve"]
|
||||
CYCLE_FEATURES = ["days_since_ath"]
|
||||
FEATURE_COLS = SCORE_FEATURES + RAW_FEATURES + DELTA_FEATURES + INTERACTION_FEATURES + CYCLE_FEATURES
|
||||
|
||||
BRACKETS = [
|
||||
(0, 20, "Extreme Caution"),
|
||||
(21, 40, "Caution"),
|
||||
(41, 55, "Neutral"),
|
||||
(56, 70, "Moderate Opportunity"),
|
||||
(71, 85, "Strong Accumulation"),
|
||||
(86, 100, "Extreme Accumulation"),
|
||||
]
|
||||
BRACKETS = SCORE_BRACKETS
|
||||
|
||||
|
||||
def _row_date(row):
|
||||
@@ -526,7 +521,7 @@ def _composite_score(row, mode, ml_weights=None):
|
||||
def _summarize_brackets(scored_rows, score_key):
|
||||
results = []
|
||||
for low, high, label in BRACKETS:
|
||||
days_in = [r for r in scored_rows if low <= r[score_key] <= high]
|
||||
days_in = [r for r in scored_rows if score_in_bracket(r[score_key], (low, high, label))]
|
||||
if not days_in:
|
||||
results.append({
|
||||
"range": f"{low}-{high}", "label": label,
|
||||
|
||||
Reference in New Issue
Block a user