Mercurial > repos > rnateam > graphclust_postprocessing
diff evaluation.py @ 2:6c88ad83de28 draft
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CollectResults commit 287021573c592fdb70fdbbc88943aa16a8740fc0
author | rnateam |
---|---|
date | Fri, 13 Jan 2017 16:57:54 -0500 |
parents | e166d1382033 |
children | a8fde40f00fc |
line wrap: on
line diff
--- a/evaluation.py Thu Dec 22 08:49:14 2016 -0500 +++ b/evaluation.py Fri Jan 13 16:57:54 2017 -0500 @@ -1,6 +1,7 @@ import glob from os import system import re +from sklearn import metrics def sh(script): system("bash -c '%s'" % script) @@ -46,3 +47,23 @@ toWrite += listOfClasses[i] + "\t" + listOfClusters[i] + '\n' with open("RESULTS/fullTab.tabular", "w") as full: full.write(toWrite) + + +pattern = re.compile("^RF.*$") + + +if len(listOfClasses) > 0 and pattern.match(str(listOfClasses[0])): + + completeness_score = metrics.completeness_score(listOfClasses, listOfClusters) + homogeneity_score = metrics.homogeneity_score(listOfClasses, listOfClusters) + adjusted_rand_score = metrics.adjusted_rand_score(listOfClasses, listOfClusters) + adjusted_mutual_info_score = metrics.adjusted_mutual_info_score(listOfClasses, listOfClusters) + v_measure_score = metrics.v_measure_score(listOfClasses, listOfClusters) + + toWrite = "completeness_score : " + str(completeness_score) + "\n" + "homogeneity_score : " + str(homogeneity_score) + "\n" + "adjusted_rand_score : " +str(adjusted_rand_score) + "\n" + "adjusted_mutual_info_score : " + str(adjusted_mutual_info_score)+ "\n" + "v_measure_score : " + str(v_measure_score) + +else: + toWrite = "completeness_score : NA \nhomogeneity_score : NA \nadjusted_rand_score : NA \nadjusted_mutual_info_score : NA \nv_measure_score : NA" + +with open("RESULTS/evaluation.txt", "w") as fOut: + fOut.write(toWrite)