2012年2月21日
摘要: #!/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 阅读全文
posted @ 2012-02-21 18:28 finallyly 阅读(1372) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2012-02-21 13:03 finallyly 阅读(6743) 评论(0) 推荐(1) 编辑
摘要: b = set([0, 1, 3, 4, 5]) c = set([3, 4, 5, 6, 7]) print b & c #求交集 print b | c #求联集 print b - c #只留下 b 独有的 阅读全文
posted @ 2012-02-21 09:29 finallyly 阅读(370) 评论(0) 推荐(0) 编辑