|
a |
|
b/matrix.py |
|
|
1 |
# -*- coding: utf-8 -*- |
|
|
2 |
"""matrix.ipynb |
|
|
3 |
** |
|
|
4 |
* This file is part of Hybrid CNN-LSTM for COVID-19 Severity Score Prediction paper. |
|
|
5 |
* |
|
|
6 |
* Written by Ankan Ghosh Dastider and Farhan Sadik. |
|
|
7 |
* |
|
|
8 |
* Copyright (c) by the authors under Apache-2.0 License. Some rights reserved, see LICENSE. |
|
|
9 |
*/ |
|
|
10 |
|
|
|
11 |
""" |
|
|
12 |
model = load_model('') #Link CNN model weight directory |
|
|
13 |
final_loss, final_accuracy = model.evaluate(Final_X, Y_train) |
|
|
14 |
print('Final Loss: {}, Final Accuracy: {}'.format(final_loss, final_accuracy)) |
|
|
15 |
|
|
|
16 |
Y_pred = model.predict(X_Train) |
|
|
17 |
|
|
|
18 |
Y_pred = np.argmax(Y_pred, axis=1) |
|
|
19 |
Y_true = np.argmax(Y_train, axis=1) |
|
|
20 |
|
|
|
21 |
cm = confusion_matrix(Y_true, Y_pred) |
|
|
22 |
plt.figure(figsize=(12, 12)) |
|
|
23 |
ax = sns.heatmap(cm, cmap=plt.cm.Greens, annot=True, square=True, xticklabels=disease_types, yticklabels=disease_types) |
|
|
24 |
ax.set_ylabel('Actual', fontsize=40) |
|
|
25 |
ax.set_xlabel('Predicted', fontsize=40) |
|
|
26 |
|