Skip to content

Commit

Permalink
Merge pull request #16 from fugue-project/0.0.4.1
Browse files Browse the repository at this point in the history
Fix visualize
  • Loading branch information
goodwanghan authored Jan 7, 2021
2 parents 4c6bda4 + c90c383 commit 1334b62
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions fugue_tune/tune.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,15 +447,21 @@ def outputter(df: LocalDataFrame) -> None:
]

def show(subdf: pd.DataFrame) -> None:
if subdf.shape[0] == 0:
return
subdf = subdf.sort_values("__fmin_value__").head(top)
title = ", ".join(str(subdf[k][0]) for k in keys) if len(keys) > 0 else ""
title = (
json.dumps({k: str(subdf[k].iloc[0]) for k in keys})
if len(keys) > 0
else ""
)
pdf = pd.DataFrame([json.loads(x) for x in subdf["__fmin_params__"]])
fig = plt.figure(figsize=(12, 3 * len(pdf.columns)))
if len(keys) > 0:
fig.suptitle(
title,
va="center",
size=20,
size=15,
weight="bold",
y=0.93,
)
Expand Down
1 change: 1 addition & 0 deletions tests/fugue_tune/test_sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def test_suggest_sk_model(tmpdir):
feature_prefix="f_",
save_model=True,
partition_keys=["p"],
visualize_top_n=2,
)
assert len(res) == 4
print(res)
Expand Down

0 comments on commit 1334b62

Please sign in to comment.