Spaces:
Running
Running
update model config and number display
Browse files- results/auto_arima/config.json +1 -1
- results/auto_ets/config.json +1 -1
- results/auto_theta/config.json +1 -1
- src/utils.py +13 -1
results/auto_arima/config.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
{
|
2 |
"model": "auto_arima",
|
3 |
-
"model_type": "
|
4 |
"model_dtype": "float32"
|
5 |
}
|
|
|
1 |
{
|
2 |
"model": "auto_arima",
|
3 |
+
"model_type": "statistical",
|
4 |
"model_dtype": "float32"
|
5 |
}
|
results/auto_ets/config.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
{
|
2 |
"model": "auto_ets",
|
3 |
-
"model_type": "
|
4 |
"model_dtype": "float32"
|
5 |
}
|
|
|
1 |
{
|
2 |
"model": "auto_ets",
|
3 |
+
"model_type": "statistical",
|
4 |
"model_dtype": "float32"
|
5 |
}
|
results/auto_theta/config.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
{
|
2 |
"model": "auto_theta",
|
3 |
-
"model_type": "
|
4 |
"model_dtype": "float32"
|
5 |
}
|
|
|
1 |
{
|
2 |
"model": "auto_theta",
|
3 |
+
"model_type": "statistical",
|
4 |
"model_dtype": "float32"
|
5 |
}
|
src/utils.py
CHANGED
@@ -2,6 +2,17 @@ import pandas as pd
|
|
2 |
import os
|
3 |
import re
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
def norm_sNavie(df):
|
6 |
df_normalized = df.copy()
|
7 |
seasonal_naive_row = df[df['model'] == 'seasonal_naive'].iloc[0]
|
@@ -47,7 +58,8 @@ def pivot_existed_df(df, tab_name):
|
|
47 |
df_pivot = df_melted.pivot_table(index='model', columns=[tab_name, 'metric'], values='value')
|
48 |
df_pivot.columns = [f'{tab_name} ({metric})' for tab_name, metric in df_pivot.columns]
|
49 |
df_pivot = df_pivot.reset_index()
|
50 |
-
df_pivot = df_pivot.round(3)
|
|
|
51 |
return df_pivot
|
52 |
|
53 |
|
|
|
2 |
import os
|
3 |
import re
|
4 |
|
5 |
+
# Define the formatting function
|
6 |
+
def format_number(num):
|
7 |
+
# Check if the value is numeric
|
8 |
+
if isinstance(num, (int, float)):
|
9 |
+
if abs(num) >= 10**2:
|
10 |
+
return f"{num:.1e}"
|
11 |
+
else:
|
12 |
+
return f"{num:.3f}"
|
13 |
+
# Return non-numeric values as-is
|
14 |
+
return num
|
15 |
+
|
16 |
def norm_sNavie(df):
|
17 |
df_normalized = df.copy()
|
18 |
seasonal_naive_row = df[df['model'] == 'seasonal_naive'].iloc[0]
|
|
|
58 |
df_pivot = df_melted.pivot_table(index='model', columns=[tab_name, 'metric'], values='value')
|
59 |
df_pivot.columns = [f'{tab_name} ({metric})' for tab_name, metric in df_pivot.columns]
|
60 |
df_pivot = df_pivot.reset_index()
|
61 |
+
# df_pivot = df_pivot.round(3)
|
62 |
+
df_pivot = df_pivot.applymap(format_number)
|
63 |
return df_pivot
|
64 |
|
65 |
|