Commit 4bda1a62 authored by Marcel Henrik Schubert's avatar Marcel Henrik Schubert
Browse files

fix error

parent 5bf9a3a7
......@@ -87,7 +87,7 @@ cmap = cl.LinearSegmentedColormap.from_list("", ["skyblue","cadetblue","darkblue
def identity_tokenizer(text):
return text
def plot_confusion_matrix(cm, classes,normalize=True,title='Confusion matrix',cmap=plt.cm.Blues, ax = None, fig = None):
def plot_confusion_matrix(cm, classes,normalize=True,title='Confusion matrix',cmap=plt.cm.Blues, ax = None):
"""
This function prints and plots the confusion matrix.
Normalization can be applied by setting `normalize=True`.
......@@ -137,7 +137,7 @@ def plot_confusion_matrix(cm, classes,normalize=True,title='Confusion matrix',cm
color="white" if cm[i, j] > thresh else "black")
return fig, ax
# Start with analysis of precision and recall as well as heatmaps/confusion matrices:
......@@ -604,7 +604,7 @@ def plotter(subsets, subana, phases, labels):
labels=phases)
f = plt.figure()
ax = f.subplots()
f, ax = plot_confusion_matrix(cnf_matrix, classes=phases,title=None, ax=ax, fig = f)
plot_confusion_matrix(cnf_matrix, classes=phases,title=None, ax=ax)
plt.tight_layout()
#plt.show()
#f.savefig('../Data/results/heatmaps/test.png')
......@@ -654,7 +654,7 @@ def plotter(subsets, subana, phases, labels):
life_ph_pred_auth,
labels=phases)
f = plt.figure()
f, ax = plot_confusion_matrix(cnf_matrix, classes=phases,title=None, ax=ax, fig = f)
plot_confusion_matrix(cnf_matrix, classes=phases,title=None, ax=ax)
plt.tight_layout()
f.savefig(savedir+'heatmaps/cm_{st}_{an}_{label}_{group}.png'.format(st = st, an=an,
label=label,
......@@ -680,7 +680,7 @@ def plotter(subsets, subana, phases, labels):
gen_pred_auth,
labels=['female', 'male'])
f = plt.figure()
f, ax = plot_confusion_matrix(cnf_matrix, classes=['female', 'male'],title=None)
plot_confusion_matrix(cnf_matrix, classes=['female', 'male'],title=None)
plt.tight_layout()
f.savefig(savedir+'heatmaps/cm_{st}_{an}_{label}_{group}.png'.format(st = st, an=an,
label=label,
......@@ -692,7 +692,7 @@ def plotter(subsets, subana, phases, labels):
life_ph_pred_auth_wrong,
labels=phases)
f = plt.figure()
f, ax = plot_confusion_matrix(cnf_matrix, classes=phases,title=None, ax=ax, fig = f)
plot_confusion_matrix(cnf_matrix, classes=phases,title=None, ax=ax)
plt.tight_layout()
f.savefig(savedir+'heatmaps/cm_{st}_{an}_{label}_{group}_false.png'.format(st = st, an=an,
label=label,
......@@ -703,7 +703,7 @@ def plotter(subsets, subana, phases, labels):
gen_pred_auth_wrong,
labels=['female', 'male'])
f = plt.figure()
f, ax = plot_confusion_matrix(cnf_matrix, classes=['female', 'male'],title=None, ax=ax, fig = f)
plot_confusion_matrix(cnf_matrix, classes=['female', 'male'],title=None, ax=ax)
plt.tight_layout()
f.savefig(savedir+'heatmaps/cm_{st}_{an}_{label}_{group}_false.png'.format(st = st, an=an,
label=label,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment