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
48f60535
Commit
48f60535
authored
Aug 10, 2018
by
高雅喆
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.wanmeizhensuo.com:ML/ffm-baseline
pretty output
parents
9bbbef29
657cd504
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
11 deletions
+10
-11
diaryCandidateSet.py
diaryCandidateSet.py
+0
-1
predictDiary.py
predictDiary.py
+3
-3
userProfile.py
userProfile.py
+7
-7
No files found.
diaryCandidateSet.py
View file @
48f60535
...
@@ -35,7 +35,6 @@ def get_cityList():
...
@@ -35,7 +35,6 @@ def get_cityList():
cityList
=
con_sql
(
sql
)
cityList
=
con_sql
(
sql
)
cityList
.
to_csv
(
DIRECTORY_PATH
+
"diaryTestSet/cityList.csv"
,
index
=
False
)
cityList
.
to_csv
(
DIRECTORY_PATH
+
"diaryTestSet/cityList.csv"
,
index
=
False
)
cityList
=
cityList
[
0
]
.
values
.
tolist
()
cityList
=
cityList
[
0
]
.
values
.
tolist
()
cityList
.
remove
(
'worldwide'
)
print
(
"成功获取全国城市列表"
)
print
(
"成功获取全国城市列表"
)
return
cityList
return
cityList
...
...
predictDiary.py
View file @
48f60535
...
@@ -25,8 +25,8 @@ def feature_en(user_profile):
...
@@ -25,8 +25,8 @@ def feature_en(user_profile):
# 虽然预测y,但ffm转化需要y,并不影响预测结果
# 虽然预测y,但ffm转化需要y,并不影响预测结果
data
[
"y"
]
=
0
data
[
"y"
]
=
0
data
=
data
.
drop
(
"city_id"
,
axis
=
1
)
data
=
data
.
drop
(
"city_id"
,
axis
=
1
)
print
(
data
.
head
(
2
))
print
(
data
.
head
(
1
))
print
(
"特征工程处理结束"
)
return
data
return
data
...
@@ -37,7 +37,7 @@ def transform_ffm_format(df, device_id):
...
@@ -37,7 +37,7 @@ def transform_ffm_format(df, device_id):
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
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d-
%
H-
%
M"
)
now
=
datetime
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d-
%
H-
%
M"
)
print
(
"ffm格式转化结束"
)
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
)
return
predict_file_name
return
predict_file_name
...
...
userProfile.py
View file @
48f60535
...
@@ -27,10 +27,10 @@ def fetch_user_profile(device_id):
...
@@ -27,10 +27,10 @@ def fetch_user_profile(device_id):
if
user_profile
.
empty
:
if
user_profile
.
empty
:
print
(
"没有获取到该用户对应的city_id"
)
print
(
"没有获取到该用户对应的city_id"
)
return
{},
user_profile
.
empty
return
{},
user_profile
.
empty
else
:
user_profile
=
user_profile
.
rename
(
columns
=
{
0
:
"device_id"
,
1
:
"city_id"
})
user_profile
=
user_profile
.
rename
(
columns
=
{
0
:
"device_id"
,
1
:
"city_id"
})
print
(
"成功获取该用户对应的city_id"
)
print
(
"成功获取该用户对应的city_id"
)
user_profile_dict
=
{}
user_profile_dict
=
{}
for
i
in
user_profile
.
columns
:
for
i
in
user_profile
.
columns
:
user_profile_dict
[
i
]
=
user_profile
.
loc
[
0
,
i
]
user_profile_dict
[
i
]
=
user_profile
.
loc
[
0
,
i
]
return
user_profile_dict
,
user_profile
.
empty
return
user_profile_dict
,
user_profile
.
empty
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