Skip to content

Commit 455c619

Browse files
authored
Merge pull request #368 from JohT/fix/skip-p-values-when-not-enough-samples
Fix missing pairwise changed dependencies
2 parents 9ea9896 + 71d3519 commit 455c619

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

Diff for: cypher/GitLog/List_pairwise_changed_files_with_dependencies.cypher

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
MATCH (firstCodeFile:File)-[dependency:DEPENDS_ON]->(secondCodeFile:File)
44
MATCH (firstCodeFile)-[pairwiseChange:CHANGED_TOGETHER_WITH]-(secondCodeFile)
5-
WHERE elementId(firstCodeFile) < elementId(secondCodeFile)
5+
//De-duplicating the pairs of files isn't necessary, because the dependency relation is directed.
6+
//WHERE elementId(firstCodeFile) < elementId(secondCodeFile)
67
WITH firstCodeFile.fileName AS firstFileName
78
,secondCodeFile.fileName AS secondFileName
89
,coalesce(dependency.weight, dependency.cardinality) AS dependencyWeight

Diff for: jupyter/GitHistoryGeneral.ipynb

+18-7
Original file line numberDiff line numberDiff line change
@@ -1338,15 +1338,26 @@
13381338
"display(pairwise_changed_git_files_with_dependencies.corr(method='pearson'))\n",
13391339
"\n",
13401340
"display(\"Pairwise changed git files compared to dependency weights - Spearman Correlation\")\n",
1341-
"display(pairwise_changed_git_files_with_dependencies.corr(method='spearman'))\n",
1342-
"\n",
1343-
"from scipy.stats import pearsonr, spearmanr\n",
1341+
"display(pairwise_changed_git_files_with_dependencies.corr(method='spearman'))"
1342+
]
1343+
},
1344+
{
1345+
"cell_type": "code",
1346+
"execution_count": null,
1347+
"id": "5a4ae651",
1348+
"metadata": {},
1349+
"outputs": [],
1350+
"source": [
1351+
"if pairwise_changed_git_files_with_dependencies.shape[0] < 5:\n",
1352+
" print(\"Less than 5 samples are not enough to calculate p-values\")\n",
1353+
"else:\n",
1354+
" from scipy.stats import pearsonr, spearmanr\n",
13441355
"\n",
1345-
"display(\"Pearson Correlation with p-value for commitCount and dependencyWeight\")\n",
1346-
"display(pearsonr(pairwise_changed_git_files_with_dependencies['commitCount'], pairwise_changed_git_files_with_dependencies['dependencyWeight']))\n",
1356+
" display(\"Pearson Correlation with p-value for commitCount and dependencyWeight\")\n",
1357+
" display(pearsonr(pairwise_changed_git_files_with_dependencies['commitCount'], pairwise_changed_git_files_with_dependencies['dependencyWeight']))\n",
13471358
"\n",
1348-
"display(\"Spearman Correlation with p-value for commitCount and dependencyWeight\")\n",
1349-
"display(spearmanr(pairwise_changed_git_files_with_dependencies['commitCount'], pairwise_changed_git_files_with_dependencies['dependencyWeight']))"
1359+
" display(\"Spearman Correlation with p-value for commitCount and dependencyWeight\")\n",
1360+
" display(spearmanr(pairwise_changed_git_files_with_dependencies['commitCount'], pairwise_changed_git_files_with_dependencies['dependencyWeight']))"
13501361
]
13511362
},
13521363
{

0 commit comments

Comments
 (0)