Commit
·
5c6559f
1
Parent(s):
6055912
Update chronos-2 link
Browse files- src/utils.py +7 -24
src/utils.py
CHANGED
|
@@ -36,12 +36,7 @@ MODEL_CONFIG = {
|
|
| 36 |
"chronos_bolt_small": ("amazon/chronos-bolt-small", "AWS", True, "DL"),
|
| 37 |
"chronos_bolt_base": ("amazon/chronos-bolt-base", "AWS", True, "DL"),
|
| 38 |
"chronos-bolt": ("amazon/chronos-bolt-base", "AWS", True, "DL"),
|
| 39 |
-
"chronos-2": (
|
| 40 |
-
"https://github.com/amazon-science/chronos-forecasting",
|
| 41 |
-
"AWS",
|
| 42 |
-
True,
|
| 43 |
-
"DL",
|
| 44 |
-
),
|
| 45 |
# Moirai Models
|
| 46 |
"moirai_large": ("Salesforce/moirai-1.1-R-large", "Salesforce", True, "DL"),
|
| 47 |
"moirai_base": ("Salesforce/moirai-1.1-R-base", "Salesforce", True, "DL"),
|
|
@@ -146,9 +141,7 @@ def format_leaderboard(df: pd.DataFrame):
|
|
| 146 |
df["zero_shot"] = df["model_name"].apply(get_zero_shot_status)
|
| 147 |
# Format leakage column: convert to int for all models, 0 for non-zero-shot
|
| 148 |
df["training_corpus_overlap"] = df.apply(
|
| 149 |
-
lambda row: int(round(row["training_corpus_overlap"] * 100))
|
| 150 |
-
if row["zero_shot"] == "✓"
|
| 151 |
-
else 0,
|
| 152 |
axis=1,
|
| 153 |
)
|
| 154 |
df["link"] = df["model_name"].apply(get_model_link)
|
|
@@ -170,9 +163,7 @@ def format_leaderboard(df: pd.DataFrame):
|
|
| 170 |
df.style.map(highlight_model_type_color, subset=["model_name"])
|
| 171 |
.map(lambda x: "font-weight: bold", subset=["zero_shot"])
|
| 172 |
.apply(
|
| 173 |
-
lambda x: [
|
| 174 |
-
"background-color: #f8f9fa" if i % 2 == 1 else "" for i in range(len(x))
|
| 175 |
-
],
|
| 176 |
axis=0,
|
| 177 |
)
|
| 178 |
)
|
|
@@ -237,9 +228,7 @@ def construct_pairwise_chart(df: pd.DataFrame, col: str, metric_name: str):
|
|
| 237 |
for c in [col, f"{col}_lower", f"{col}_upper"]:
|
| 238 |
df[c] *= 100
|
| 239 |
|
| 240 |
-
model_order = (
|
| 241 |
-
df.groupby("model_1")[col].mean().sort_values(ascending=False).index.tolist()
|
| 242 |
-
)
|
| 243 |
|
| 244 |
tooltip = [
|
| 245 |
alt.Tooltip("model_1:N", title="Model 1"),
|
|
@@ -297,9 +286,7 @@ def construct_pairwise_chart(df: pd.DataFrame, col: str, metric_name: str):
|
|
| 297 |
)
|
| 298 |
|
| 299 |
|
| 300 |
-
def construct_pivot_table_from_df(
|
| 301 |
-
errors: pd.DataFrame, metric_name: str
|
| 302 |
-
) -> pd.io.formats.style.Styler:
|
| 303 |
"""Construct styled pivot table from precomputed DataFrame."""
|
| 304 |
|
| 305 |
def highlight_by_position(styler):
|
|
@@ -333,9 +320,7 @@ def construct_pivot_table(
|
|
| 333 |
baseline_model: str,
|
| 334 |
leakage_imputation_model: str,
|
| 335 |
) -> pd.io.formats.style.Styler:
|
| 336 |
-
errors = fev.pivot_table(
|
| 337 |
-
summaries=summaries, metric_column=metric_name, task_columns=["task_name"]
|
| 338 |
-
)
|
| 339 |
train_overlap = (
|
| 340 |
fev.pivot_table(
|
| 341 |
summaries=summaries,
|
|
@@ -376,9 +361,7 @@ def construct_pivot_table(
|
|
| 376 |
style_parts.append(f"color: {COLORS['leakage_impute']}")
|
| 377 |
elif is_imputed_baseline.loc[row_idx, col_idx]:
|
| 378 |
style_parts.append(f"color: {COLORS['failure_impute']}")
|
| 379 |
-
elif not style_parts or (
|
| 380 |
-
len(style_parts) == 1 and "font-weight" in style_parts[0]
|
| 381 |
-
):
|
| 382 |
style_parts.append(f"color: {COLORS['text_default']}")
|
| 383 |
|
| 384 |
if style_parts:
|
|
|
|
| 36 |
"chronos_bolt_small": ("amazon/chronos-bolt-small", "AWS", True, "DL"),
|
| 37 |
"chronos_bolt_base": ("amazon/chronos-bolt-base", "AWS", True, "DL"),
|
| 38 |
"chronos-bolt": ("amazon/chronos-bolt-base", "AWS", True, "DL"),
|
| 39 |
+
"chronos-2": ("amazon/chronos-2", "AWS", True, "DL"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
# Moirai Models
|
| 41 |
"moirai_large": ("Salesforce/moirai-1.1-R-large", "Salesforce", True, "DL"),
|
| 42 |
"moirai_base": ("Salesforce/moirai-1.1-R-base", "Salesforce", True, "DL"),
|
|
|
|
| 141 |
df["zero_shot"] = df["model_name"].apply(get_zero_shot_status)
|
| 142 |
# Format leakage column: convert to int for all models, 0 for non-zero-shot
|
| 143 |
df["training_corpus_overlap"] = df.apply(
|
| 144 |
+
lambda row: int(round(row["training_corpus_overlap"] * 100)) if row["zero_shot"] == "✓" else 0,
|
|
|
|
|
|
|
| 145 |
axis=1,
|
| 146 |
)
|
| 147 |
df["link"] = df["model_name"].apply(get_model_link)
|
|
|
|
| 163 |
df.style.map(highlight_model_type_color, subset=["model_name"])
|
| 164 |
.map(lambda x: "font-weight: bold", subset=["zero_shot"])
|
| 165 |
.apply(
|
| 166 |
+
lambda x: ["background-color: #f8f9fa" if i % 2 == 1 else "" for i in range(len(x))],
|
|
|
|
|
|
|
| 167 |
axis=0,
|
| 168 |
)
|
| 169 |
)
|
|
|
|
| 228 |
for c in [col, f"{col}_lower", f"{col}_upper"]:
|
| 229 |
df[c] *= 100
|
| 230 |
|
| 231 |
+
model_order = df.groupby("model_1")[col].mean().sort_values(ascending=False).index.tolist()
|
|
|
|
|
|
|
| 232 |
|
| 233 |
tooltip = [
|
| 234 |
alt.Tooltip("model_1:N", title="Model 1"),
|
|
|
|
| 286 |
)
|
| 287 |
|
| 288 |
|
| 289 |
+
def construct_pivot_table_from_df(errors: pd.DataFrame, metric_name: str) -> pd.io.formats.style.Styler:
|
|
|
|
|
|
|
| 290 |
"""Construct styled pivot table from precomputed DataFrame."""
|
| 291 |
|
| 292 |
def highlight_by_position(styler):
|
|
|
|
| 320 |
baseline_model: str,
|
| 321 |
leakage_imputation_model: str,
|
| 322 |
) -> pd.io.formats.style.Styler:
|
| 323 |
+
errors = fev.pivot_table(summaries=summaries, metric_column=metric_name, task_columns=["task_name"])
|
|
|
|
|
|
|
| 324 |
train_overlap = (
|
| 325 |
fev.pivot_table(
|
| 326 |
summaries=summaries,
|
|
|
|
| 361 |
style_parts.append(f"color: {COLORS['leakage_impute']}")
|
| 362 |
elif is_imputed_baseline.loc[row_idx, col_idx]:
|
| 363 |
style_parts.append(f"color: {COLORS['failure_impute']}")
|
| 364 |
+
elif not style_parts or (len(style_parts) == 1 and "font-weight" in style_parts[0]):
|
|
|
|
|
|
|
| 365 |
style_parts.append(f"color: {COLORS['text_default']}")
|
| 366 |
|
| 367 |
if style_parts:
|