Skip to content

Commit

Permalink
fix vis
Browse files Browse the repository at this point in the history
  • Loading branch information
cgsdfc committed Mar 6, 2023
1 parent 9110131 commit 4361934
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/OutlierDetect.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def dis2real(self, dis: str):
return self.display2real.get(dis, dis)


MODEL_ZOO = ModelZoo(AutoEncoder="MVC")
MODEL_ZOO = ModelZoo()


@dataclass
Expand Down Expand Up @@ -391,7 +391,7 @@ def _add_sub_plot(
)

# plot ground truth vs. predicted results
fig = plt.figure(figsize=(10, 8))
fig = plt.figure(figsize=(8, 4))
# plt.suptitle("Demo of {clf_name} Detector".format(clf_name=clf_name), fontsize=15)

fig.add_subplot(221)
Expand Down Expand Up @@ -432,7 +432,7 @@ def _add_sub_plot(
plt.tight_layout()

if save_figure:
plt.savefig("{clf_name}.png".format(clf_name=clf_name), dpi=300)
plt.savefig("{clf_name}.png".format(clf_name=clf_name), dpi=600)

if show_figure:
plt.show()
Expand Down Expand Up @@ -478,13 +478,15 @@ def visualize(self, parent: P = None):
parent = ensure_dir(parent.absolute())

import os
import multiprocessing

temp = P.cwd()
os.chdir(parent)
clf_name, data, res = self.model.name, self.data, self.result
# from pyod.utils.example import visualize
Parallel(2)(
delayed(visualize)(

p = multiprocessing.Process(
target=visualize,
kwargs=dict(
clf_name=clf_name,
show_figure=False,
save_figure=True,
Expand All @@ -494,9 +496,11 @@ def visualize(self, parent: P = None):
y_test=data.y_test,
y_train_pred=res.y_train_pred,
y_test_pred=res.y_test_pred,
)
for _ in range(1)
),
)
p.start()
p.join()

os.chdir(temp)
image = parent.joinpath(f"{clf_name}.png")
return image
Expand Down

0 comments on commit 4361934

Please sign in to comment.