Esempio n. 1
0
 def __init__(self, ui, user):
     self.ui = ui
     self.emotion = buddingEmotion.BuddingEmotion(self)
     self.user = user
     print("current user is", self.user)
     res = database.load(self.user)
     print(res)
     self.money = res[1]
     self.energy = res[2]
     self.level = res[3]
Esempio n. 2
0
timew=['10-OCT-16','11-OCT-16','12-OCT-16','13-OCT-16','14-OCT-16','15-OCT-16','16-OCT-16','17-OCT-16','18-OCT-16','19-OCT-16','20-OCT-16','21-OCT-16','22-OCT-16','23-OCT-16','24-OCT-16','25-OCT-16','26-OCT-16']
x0=[]
y0=[]
f=[]
pattern = '%d-%b-%y'
#rawdata = pd.read_csv('rawdata020/dataset'+timew[-1]+'.csv',dtype={'gid':str,'event':str,'productId':str})
rawdata = pd.read_csv('/home/ubuntu/rawdata020/dataset020.csv',dtype={'fid':str,'event':str,'cur_cam':str,'productId':str})
for i in range(0,len(timew)):
    epoch = int(time.mktime(time.strptime(timew[i],pattern)))
    xt=[]
    yt=[]
    ft=[]
    print 'load data: %s' %(timew[i])
    selectdata=rawdata[rawdata.time < epoch].reset_index(drop=True)
    #x0,y0,f=mydata.load(rate,nday,nday_predict,timew[i])
    xt,yt,ft=mydata.load(selectdata,rate,nday,nday_predict,timew[i])
    #xt,yt,ft=mydata.load(selectdata,rate,nday,nday_predict,timew)
    x0=x0+xt
    y0=y0+yt

f=ft
fx_all= open('model/x0_all-'+str(nday)+'.pkl','wb')
fy_all= open('model/y0_all-'+str(nday)+'.pkl','wb')
fx_train= open('model/x0_train_rate'+str(rate)+'-'+str(nday)+'.pkl','wb')
fy_train= open('model/y0_train_rate'+str(rate)+'-'+str(nday)+'.pkl','wb')
fx_test= open('model/x0_test_rate'+str(rate)+'-'+str(nday)+'.pkl','wb')
fy_test= open('model/y0_test_rate'+str(rate)+'-'+str(nday)+'.pkl','wb')
print 'The predict-buy module using svm.'
print 'Use %d weeks train data to predect %d weeks buying members' %(nday,nday_predict)
print 'The gamma value of rbf kernel is %5.2f' %(gamma)
print 'Data is loaded. Use %d features for each uniq gid.' %(len(x0[0]))
Esempio n. 3
0
 def load_state(self, user):
     res = database.load(user)
     self.player.set_money(money=res[1])
     self.budding.set_energy_and_level(energy=res[2], level=res[3])