Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gm_mab
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rank
gm_mab
Commits
2d0b68fb
Commit
2d0b68fb
authored
Apr 20, 2020
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调试
parent
09039ffc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
generate_content_user_feature.py
tools/generate_content_user_feature.py
+7
-3
No files found.
tools/generate_content_user_feature.py
View file @
2d0b68fb
...
@@ -183,13 +183,12 @@ class Generate_Feature_Info(object):
...
@@ -183,13 +183,12 @@ class Generate_Feature_Info(object):
return
list
()
return
list
()
@classmethod
@classmethod
def
get_content_feature
(
cls
,
car_id
,
content_type
=
"diary"
):
def
get_content_feature
(
cls
,
car
d
_id
,
content_type
=
"diary"
):
try
:
try
:
import
pdb
;
pdb
.
set_trace
()
redis_name_content_linucb_feature
=
cls
.
redis_name_content_linucb_feature_prefix
+
content_type
redis_name_content_linucb_feature
=
cls
.
redis_name_content_linucb_feature_prefix
+
content_type
user_feature_list
=
list
()
user_feature_list
=
list
()
content_feature_redis_data
=
redis_client
.
hget
(
redis_name_content_linucb_feature
,
car_id
)
content_feature_redis_data
=
redis_client
.
hget
(
redis_name_content_linucb_feature
,
car
d
_id
)
if
content_feature_redis_data
:
if
content_feature_redis_data
:
content_feature_redis_list
=
json
.
loads
(
content_feature_redis_data
)
content_feature_redis_list
=
json
.
loads
(
content_feature_redis_data
)
user_feature_list
=
[
float
(
item
)
for
item
in
content_feature_redis_list
]
user_feature_list
=
[
float
(
item
)
for
item
in
content_feature_redis_list
]
...
@@ -215,6 +214,11 @@ if __name__ == "__main__":
...
@@ -215,6 +214,11 @@ if __name__ == "__main__":
diary_fd
=
open
(
diary_click_file
,
"r"
)
diary_fd
=
open
(
diary_click_file
,
"r"
)
for
line
in
diary_fd
.
readlines
():
for
line
in
diary_fd
.
readlines
():
line
=
line
.
strip
()
line
=
line
.
strip
(
"
\n
"
)
line
=
line
.
strip
(
"
\r
"
)
line
=
line
.
strip
(
" "
)
item_list
=
line
.
split
(
","
)
item_list
=
line
.
split
(
","
)
device_id
=
item_list
[
3
]
device_id
=
item_list
[
3
]
diary_id
=
item_list
[
4
]
diary_id
=
item_list
[
4
]
...
...
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