Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
2b08e1b9
Commit
2b08e1b9
authored
Aug 28, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add print
parent
34cb81cc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
4 deletions
+14
-4
diaryQueueUpdate.py
diaryQueueUpdate.py
+3
-3
processData.py
processData.py
+2
-1
train.py
train.py
+1
-0
utils.py
utils.py
+8
-0
No files found.
diaryQueueUpdate.py
View file @
2b08e1b9
...
@@ -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)))
...
...
processData.py
View file @
2b08e1b9
...
@@ -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
)
...
...
train.py
View file @
2b08e1b9
...
@@ -29,3 +29,4 @@ if __name__ == "__main__":
...
@@ -29,3 +29,4 @@ if __name__ == "__main__":
utils.py
View file @
2b08e1b9
...
@@ -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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment