摘要:總進(jìn)球預(yù)測(cè)場(chǎng)次場(chǎng)次場(chǎng)次前個(gè)進(jìn)球數(shù)以及比例將的所有結(jié)果保存到文件中球總共場(chǎng)場(chǎng)次主賠平陪一共場(chǎng)球球球球球球平負(fù)前個(gè)進(jìn)球數(shù)以及比例將的所有結(jié)果保存到文件中球總共場(chǎng)平賠負(fù)陪一共場(chǎng)球球球球球球勝負(fù)前個(gè)進(jìn)球數(shù)以及比例將的所有結(jié)果
#encoding:utf-8 #!/usr/local/bin/python2.7 from __future__ import division import MySQLdb as mdb import re def myAdd(x,y): return x+y def myMin(x,y): return x-y def preZjq(cur,scr,w,d,l,a): print "======總進(jìn)球預(yù)測(cè)======" sql_wd = "select zjq,count(*) from results where win between %s and %s and dog between %s and %s group by zjq order by count(*)" % (myMin(w,a),myAdd(w,a),myMin(d,a),myAdd(d,a)) sql_dl = "select zjq,count(*) from results where dog between %s and %s and los between %s and %s group by zjq order by count(*)" % (myMin(d,a),myAdd(d,a),myMin(l,a),myAdd(l,a)) sql_wl = "select zjq,count(*) from results where win between %s and %s or los between %s and %s group by zjq order by count(*)" % (myMin(w,a),myAdd(w,a),myMin(l,a),myAdd(l,a)) temp_wd=["win&dog"+" "] temp_wd.append(("場(chǎng)次:%s ") % str(scr)) temp_wd.append(("win:%s dog:%s los:%s acc:%s"+" ") % (str(w),str(d),str(l),str(a))) temp_dl=["win&dog"+" "] temp_dl.append(("場(chǎng)次:%s ") % str(scr)) temp_dl.append(("win:%s dog:%s los:%s acc:%s"+" ") % (str(w),str(d),str(l),str(a))) temp_wl=["win&dog"+" "] temp_wl.append(("場(chǎng)次:%s ") % str(scr)) temp_wl.append(("win:%s dog:%s los:%s acc:%s"+" ") % (str(w),str(d),str(l),str(a))) f = open("/root/bet/prediction.txt","a") sum_wd=0 #wd_alldata:前4個(gè)進(jìn)球數(shù)以及比例 wd_alldata=[] #將SQL的所有結(jié)果保存到文件中 cur.execute(sql_wd) for item in cur.fetchall(): temp_wd_str1=str(item[0])+"球," temp_wd.append(temp_wd_str1) temp1_wd=str(item[1]) sum_wd+=item[1] temp_wd_str2 = re.search("d{1,3}",temp1_wd).group() temp_wd.append(temp_wd_str2+" ") temp_wd.append("總共:"+str(sum_wd)+"場(chǎng)") temp_wd.append(" ") cur.execute(sql_wd) for d in cur.fetchall(): wd_alldata.append(str(d[0])) tmp4=str(d[1]) temp_srt3 = re.search("d{1,3}",tmp4).group() wd_alldata.append(temp_srt3) for item in temp_wd: f.writelines(str(item)) l = len(wd_alldata) print ("場(chǎng)次: %s 主賠+平陪-->"+"一共 "+str(sum_wd)+"場(chǎng)") % str(scr) if l==2: temp_wd_alldata = wd_alldata[-2:] print str((temp_wd_alldata[0])+"球:")+str(format(int(temp_wd_alldata[1])/sum_wd,".2%")) elif l==4: temp_wd_alldata = wd_alldata[-4:] print str((temp_wd_alldata[0])+"球:")+str(format(int(temp_wd_alldata[1])/sum_wd,".2%")) print str((temp_wd_alldata[2])+"球:")+str(format(int(temp_wd_alldata[3])/sum_wd,".2%")) elif l>=6: temp_wd_alldata = wd_alldata[-6:] print str((temp_wd_alldata[0])+"球:")+str(format(int(temp_wd_alldata[1])/sum_wd,".2%")) print str((temp_wd_alldata[2])+"球:")+str(format(int(temp_wd_alldata[3])/sum_wd,".2%")) print str((temp_wd_alldata[4])+"球:")+str(format(int(temp_wd_alldata[5])/sum_wd,".2%")) #平負(fù) sum_dl=0 #dl_alldata:前4個(gè)進(jìn)球數(shù)以及比例 dl_alldata=[] #將SQL的所有結(jié)果保存到文件中 cur.execute(sql_dl) for item in cur.fetchall(): temp_dl_str1=str(item[0])+"球," temp_dl.append(temp_dl_str1) temp1_dl=str(item[1]) sum_dl+=item[1] temp_dl_str2 = re.search("d{1,3}",temp1_dl).group() temp_dl.append(temp_dl_str2+" ") temp_dl.append("總共:"+str(sum_dl)+"場(chǎng)") temp_dl.append(" ") cur.execute(sql_dl) for d in cur.fetchall(): dl_alldata.append(str(d[0])) tmp4=str(d[1]) temp_srt3 = re.search("d{1,3}",tmp4).group() dl_alldata.append(temp_srt3) for item in temp_dl: f.writelines(str(item)) l = len(dl_alldata) print (" 平賠+負(fù)陪-->"+"一共 "+str(sum_dl)+"場(chǎng)") if l==2: temp_dl_alldata = dl_alldata[-2:] print str((temp_dl_alldata[0])+"球:")+str(format(int(temp_dl_alldata[1])/sum_dl,".2%")) elif l==4: temp_dl_alldata = dl_alldata[-4:] print str((temp_dl_alldata[0])+"球:")+str(format(int(temp_dl_alldata[1])/sum_dl,".2%")) print str((temp_dl_alldata[2])+"球:")+str(format(int(temp_dl_alldata[3])/sum_dl,".2%")) elif l>=6: temp_dl_alldata = dl_alldata[-6:] print str((temp_dl_alldata[0])+"球:")+str(format(int(temp_dl_alldata[1])/sum_dl,".2%")) print str((temp_dl_alldata[2])+"球:")+str(format(int(temp_dl_alldata[3])/sum_dl,".2%")) print str((temp_dl_alldata[4])+"球:")+str(format(int(temp_dl_alldata[5])/sum_dl,".2%")) #勝負(fù) sum_wl=0 #wl_alldata:前4個(gè)進(jìn)球數(shù)以及比例 wl_alldata=[] #將SQL的所有結(jié)果保存到文件中 cur.execute(sql_wl) for item in cur.fetchall(): temp_wl_str1=str(item[0])+"球," temp_wl.append(temp_wl_str1) temp1_wl=str(item[1]) sum_wl+=item[1] temp_wl_str2 = re.search("d{1,3}",temp1_wl).group() temp_wl.append(temp_wl_str2+" ") temp_wl.append("總共:"+str(sum_wl)+"場(chǎng)") temp_wl.append(" ") cur.execute(sql_wl) for d in cur.fetchall(): wl_alldata.append(str(d[0])) tmp4=str(d[1]) temp_srt3 = re.search("d{1,3}",tmp4).group() wl_alldata.append(temp_srt3) for item in temp_wl: f.writelines(str(item)) l = len(wl_alldata) print (" 主賠+負(fù)陪-->"+"一共 "+str(sum_wl)+"場(chǎng)") if l==2: temp_wl_alldata = wl_alldata[-2:] print str((temp_wl_alldata[0])+"球:")+str(format(int(temp_wl_alldata[1])/sum_wl,".2%")) elif l==4: temp_wl_alldata = wl_alldata[-4:] print str((temp_wl_alldata[0])+"球:")+str(format(int(temp_wl_alldata[1])/sum_wl,".2%")) print str((temp_wl_alldata[2])+"球:")+str(format(int(temp_wl_alldata[3])/sum_wl,".2%")) elif l>=6: temp_wl_alldata = wl_alldata[-6:] print str((temp_wl_alldata[0])+"球:")+str(format(int(temp_wl_alldata[1])/sum_wl,".2%")) print str((temp_wl_alldata[2])+"球:")+str(format(int(temp_wl_alldata[3])/sum_wl,".2%")) print str((temp_wl_alldata[4])+"球:")+str(format(int(temp_wl_alldata[5])/sum_wl,".2%")) print "============" f.close() def preSpf(cur,scr,w,d,l,a): print "======勝平負(fù)預(yù)測(cè)======" sql_spf_wd = "select spf,count(*) from results where win between %s and %s and dog between %s and %s group by spf order by count(*)" % (myMin(w,a),myAdd(w,a),myMin(d,a),myAdd(d,a)) sql_spf_dl = "select spf,count(*) from results where dog between %s and %s and los between %s and %s group by spf order by count(*)" % (myMin(d,a),myAdd(d,a),myMin(l,a),myAdd(l,a)) sql_spf_wl = "select spf,count(*) from results where win between %s and %s or los between %s and %s group by spf order by count(*)" % (myMin(w,a),myAdd(w,a),myMin(l,a),myAdd(l,a)) temp_spf_wd = [] temp_spf_dl = [] temp_spf_wl = [] temp = [] #添加場(chǎng)次信息 temp.append(("場(chǎng)次:%s ") % str(scr)) #添加賠率信息 temp.append(("win:%s dog:%s los:%s acc:%s"+" ") % (str(w),str(d),str(l),str(a))) #寫入到文件Precdiction.txt f = open("/root/bet/prediction.txt","a") #1.對(duì)于sql_spf_wd的輸出進(jìn)行處理 cur.execute(sql_spf_wd) #統(tǒng)計(jì)勝平負(fù)場(chǎng)次總和 sum_spf_wd=0 #將SQL的所有結(jié)果保存到文件中 for item in cur.fetchall(): temp_spf_wd.append(str(item[0])) temp_spf_wd.append(str(item[1])) sum_spf_wd+=(item[1]) #收集勝平負(fù)的場(chǎng)次,并求百分比 print "勝平-->共"+str(sum_spf_wd)+"場(chǎng)" #統(tǒng)計(jì)勝平負(fù)的比例 cur.execute(sql_spf_wd) l = len(temp_spf_wd) print ("場(chǎng)次: %s 主賠+平陪-->"+"一共 "+str(sum_spf_wd)+"場(chǎng)") % str(scr) if l==2: temp_spf_wd = temp_spf_wd[-2:] print str((temp_spf_wd[0])+":")+str(format(int(temp_spf_wd[1])/sum_spf_wd,".2%")) elif l==4: temp_spf_wd = temp_spf_wd[-4:] print str((temp_spf_wd[0])+":")+str(format(int(temp_spf_wd[1])/sum_spf_wd,".2%")) print str((temp_spf_wd[2])+":")+str(format(int(temp_spf_wd[3])/sum_spf_wd,".2%")) elif l>=6: temp_spf_wd = temp_spf_wd[-6:] print str((temp_spf_wd[0])+":")+str(format(int(temp_spf_wd[1])/sum_spf_wd,".2%")) print str((temp_spf_wd[2])+":")+str(format(int(temp_spf_wd[3])/sum_spf_wd,".2%")) print str((temp_spf_wd[4])+":")+str(format(int(temp_spf_wd[5])/sum_spf_wd,".2%")) #2.對(duì)于sql_spf_dl的輸出進(jìn)行處理 cur.execute(sql_spf_dl) #統(tǒng)計(jì)勝平負(fù)場(chǎng)次總和 sum_spf_dl=0 #將SQL的所有結(jié)果保存到文件中 for item in cur.fetchall(): temp_spf_dl.append(str(item[0])) temp_spf_dl.append(str(item[1])) sum_spf_dl+=(item[1]) #統(tǒng)計(jì)勝平負(fù)的比例 cur.execute(sql_spf_dl) l = len(temp_spf_dl) print (" 平陪+負(fù)賠-->"+"一共 "+str(sum_spf_dl)+"場(chǎng)") if l==2: temp_spf_dl = temp_spf_dl[-2:] print str((temp_spf_dl[0])+":")+str(format(int(temp_spf_dl[1])/sum_spf_dl,".2%")) elif l==4: temp_spf_dl = temp_spf_dl[-4:] print str((temp_spf_dl[0])+":")+str(format(int(temp_spf_dl[1])/sum_spf_dl,".2%")) print str((temp_spf_dl[2])+":")+str(format(int(temp_spf_dl[3])/sum_spf_dl,".2%")) elif l>=6: temp_spf_dl = temp_spf_dl[-6:] print str((temp_spf_dl[0])+":")+str(format(int(temp_spf_dl[1])/sum_spf_dl,".2%")) print str((temp_spf_dl[2])+":")+str(format(int(temp_spf_dl[3])/sum_spf_dl,".2%")) print str((temp_spf_dl[4])+":")+str(format(int(temp_spf_dl[5])/sum_spf_dl,".2%")) #3.對(duì)于sql_spf_wl的輸出進(jìn)行處理 cur.execute(sql_spf_wl) #統(tǒng)計(jì)勝平負(fù)場(chǎng)次總和 sum_spf_wl=0 #將SQL的所有結(jié)果保存到文件中 for item in cur.fetchall(): temp_spf_wl.append(str(item[0])) temp_spf_wl.append(str(item[1])) sum_spf_wl+=(item[1]) #統(tǒng)計(jì)勝平負(fù)的比例 cur.execute(sql_spf_wl) l = len(temp_spf_wl) print (" 主陪+負(fù)賠-->"+"一共 "+str(sum_spf_wl)+"場(chǎng)") if l==2: temp_spf_wl = temp_spf_wl[-2:] print str((temp_spf_wl[0])+":")+str(format(int(temp_spf_wl[1])/sum_spf_wl,".2%")) elif l==4: temp_spf_wl = temp_spf_wl[-4:] print str((temp_spf_wl[0])+":")+str(format(int(temp_spf_wl[1])/sum_spf_wl,".2%")) print str((temp_spf_wl[2])+":")+str(format(int(temp_spf_wl[3])/sum_spf_wl,".2%")) elif l>=6: temp_spf_wl = temp_spf_wl[-6:] print str((temp_spf_wl[0])+":")+str(format(int(temp_spf_wl[1])/sum_spf_wl,".2%")) print str((temp_spf_wl[2])+":")+str(format(int(temp_spf_wl[3])/sum_spf_wl,".2%")) print str((temp_spf_wl[4])+":")+str(format(int(temp_spf_wl[5])/sum_spf_wl,".2%")) print "============" f.close() #========================================= #比分預(yù)測(cè) def preRes(cur,scr,w,d,l,a): sql_res_wd = "select res,count(*) from results where win between %s and %s and dog between %s and %s group by res order by count(*)" % (myMin(w,a),myAdd(w,a),myMin(d,a),myAdd(d,a)) sql_res_dl = "select res,count(*) from results where dog between %s and %s and los between %s and %s group by res order by count(*)" % (myMin(d,a),myAdd(d,a),myMin(l,a),myAdd(l,a)) sql_res_wl = "select res,count(*) from results where win between %s and %s or los between %s and %s group by res order by count(*)" % (myMin(w,a),myAdd(w,a),myMin(l,a),myAdd(l,a)) #統(tǒng)計(jì)比分的場(chǎng)次之和 sum_res_wd = 0 sum_res_dl = 0 sum_res_wl = 0 #暫存保存到文件的信息 temp_res_wd = [] temp_res_dl = [] temp_res_wl = [] #添加場(chǎng)次信息 temp_res_wd.append(("場(chǎng)次:%s ") % str(scr)) #添加賠率信息 temp_res_wd.append(("win:%s dog:%s los:%s acc:%s"+" ") % (str(w),str(d),str(l),str(a))) #對(duì)于總共收集的場(chǎng)次 sum_res = 0 #對(duì)于比分以及場(chǎng)次進(jìn)行收集 all_res_data=[] #寫入到文件Precdiction.txt f = open("/root/bet/prediction.txt","a") print "======比分預(yù)測(cè)======" #1.對(duì)于sql_res_wd的輸出進(jìn)行處理 cur.execute(sql_res_wd) #將SQL的所有結(jié)果保存到文件中 for item in cur.fetchall(): temp_res_wd.append(str(item[0])) temp_res_wd.append(str(item[1])) sum_res_wd+=item[1] print " 勝平預(yù)測(cè)-->共"+str(sum_res_wd)+"場(chǎng)" #統(tǒng)計(jì)比分比例 cur.execute(sql_res_wd) l = len(temp_res_wd) if l==4: temp_res_wd2 = temp_res_wd[-2:] print str((temp_res_wd2[0])+"==》")+str(format(int(temp_res_wd2[1])/sum_res_wd,".2%")) elif l==6: temp_res_wd2 = temp_res_wd[-4:] print str((temp_res_wd2[0])+"==》")+str(format(int(temp_res_wd2[1])/sum_res_wd,".2%")) print str((temp_res_wd2[2])+"==》")+str(format(int(temp_res_wd2[3])/sum_res_wd,".2%")) elif l>6: temp_res_wd2 = temp_res_wd[-8:] print str((temp_res_wd2[0])+"==》")+str(format(int(temp_res_wd2[1])/sum_res_wd,".2%")) print str((temp_res_wd2[2])+"==》")+str(format(int(temp_res_wd2[3])/sum_res_wd,".2%")) print str((temp_res_wd2[4])+"==》")+str(format(int(temp_res_wd2[5])/sum_res_wd,".2%")) print str((temp_res_wd2[6])+"==》")+str(format(int(temp_res_wd2[7])/sum_res_wd,".2%")) #2.對(duì)于sql_res_dl的輸出進(jìn)行處理 cur.execute(sql_res_dl) #將SQL的所有結(jié)果保存到文件中 for item in cur.fetchall(): temp_res_dl.append(str(item[0])) temp_res_dl.append(str(item[1])) sum_res_dl+=item[1] print " 平負(fù)預(yù)測(cè)-->共"+str(sum_res_dl)+"場(chǎng)" #統(tǒng)計(jì)比分比例 cur.execute(sql_res_dl) l = len(temp_res_dl) if l==4: temp_res_dl2 = temp_res_dl[-2:] print str((temp_res_dl2[0])+"==》")+str(format(int(temp_res_dl2[1])/sum_res_dl,".2%")) elif l==6: temp_res_dl2 = temp_res_dl[-4:] print str((temp_res_dl2[0])+"==》")+str(format(int(temp_res_dl2[1])/sum_res_dl,".2%")) print str((temp_res_dl2[2])+"==》")+str(format(int(temp_res_dl2[3])/sum_res_dl,".2%")) elif l>6: temp_res_dl2 = temp_res_dl[-8:] print str((temp_res_dl2[0])+"==》")+str(format(int(temp_res_dl2[1])/sum_res_dl,".2%")) print str((temp_res_dl2[2])+"==》")+str(format(int(temp_res_dl2[3])/sum_res_dl,".2%")) print str((temp_res_dl2[4])+"==》")+str(format(int(temp_res_dl2[5])/sum_res_dl,".2%")) print str((temp_res_dl2[6])+"==》")+str(format(int(temp_res_dl2[7])/sum_res_dl,".2%")) #3.對(duì)于sql_res_wl的輸出進(jìn)行處理 cur.execute(sql_res_wl) #將SQL的所有結(jié)果保存到文件中 for item in cur.fetchall(): temp_res_wl.append(str(item[0])) temp_res_wl.append(str(item[1])) sum_res_wl+=item[1] print " 勝負(fù)預(yù)測(cè)-->共"+str(sum_res_wl)+"場(chǎng)" #統(tǒng)計(jì)比分比例 cur.execute(sql_res_wl) l = len(temp_res_wl) if l==4: temp_res_wl2 = temp_res_wl[-2:] print str((temp_res_wl2[0])+"==》")+str(format(int(temp_res_wl2[1])/sum_res_wl,".2%")) elif l==6: temp_res_wl2 = temp_res_wl[-4:] print str((temp_res_wl2[0])+"==》")+str(format(int(temp_res_wl2[1])/sum_res_wl,".2%")) print str((temp_res_wl2[2])+"==》")+str(format(int(temp_res_wl2[3])/sum_res_wl,".2%")) elif l>6: temp_res_wl2 = temp_res_wl[-12:] print str((temp_res_wl2[0])+"==》")+str(format(int(temp_res_wl2[1])/sum_res_wl,".2%")) print str((temp_res_wl2[2])+"==》")+str(format(int(temp_res_wl2[3])/sum_res_wl,".2%")) print str((temp_res_wl2[4])+"==》")+str(format(int(temp_res_wl2[5])/sum_res_wl,".2%")) print str((temp_res_wl2[6])+"==》")+str(format(int(temp_res_wl2[7])/sum_res_wl,".2%")) print str((temp_res_wl2[8])+"==》")+str(format(int(temp_res_wl2[9])/sum_res_wl,".2%")) print str((temp_res_wl2[10])+"==》")+str(format(int(temp_res_wl2[11])/sum_res_wl,".2%")) #======END OF THE FUNCTION====== f.close() def preAll(cur,scr,w,d,l,a): preSpf(cur,scr,w,d,l,a) preZjq(cur,scr,w,d,l,a) preRes(cur,scr,w,d,l,a)
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://m.specialneedsforspecialkids.com/yun/37385.html
摘要:數(shù)據(jù)問題解所有數(shù)據(jù)平均值平均值回歸方程回歸方程回歸系數(shù)估計(jì)軌道文件回歸系數(shù)預(yù)測(cè)結(jié)果回歸系數(shù)預(yù)測(cè) 數(shù)據(jù) 300,21182.88,-7044.56,14639.48 600,21707.87,-6930.28,13906.68 900,22207.04,-6828.65,13147.66 1200,22679.16,-6738.66,12363.84 1500,23123.06,-665...
摘要:奧胡斯大學(xué)密碼學(xué)機(jī)器學(xué)習(xí)工程師介紹了如何實(shí)現(xiàn)基于加密數(shù)據(jù)進(jìn)行訓(xùn)練和預(yù)測(cè)的卷積神經(jīng)網(wǎng)絡(luò)。通過卷積神經(jīng)網(wǎng)絡(luò)分析圖像在最近幾年極為流行,因?yàn)樵趫D像相關(guān)任務(wù)上的表現(xiàn)超過了其他許多方法。 奧胡斯大學(xué)密碼學(xué)PhD、Datadog機(jī)器學(xué)習(xí)工程師Morten Dahl介紹了如何實(shí)現(xiàn)基于加密數(shù)據(jù)進(jìn)行訓(xùn)練和預(yù)測(cè)的卷積神經(jīng)網(wǎng)絡(luò)。TL;DR 我們選取了一個(gè)經(jīng)典的CNN深度學(xué)習(xí)模型,經(jīng)過一系列步驟的改造,使其得以基于...
摘要:還記得有人說(shuō)預(yù)測(cè)未來(lái)最好的方式就是創(chuàng)造未來(lái),以前看到這句話總覺得是廢話,如今看到這一切在自己身上變成現(xiàn)實(shí)的一刻,感受是如此的真切,敲擊鍵盤的手居然有點(diǎn)顫抖,是的,預(yù)測(cè)未來(lái)最好的方式就是創(chuàng)造未來(lái)。 如果只能用一個(gè)詞來(lái)描述此刻的心情,我想說(shuō)恍如隔世,這樣說(shuō)多少顯得有幾分矯情,或許內(nèi)心還是想在能矯情的時(shí)候再矯情一次,畢竟當(dāng)初做這一切的起因是為了夢(mèng)想。還記得有人說(shuō)預(yù)測(cè)未來(lái)最好的方式就是創(chuàng)造未來(lái)...
摘要:谷歌在年國(guó)際消費(fèi)電子展以及今年的開發(fā)峰會(huì)上首次展示了他們的,然后于三月份發(fā)布了。樹莓派上性能的局限性不幸的是,業(yè)余愛好者最喜歡樹莓派無(wú)法充分發(fā)揮加速器的功能和速度。使用端口,目前的樹莓派設(shè)備沒有或,而只能使用速度較慢的。 Edge AI是什么?它為何如此重要? 傳統(tǒng)意義上,AI解決方案需要強(qiáng)大的并行計(jì)算處理能力,長(zhǎng)期以來(lái),AI服務(wù)都是通過聯(lián)網(wǎng)在線的云端基于服務(wù)器的計(jì)算來(lái)提供服務(wù)。但是具...
閱讀 1938·2021-11-23 09:51
閱讀 1250·2019-08-30 15:55
閱讀 1623·2019-08-30 15:44
閱讀 768·2019-08-30 14:11
閱讀 1150·2019-08-30 14:10
閱讀 921·2019-08-30 13:52
閱讀 2636·2019-08-30 12:50
閱讀 621·2019-08-29 15:04