def predict_tf_once(day,start_date = '2016-10-1'):
all_dataset = get_dataset(day)
all_dataset = map(lambda x:x.ix[start_date:start_date],all_dataset)
y_p_features = map(lambda user_id:tf_percent_model.resample_x_y_(all_dataset,user_id)[0].reshape(-1),get_full_user_ids())
y_p_features_df = pd.DataFrame(y_p_features,index = get_full_user_ids())
percent = pd.DataFrame.from_csv('./features/tensorflow_model/percent_model/%d.csv'%day)
#percent = pd.DataFrame.from_csv('./features/tensorflow_model/percent_model/%d.csv'%2)
#%%
percent = percent[map(lambda x:'percent#%d'%x,range(_feature_length))]
t = pd.DataFrame(index = percent.index)
t[pd.Timestamp(start_date)+pd.Timedelta('%dd'%(day-1))] = (np.array(y_p_features_df)*percent).sum(axis=1)
t = t.T
t.to_csv('./result/predict_part/%d.csv'%day)
real = int(np.round((np.array(y_p_features_df)*percent).sum().sum()))
print (day,real)
return (day,real)
评论列表
文章目录