output_confusion_matrix is changed to be a function.

This commit is contained in:
yemaozi88 2018-07-29 17:58:52 +02:00
parent edcbb1139a
commit 9baa0f8641
2 changed files with 24 additions and 24 deletions

View File

@ -9,14 +9,6 @@ from sklearn.metrics import accuracy_score
from sklearn.metrics import confusion_matrix
currDir = 'C:\\Users\\Aki\\source\\repos\\rug_VS\\dialect_identification\\dialect_identification'
sys.path.append(os.path.join(os.path.dirname(sys.path[0]), currDir))
regionLabels = ['Groningen_and_Drenthe', 'Oost_Overijsel-Gelderland', 'Limburg']
regionLabels2 = ['Groningen_and_Drenthe', 'Limburg']
dirOut = currDir + '\\result\\same-utterance_with_cities'
def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
@ -56,6 +48,14 @@ def plot_confusion_matrix(cm, classes,
plt.xlabel('Predicted label', fontsize=_fontsize-4)
if __name__ == "__main__":
currDir = 'C:\\Users\\Aki\\source\\repos\\rug_VS\\dialect_identification\\dialect_identification'
sys.path.append(os.path.join(os.path.dirname(sys.path[0]), currDir))
regionLabels = ['Groningen_and_Drenthe', 'Oost_Overijsel-Gelderland', 'Limburg']
regionLabels2 = ['Groningen_and_Drenthe', 'Limburg']
dirOut = currDir + '\\result\\same-utterance_with_cities'
pred = np.load(dirOut + '\\pred_per_pid_3regions.npy')
#accuracy = accuracy_score(pred[:, 1], pred[:, 2], normalize=True, sample_weight=None)