Commit
•
045a182
1
Parent(s):
e29ab28
Set model name in to_dataframe_all
Browse files
app.py
CHANGED
@@ -52,11 +52,10 @@ def load_data(result_path) -> pd.DataFrame:
|
|
52 |
def load_result(model_id):
|
53 |
result_path = get_result_path_from_model(model_id, latest_result_path_per_model)
|
54 |
data = load_data(result_path)
|
55 |
-
model_name = data.get("model_name", "Model")
|
56 |
df = to_dataframe_all(data)
|
57 |
result = [
|
58 |
-
to_vertical(df
|
59 |
-
to_vertical(to_dataframe_results(df)
|
60 |
]
|
61 |
return result
|
62 |
|
@@ -65,8 +64,9 @@ def to_dataframe(data):
|
|
65 |
return pd.DataFrame.from_records([data])
|
66 |
|
67 |
|
68 |
-
def to_vertical(df
|
69 |
-
df = df.iloc[0].rename_axis("Parameters").rename(model_name).to_frame() # .reset_index()
|
|
|
70 |
df.index = df.index.str.join(".")
|
71 |
return df
|
72 |
|
@@ -75,6 +75,7 @@ def to_dataframe_all(data):
|
|
75 |
df = pd.json_normalize([{key: value for key, value in data.items() if key not in EXCLUDED_KEYS}])
|
76 |
# df.columns = df.columns.str.split(".") # .split return a list instead of a tuple
|
77 |
df.columns = list(map(lambda x: tuple(x.split(".")), df.columns))
|
|
|
78 |
return df
|
79 |
|
80 |
#
|
|
|
52 |
def load_result(model_id):
|
53 |
result_path = get_result_path_from_model(model_id, latest_result_path_per_model)
|
54 |
data = load_data(result_path)
|
|
|
55 |
df = to_dataframe_all(data)
|
56 |
result = [
|
57 |
+
to_vertical(df),
|
58 |
+
to_vertical(to_dataframe_results(df))
|
59 |
]
|
60 |
return result
|
61 |
|
|
|
64 |
return pd.DataFrame.from_records([data])
|
65 |
|
66 |
|
67 |
+
def to_vertical(df):
|
68 |
+
# df = df.iloc[0].rename_axis("Parameters").rename(model_name).to_frame() # .reset_index()
|
69 |
+
df = df.iloc[0].rename_axis("Parameters").to_frame() # .reset_index()
|
70 |
df.index = df.index.str.join(".")
|
71 |
return df
|
72 |
|
|
|
75 |
df = pd.json_normalize([{key: value for key, value in data.items() if key not in EXCLUDED_KEYS}])
|
76 |
# df.columns = df.columns.str.split(".") # .split return a list instead of a tuple
|
77 |
df.columns = list(map(lambda x: tuple(x.split(".")), df.columns))
|
78 |
+
df.index = [data.get("model_name", "Model")]
|
79 |
return df
|
80 |
|
81 |
#
|