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
6a65f4ae
Commit
6a65f4ae
authored
Aug 09, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix datetime bug
parent
b1515605
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
5 deletions
+2
-5
predictDiary.py
predictDiary.py
+2
-5
No files found.
predictDiary.py
View file @
6a65f4ae
...
@@ -7,9 +7,6 @@ import time
...
@@ -7,9 +7,6 @@ import time
from
utils
import
*
from
utils
import
*
# 接收device_id、city_id
# 将device_id、city_id拼接到对应的城市热门日记表。注意:下面预测集特征顺序要与训练集保持一致
# 将device_id、city_id拼接到对应的城市热门日记表。注意:下面预测集特征顺序要与训练集保持一致
def
feature_en
(
user_profile
):
def
feature_en
(
user_profile
):
file_name
=
DIRECTORY_PATH
+
"diaryTestSet/{0}DiaryTop3000.csv"
.
format
(
user_profile
[
'city_id'
])
file_name
=
DIRECTORY_PATH
+
"diaryTestSet/{0}DiaryTop3000.csv"
.
format
(
user_profile
[
'city_id'
])
...
@@ -17,7 +14,7 @@ def feature_en(user_profile):
...
@@ -17,7 +14,7 @@ def feature_en(user_profile):
data
[
"device_id"
]
=
user_profile
[
'device_id'
]
data
[
"device_id"
]
=
user_profile
[
'device_id'
]
now
=
datetime
.
datetime
.
now
()
now
=
datetime
.
now
()
data
[
"hour"
]
=
now
.
hour
data
[
"hour"
]
=
now
.
hour
data
[
"minute"
]
=
now
.
minute
data
[
"minute"
]
=
now
.
minute
...
@@ -39,7 +36,7 @@ def transform_ffm_format(df, device_id):
...
@@ -39,7 +36,7 @@ def transform_ffm_format(df, device_id):
with
open
(
file_path
,
"rb"
)
as
f
:
with
open
(
file_path
,
"rb"
)
as
f
:
ffm_format_pandas
=
pickle
.
load
(
f
)
ffm_format_pandas
=
pickle
.
load
(
f
)
data
=
ffm_format_pandas
.
transform
(
df
)
data
=
ffm_format_pandas
.
transform
(
df
)
now
=
datetime
.
datetime
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d-
%
H-
%
M"
)
now
=
datetime
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d-
%
H-
%
M"
)
predict_file_name
=
DIRECTORY_PATH
+
"result/{0}_{1}DiaryTop2000.csv"
.
format
(
device_id
,
now
)
predict_file_name
=
DIRECTORY_PATH
+
"result/{0}_{1}DiaryTop2000.csv"
.
format
(
device_id
,
now
)
data
.
to_csv
(
predict_file_name
,
index
=
False
,
header
=
None
)
data
.
to_csv
(
predict_file_name
,
index
=
False
,
header
=
None
)
...
...
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