In [1]:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
In [2]:
sns.set_context('poster')
sns.set(font_scale=1.3)
In [3]:
list_factors = [
'empo_1',
'empo_2',
'empo_3',
'env_feature',
'env_material',
'envo_biome_1',
'envo_biome_2',
'envo_biome_3']
In [4]:
def plot_cm(path_in, path_out, factor):
plt.figure()
df = pd.read_csv(path_in % factor, sep='\t', index_col=0)
df.dropna(inplace=True)
df = df*100
sns.heatmap(df, cmap='Blues', annot=True, fmt='.0f')
plt.ylabel('True label')
plt.xlabel('Predicted label')
plt.tight_layout()
plt.savefig(path_out % factor)
In [5]:
for factor in list_factors:
plot_cm(
'../../data/random-forest/%s_cm.txt', # values for roc_cm_full_set_qc_filtered
'cm_full_set_qc_filtered.%s.pdf',
factor)