master-thesis/util/entropy.py
2021-08-20 12:22:04 +02:00

29 lines
948 B
Python
Executable File

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
if __name__ == '__main__':
data = pd.read_csv('commit_analysis.csv')
data['type'] = data['is_ml'].apply(lambda x: 'ML' if x else 'No ML')
ylim = data['file_entropy'].quantile(0.95)
sns.catplot(x='type', y='file_entropy', kind='box', data=data) \
.set(title='Entropia del cambiamento calcolata sui file') \
.set(xlabel='tipo') \
.set(ylabel='entropia') \
.set(ylim=(0, ylim))
plt.tight_layout()
plt.savefig('../src/figures/files-entropy.pdf')
plt.close()
ylim = data['line_entropy'].quantile(0.95)
sns.catplot(x='type', y='line_entropy', kind='box', data=data) \
.set(title='Entropia del cambiamento calcolata sulle linee') \
.set(xlabel='tipo') \
.set(ylabel='entropia') \
.set(ylim=(0, ylim))
plt.tight_layout()
plt.savefig('../src/figures/lines-entropy.pdf')