Commit 2b08e1b9 authored by 张彦钊's avatar 张彦钊

add print

parent 34cb81cc
...@@ -233,10 +233,10 @@ if __name__ == "__main__": ...@@ -233,10 +233,10 @@ if __name__ == "__main__":
print("累计预测用户总数:{}".format(total_number)) print("累计预测用户总数:{}".format(total_number))
if device_city_list != []: if device_city_list != []:
for device_city in device_city_list: for device_city in device_city_list:
start = time.time() # start = time.time()
multi_proecess_update(device_city[0], device_city[1], data_set_cid, total_video_id) multi_proecess_update(device_city[0], device_city[1], data_set_cid, total_video_id)
end = time.time() # end = time.time()
print("更新该用户队列耗时{}秒".format((end - start))) # print("更新该用户队列耗时{}秒".format((end - start)))
......
...@@ -68,7 +68,8 @@ def ffm_transform(data, test_number, validation_number): ...@@ -68,7 +68,8 @@ def ffm_transform(data, test_number, validation_number):
print("Start ffm transform") print("Start ffm transform")
start = time.time() start = time.time()
ffm_train = multiFFMFormatPandas() ffm_train = multiFFMFormatPandas()
data = ffm_train.fit_transform(data, y='y',n=50000,processes=8) # 服务器内存空闲的时候,可以下面的6改成8。6比较稳定,如果服务器内存占用较多的时候,用8可能因为分配不到内存,脚本挂掉。
data = ffm_train.fit_transform(data, y='y',n=50000,processes=6)
with open(DIRECTORY_PATH+"train/ffm.pkl", "wb") as f: with open(DIRECTORY_PATH+"train/ffm.pkl", "wb") as f:
pickle.dump(ffm_train, f) pickle.dump(ffm_train, f)
......
...@@ -29,3 +29,4 @@ if __name__ == "__main__": ...@@ -29,3 +29,4 @@ if __name__ == "__main__":
...@@ -8,6 +8,7 @@ import pandas as pd ...@@ -8,6 +8,7 @@ import pandas as pd
from sklearn import metrics from sklearn import metrics
from sklearn.metrics import auc from sklearn.metrics import auc
from multiprocessing import Pool from multiprocessing import Pool
import os
def get_date(): def get_date():
...@@ -46,6 +47,13 @@ def con_sql(sql): ...@@ -46,6 +47,13 @@ def con_sql(sql):
return df return df
def move_file():
for eachFile in os.listdir("/data2/"):
if "xlearn" in eachFile:
os.remove("/tmp" + "/" + eachFile)
# 把数据写到redis里 # 把数据写到redis里
# TODO 生产环境的redis地址没有提供,下面的地址是测试环境的,需要改成生产环境地址 # TODO 生产环境的redis地址没有提供,下面的地址是测试环境的,需要改成生产环境地址
def add_data_to_redis(key, val): def add_data_to_redis(key, val):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment