代码拉取完成,页面将自动刷新
同步操作将从 laozibabac/Bio_CN_Parser 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import brain
import numpy as np
import random
import copy
import pickle
from collections import OrderedDict
# Save obj (could be Brain object, list of saved winners, etc) as file_name
def sim_save(file_name, obj):
with open(file_name,'wb') as f:
pickle.dump(obj, f)
def sim_load(file_name):
with open(file_name,'rb') as f:
return pickle.load(f)
# Compute item overlap between two lists viewed as sets.
def overlap(a,b,percentage=False):
o = len(set(a) & set(b))
if percentage:
return (float(o)/float(len(b)))
else:
return o
# Compute overlap of each list of winners in winners_list
# with respect to a specific winners set, namely winners_list[base]
def get_overlaps(winners_list,base,percentage=False):
overlaps = []
base_winners = winners_list[base]
k = len(base_winners)
for i in xrange(len(winners_list)):
o = overlap(winners_list[i],base_winners)
if percentage:
overlaps.append(float(o)/float(k))
else:
overlaps.append(o)
return overlaps
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。