Skip to content
Snippets Groups Projects
Commit 66f4a1ab authored by Baptiste Bauvin's avatar Baptiste Bauvin
Browse files

Corrected image generation

parent 647f3189
No related branches found
No related tags found
No related merge requests found
Pipeline #3569 passed
File deleted
File deleted
File deleted
...@@ -415,10 +415,11 @@ def publish2Dplot(data, classifiers_names, nbClassifiers, nbExamples, nbCopies, ...@@ -415,10 +415,11 @@ def publish2Dplot(data, classifiers_names, nbClassifiers, nbExamples, nbCopies,
""" """
figWidth = max(nbClassifiers / width_denominator, minSize) figWidth = max(nbClassifiers / width_denominator, minSize)
figHeight = max(nbExamples / height_denominator, minSize) figHeight = max(nbExamples / height_denominator, minSize)
print(figHeight, figWidth, nbClassifiers, nbExamples)
figKW = {"figsize": (figWidth, figHeight)} figKW = {"figsize": (figWidth, figHeight)}
fig, ax = plt.subplots(nrows=1, ncols=1, **figKW) fig, ax = plt.subplots(nrows=1, ncols=1,)# **figKW)
cmap, norm = iterCmap(stats_iter) cmap, norm = iterCmap(stats_iter)
cax = plt.imshow(data, interpolation='none', cmap=cmap, norm=norm, cax = plt.imshow(data, cmap=cmap, norm=norm,
aspect='auto') aspect='auto')
plt.title('Errors depending on the classifier') plt.title('Errors depending on the classifier')
ticks = np.arange(nbCopies / 2 - 0.5, nbClassifiers * nbCopies, nbCopies) ticks = np.arange(nbCopies / 2 - 0.5, nbClassifiers * nbCopies, nbCopies)
...@@ -426,7 +427,8 @@ def publish2Dplot(data, classifiers_names, nbClassifiers, nbExamples, nbCopies, ...@@ -426,7 +427,8 @@ def publish2Dplot(data, classifiers_names, nbClassifiers, nbExamples, nbCopies,
plt.xticks(ticks, labels, rotation="vertical") plt.xticks(ticks, labels, rotation="vertical")
cbar = fig.colorbar(cax, ticks=[-100 * stats_iter / 2, 0, stats_iter]) cbar = fig.colorbar(cax, ticks=[-100 * stats_iter / 2, 0, stats_iter])
cbar.ax.set_yticklabels(['Unseen', 'Always Wrong', 'Always Right']) cbar.ax.set_yticklabels(['Unseen', 'Always Wrong', 'Always Right'])
fig.tight_layout() # fig.tight_layout()
fig.savefig(fileName + "error_analysis_2D.png", bbox_inches="tight", transparent=True) fig.savefig(fileName + "error_analysis_2D.png", bbox_inches="tight", transparent=True)
plt.close() plt.close()
......
...@@ -36,13 +36,13 @@ def get_plausible_db_hdf5(features, path, file_name, nb_class=3, ...@@ -36,13 +36,13 @@ def get_plausible_db_hdf5(features, path, file_name, nb_class=3,
label_names=["No".encode(), "Yes".encode(), label_names=["No".encode(), "Yes".encode(),
"Maybe".encode()], "Maybe".encode()],
random_state=None, full=True, add_noise=False, random_state=None, full=True, add_noise=False,
noise_std=0.15, nb_view=3, nb_examples=100, noise_std=0.15, nb_view=3, nb_examples=5000,
nb_features=10): nb_features=10):
"""Used to generate a plausible dataset to test the algorithms""" """Used to generate a plausible dataset to test the algorithms"""
if not os.path.exists(os.path.dirname(path + "Plausible.hdf5")): if not os.path.exists(os.path.dirname(path + "plausible.hdf5")):
try: try:
os.makedirs(os.path.dirname(path + "Plausible.hdf5")) os.makedirs(os.path.dirname(path + "plausible.hdf5"))
except OSError as exc: except OSError as exc:
if exc.errno != errno.EEXIST: if exc.errno != errno.EEXIST:
raise raise
...@@ -76,10 +76,10 @@ def get_plausible_db_hdf5(features, path, file_name, nb_class=3, ...@@ -76,10 +76,10 @@ def get_plausible_db_hdf5(features, path, file_name, nb_class=3,
dataset = Dataset(views=views, labels=labels, dataset = Dataset(views=views, labels=labels,
labels_names=label_names, view_names=view_names, labels_names=label_names, view_names=view_names,
are_sparse=are_sparse, file_name="Plausible.hdf5", are_sparse=are_sparse, file_name="plausible.hdf5",
path=path) path=path)
labels_dictionary = {0: "No", 1: "Yes"} labels_dictionary = {0: "No", 1: "Yes"}
return dataset, labels_dictionary, "Plausible" return dataset, labels_dictionary, "plausible"
elif nb_class >= 3: elif nb_class >= 3:
firstBound = int(nb_examples / 3) firstBound = int(nb_examples / 3)
rest = nb_examples - 2 * int(nb_examples / 3) rest = nb_examples - 2 * int(nb_examples / 3)
...@@ -115,10 +115,10 @@ def get_plausible_db_hdf5(features, path, file_name, nb_class=3, ...@@ -115,10 +115,10 @@ def get_plausible_db_hdf5(features, path, file_name, nb_class=3,
dataset = Dataset(views=views, labels=labels, dataset = Dataset(views=views, labels=labels,
labels_names=label_names, view_names=view_names, labels_names=label_names, view_names=view_names,
are_sparse=are_sparse, are_sparse=are_sparse,
file_name="Plausible.hdf5", file_name="plausible.hdf5",
path=path) path=path)
labels_dictionary = {0: "No", 1: "Yes", 2: "Maybe"} labels_dictionary = {0: "No", 1: "Yes", 2: "Maybe"}
return dataset, labels_dictionary, "Plausible" return dataset, labels_dictionary, "plausible"
class DatasetError(Exception): class DatasetError(Exception):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment