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
be8e9ff8
Commit
be8e9ff8
authored
Aug 29, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add update_queue_numbers
parent
6b3bb201
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
diary-training.py
diary-training.py
+6
-6
diaryQueueUpdate.py
diaryQueueUpdate.py
+4
-1
No files found.
diary-training.py
View file @
be8e9ff8
...
@@ -50,13 +50,13 @@ data = click.append(exposure)
...
@@ -50,13 +50,13 @@ data = click.append(exposure)
print
(
"done 合并点击表和曝光表"
)
print
(
"done 合并点击表和曝光表"
)
print
(
data
.
head
(
2
))
print
(
data
.
head
(
2
))
# 从time特征中抽取hour、weekday
# 从time特征中抽取hour、weekday
#
data["hour"] = data["time"].apply(lambda x:datetime.datetime.fromtimestamp(x).hour)
data
[
"hour"
]
=
data
[
"time"
]
.
apply
(
lambda
x
:
datetime
.
datetime
.
fromtimestamp
(
x
)
.
hour
)
#
data["weekday"] = data["time"].apply(lambda x:datetime.datetime.fromtimestamp(x).weekday())
data
[
"weekday"
]
=
data
[
"time"
]
.
apply
(
lambda
x
:
datetime
.
datetime
.
fromtimestamp
(
x
)
.
weekday
())
# 数值是0的特征会被ffm格式删除,经过下面的处理后,没有数值是0的特征
# 数值是0的特征会被ffm格式删除,经过下面的处理后,没有数值是0的特征
#
data.loc[data["hour"]==0] = 24
data
.
loc
[
data
[
"hour"
]
==
0
]
=
24
#
data.loc[data["weekday"]==0] = 7
data
.
loc
[
data
[
"weekday"
]
==
0
]
=
7
#
data["hour"] = data["hour"].astype("category")
data
[
"hour"
]
=
data
[
"hour"
]
.
astype
(
"category"
)
#
data["weekday"] = data["weekday"].astype("category")
data
[
"weekday"
]
=
data
[
"weekday"
]
.
astype
(
"category"
)
data
=
data
.
drop
(
"time"
,
axis
=
1
)
data
=
data
.
drop
(
"time"
,
axis
=
1
)
print
(
"成功从time特征中抽取hour、weekday"
)
print
(
"成功从time特征中抽取hour、weekday"
)
print
(
data
.
head
(
2
))
print
(
data
.
head
(
2
))
...
...
diaryQueueUpdate.py
View file @
be8e9ff8
...
@@ -171,7 +171,9 @@ def update_sql_dairy_queue(queue_name, diary_id,device_id, city_id):
...
@@ -171,7 +171,9 @@ def update_sql_dairy_queue(queue_name, diary_id,device_id, city_id):
cursor
.
execute
(
sql
)
cursor
.
execute
(
sql
)
db
.
commit
()
db
.
commit
()
db
.
close
()
db
.
close
()
print
(
"成功写入diaryid"
)
global
update_queue_numbers
update_queue_numbers
+=
1
print
(
"更新队列总个数:{}"
.
format
(
update_queue_numbers
))
def
get_queue
(
device_id
,
city_id
,
queue_name
):
def
get_queue
(
device_id
,
city_id
,
queue_name
):
...
@@ -244,6 +246,7 @@ if __name__ == "__main__":
...
@@ -244,6 +246,7 @@ if __name__ == "__main__":
# 增加缓存日记视频列表
# 增加缓存日记视频列表
cache_video_id
=
[]
cache_video_id
=
[]
cache_device_city_list
=
[]
cache_device_city_list
=
[]
update_queue_numbers
=
0
while
True
:
while
True
:
data_set_cid
=
pd
.
read_csv
(
DIRECTORY_PATH
+
"data_set_cid.csv"
)[
"cid"
]
.
values
.
tolist
()
data_set_cid
=
pd
.
read_csv
(
DIRECTORY_PATH
+
"data_set_cid.csv"
)[
"cid"
]
.
values
.
tolist
()
total_video_id
=
get_video_id
(
cache_video_id
)
total_video_id
=
get_video_id
(
cache_video_id
)
...
...
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