1. 读取数据 data= open('e:/java_ws/scalademo/data/sample_naive_bayes_data.txt' , 'r') 2. 把数据随机分割为training集 和test集 def SplitData(data,max,ind,seed): ## seed is always be 11L test=[] train=[] random.seed(seed) for line in data: if random.randint(0,max)==in…