摘要:
#!/usr/bin/pythonimportsys;importre;defgetPrecision(TP,TN,FP,FN):result=0.0;result=TP/(TP+FP);returnresult;defgetRecall(TP,TN,FP,FN):result=0.0;result=TP/(TP+FN);returnresult;defgetFvalue(TP,TN,FP,FN):result=0.0;p=getPrecision(TP,TN,FP,FN);r=getRecall(TP,TN,FP,FN);result=2*p*r/(p+r);returnresult;def 阅读全文
摘要:
1.数据管理脚本:原始文件格式id\tclusterId\tgoldstandardIdDataManagement.py#!/usr/bin/pythonimportcPickleasp;importsys;importre;if(__name__=="__main__"):filename=str(sys.argv[1]);preturn=re.compile('(^\s+|\s+$)');fidsrc=file(filename,'r');clusters={};#(key,[])goldstandards={};#(key,[])fo 阅读全文
摘要:
b = set([0, 1, 3, 4, 5]) c = set([3, 4, 5, 6, 7]) print b & c #求交集 print b | c #求联集 print b - c #只留下 b 独有的 阅读全文