I attempted to run a code on both linux and Google Colab. It works fine on the later but throws syntax error on Linux.
auc = roc_auc_score(observed[:,0], predicted[:,0])
tn, fp, fn, tp = confusion_matrix(observed[:,0]>0.5, predicted[:,0]>0.5).ravel()
sen = tn/(tn+fp)
spe = tp/(tp+fn)
acc = (tp+tn)/(tp+tn+fp+fn)
print(f"AUC Sen. Spe. Acc.\n{auc:0.2f} {sen:0.2f} {spe:0.2f} {acc:0.2f}")
Traceback:
~/PathCNN$ python3 PathCNN_GradCAM_modeling.py
File "PathCNN_GradCAM_modeling.py", line 205
print(f"AUC Sen. Spe. Acc.\n{auc:0.2f} {sen:0.2f} {spe:0.2f} {acc:0.2f}")
^
SyntaxError: invalid syntax
The code works fine when I ran it on google colab (https://colab.research.google.com/drive/1WCfguKFN0Zs0ZDkKga2DpDgjBP3PnwB_?usp=sharing).