Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gm_strategy_cvr
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_strategy_cvr
Commits
158c9be0
Commit
158c9be0
authored
Aug 14, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update model path
parent
1a32da74
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
45 deletions
+12
-45
change_city_prediction.py
src/change_city_prediction.py
+2
-2
main_portrait.py
src/main_portrait.py
+2
-2
online_prediction.py
src/online_prediction.py
+2
-2
test.py
src/test.py
+0
-33
train_diary.py
src/train_diary.py
+3
-3
train_tractate.py
src/train_tractate.py
+3
-3
No files found.
src/change_city_prediction.py
View file @
158c9be0
...
@@ -33,13 +33,13 @@ if __name__ == "__main__":
...
@@ -33,13 +33,13 @@ if __name__ == "__main__":
diary_save_path
=
get_essm_model_save_path
(
"diary"
)
diary_save_path
=
get_essm_model_save_path
(
"diary"
)
if
not
diary_save_path
:
if
not
diary_save_path
:
diary_save_path
=
"/
home/gmuser/data
/models/diary/1597050209"
diary_save_path
=
"/
data/files
/models/diary/1597050209"
print
(
diary_save_path
+
"!!!!!!!!!!!!!!!!!!!!!!!!!!!"
)
print
(
diary_save_path
+
"!!!!!!!!!!!!!!!!!!!!!!!!!!!"
)
diary_predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
diary_save_path
)
diary_predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
diary_save_path
)
tractate_save_path
=
get_essm_model_save_path
(
"tractate"
)
tractate_save_path
=
get_essm_model_save_path
(
"tractate"
)
if
not
tractate_save_path
:
if
not
tractate_save_path
:
tractate_save_path
=
"/
home/gmuser/data
/models/tractate/1596509299"
tractate_save_path
=
"/
data/files
/models/tractate/1596509299"
print
(
tractate_save_path
+
"!!!!!!!!!!!!!!!!!!!!!!!!!!!"
)
print
(
tractate_save_path
+
"!!!!!!!!!!!!!!!!!!!!!!!!!!!"
)
tractate_predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
tractate_save_path
)
tractate_predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
tractate_save_path
)
...
...
src/main_portrait.py
View file @
158c9be0
...
@@ -80,13 +80,13 @@ def main():
...
@@ -80,13 +80,13 @@ def main():
diary_save_path
=
get_essm_model_save_path
(
"diary"
)
diary_save_path
=
get_essm_model_save_path
(
"diary"
)
if
not
diary_save_path
:
if
not
diary_save_path
:
diary_save_path
=
"/
home/gmuser/data
/models/diary/1597379800"
diary_save_path
=
"/
data/files
/models/diary/1597379800"
print
(
diary_save_path
+
"!!!!!!!!!!!!!!!!!!!!!!!!!!!"
)
print
(
diary_save_path
+
"!!!!!!!!!!!!!!!!!!!!!!!!!!!"
)
diary_predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
diary_save_path
)
diary_predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
diary_save_path
)
tractate_save_path
=
get_essm_model_save_path
(
"tractate"
)
tractate_save_path
=
get_essm_model_save_path
(
"tractate"
)
if
not
tractate_save_path
:
if
not
tractate_save_path
:
tractate_save_path
=
"/
home/gmuser/data
/models/tractate/1597378202"
tractate_save_path
=
"/
data/files
/models/tractate/1597378202"
print
(
tractate_save_path
+
"!!!!!!!!!!!!!!!!!!!!!!!!!!!"
)
print
(
tractate_save_path
+
"!!!!!!!!!!!!!!!!!!!!!!!!!!!"
)
tractate_predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
tractate_save_path
)
tractate_predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
tractate_save_path
)
...
...
src/online_prediction.py
View file @
158c9be0
...
@@ -45,13 +45,13 @@ if __name__ == "__main__":
...
@@ -45,13 +45,13 @@ if __name__ == "__main__":
diary_save_path
=
get_essm_model_save_path
(
"diary"
)
diary_save_path
=
get_essm_model_save_path
(
"diary"
)
if
not
diary_save_path
:
if
not
diary_save_path
:
diary_save_path
=
"/
home/gmuser/data
/models/diary/1597379800"
diary_save_path
=
"/
data/files
/models/diary/1597379800"
print
(
diary_save_path
+
"!!!!!!!!!!!!!!!!!!!!!!!!!!!"
)
print
(
diary_save_path
+
"!!!!!!!!!!!!!!!!!!!!!!!!!!!"
)
diary_predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
diary_save_path
)
diary_predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
diary_save_path
)
tractate_save_path
=
get_essm_model_save_path
(
"tractate"
)
tractate_save_path
=
get_essm_model_save_path
(
"tractate"
)
if
not
tractate_save_path
:
if
not
tractate_save_path
:
tractate_save_path
=
"/
home/gmuser/data
/models/tractate/1597378202"
tractate_save_path
=
"/
data/files
/models/tractate/1597378202"
print
(
tractate_save_path
+
"!!!!!!!!!!!!!!!!!!!!!!!!!!!"
)
print
(
tractate_save_path
+
"!!!!!!!!!!!!!!!!!!!!!!!!!!!"
)
tractate_predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
tractate_save_path
)
tractate_predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
tractate_save_path
)
...
...
src/test.py
deleted
100644 → 0
View file @
1a32da74
import
datetime
import
time
import
tensorflow
as
tf
from
models.esmm.fe
import
device_fe
,
diary_fe
,
tractate_fe
from
models.esmm.tractate_model
import
model_predict_tractate
from
utils.cache
import
redis_client2
from
utils.grey
import
recommed_service_category_device_id_by_tail
from
utils.portrait
import
(
get_user_portrait_tag3_read_v2
,
user_portrait_tag3_get_candidate_dict
,
user_portrait_tag3_get_candidate_unread_list
,
user_portrait_tag3_write_ctcvr_data
)
if
__name__
==
"__main__"
:
time_begin
=
time
.
time
()
device_dict
=
device_fe
.
get_device_dict_from_redis
()
tractate_dict
=
tractate_fe
.
get_tractate_dict_from_redis
()
print
(
"redis data: "
+
str
(
len
(
device_dict
))
+
" "
+
str
(
len
(
tractate_dict
)))
device_id
=
"androidid_a25a1129c0b38f7b"
tractate_save_path
=
"/home/gmuser/data/models/tractate/1596092061"
tractate_predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
tractate_save_path
)
tractate_ids
=
user_portrait_tag3_get_candidate_unread_list
(
device_id
,
"tractate"
)
print
(
"tractate_ids: "
+
str
(
len
(
tractate_ids
)))
res
=
model_predict_tractate
(
device_id
,
tractate_ids
,
device_dict
,
tractate_dict
,
tractate_predict_fn
)
print
(
"res: "
+
str
(
len
(
res
)))
print
(
res
[:
10
])
user_portrait_tag3_write_ctcvr_data
(
device_id
,
"tractate"
,
res
[:
500
])
total_time
=
(
time
.
time
()
-
time_begin
)
/
60
print
(
"total cost {:.2f} mins at {}"
.
format
(
total_time
,
datetime
.
datetime
.
now
()))
src/train_diary.py
View file @
158c9be0
...
@@ -51,7 +51,7 @@ def main():
...
@@ -51,7 +51,7 @@ def main():
all_features
=
fe
.
build_features
(
df
,
diary_fe
.
INT_COLUMNS
,
diary_fe
.
FLOAT_COLUMNS
,
diary_fe
.
CATEGORICAL_COLUMNS
)
all_features
=
fe
.
build_features
(
df
,
diary_fe
.
INT_COLUMNS
,
diary_fe
.
FLOAT_COLUMNS
,
diary_fe
.
CATEGORICAL_COLUMNS
)
params
=
{
"feature_columns"
:
all_features
,
"hidden_units"
:
[
64
,
32
],
"learning_rate"
:
0.1
}
params
=
{
"feature_columns"
:
all_features
,
"hidden_units"
:
[
64
,
32
],
"learning_rate"
:
0.1
}
model_path
=
str
(
Path
(
"
~/data
/model_tmp/diary/"
)
.
expanduser
())
model_path
=
str
(
Path
(
"
/data/files
/model_tmp/diary/"
)
.
expanduser
())
if
os
.
path
.
exists
(
model_path
):
if
os
.
path
.
exists
(
model_path
):
shutil
.
rmtree
(
model_path
)
shutil
.
rmtree
(
model_path
)
...
@@ -70,14 +70,14 @@ def main():
...
@@ -70,14 +70,14 @@ def main():
print
(
"ctcvr_auc: "
+
str
(
res
[
0
][
"ctcvr_auc"
]))
print
(
"ctcvr_auc: "
+
str
(
res
[
0
][
"ctcvr_auc"
]))
print
(
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
)
print
(
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
)
model_export_path
=
str
(
Path
(
"
~/data
/models/diary"
)
.
expanduser
())
model_export_path
=
str
(
Path
(
"
/data/files
/models/diary"
)
.
expanduser
())
save_path
=
model_export
(
model
,
all_features
,
model_export_path
)
save_path
=
model_export
(
model
,
all_features
,
model_export_path
)
print
(
"save to: "
+
save_path
)
print
(
"save to: "
+
save_path
)
set_essm_model_save_path
(
"diary"
,
save_path
)
set_essm_model_save_path
(
"diary"
,
save_path
)
print
(
"============================================================"
)
print
(
"============================================================"
)
# save_path = str(Path("~/Desktop/models/1596012827").expanduser()) # local
# save_path = str(Path("~/Desktop/models/1596012827").expanduser()) # local
# save_path = "/
home/gmuser/data
/models/diary/1596083349" # server
# save_path = "/
data/files
/models/diary/1596083349" # server
# tf.saved_model.load
# tf.saved_model.load
...
...
src/train_tractate.py
View file @
158c9be0
...
@@ -48,7 +48,7 @@ def main():
...
@@ -48,7 +48,7 @@ def main():
all_features
=
fe
.
build_features
(
df
,
tractate_fe
.
INT_COLUMNS
,
tractate_fe
.
FLOAT_COLUMNS
,
tractate_fe
.
CATEGORICAL_COLUMNS
)
all_features
=
fe
.
build_features
(
df
,
tractate_fe
.
INT_COLUMNS
,
tractate_fe
.
FLOAT_COLUMNS
,
tractate_fe
.
CATEGORICAL_COLUMNS
)
params
=
{
"feature_columns"
:
all_features
,
"hidden_units"
:
[
64
,
32
],
"learning_rate"
:
0.1
}
params
=
{
"feature_columns"
:
all_features
,
"hidden_units"
:
[
64
,
32
],
"learning_rate"
:
0.1
}
model_path
=
str
(
Path
(
"
~/data
/model_tmp/tractate/"
)
.
expanduser
())
model_path
=
str
(
Path
(
"
/data/files
/model_tmp/tractate/"
)
.
expanduser
())
if
os
.
path
.
exists
(
model_path
):
if
os
.
path
.
exists
(
model_path
):
shutil
.
rmtree
(
model_path
)
shutil
.
rmtree
(
model_path
)
...
@@ -67,14 +67,14 @@ def main():
...
@@ -67,14 +67,14 @@ def main():
print
(
"ctcvr_auc: "
+
str
(
res
[
0
][
"ctcvr_auc"
]))
print
(
"ctcvr_auc: "
+
str
(
res
[
0
][
"ctcvr_auc"
]))
print
(
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
)
print
(
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
)
model_export_path
=
str
(
Path
(
"
~/data
/models/tractate/"
)
.
expanduser
())
model_export_path
=
str
(
Path
(
"
/data/files
/models/tractate/"
)
.
expanduser
())
save_path
=
model_export
(
model
,
all_features
,
model_export_path
)
save_path
=
model_export
(
model
,
all_features
,
model_export_path
)
print
(
"save to: "
+
save_path
)
print
(
"save to: "
+
save_path
)
set_essm_model_save_path
(
"tractate"
,
save_path
)
set_essm_model_save_path
(
"tractate"
,
save_path
)
print
(
"============================================================"
)
print
(
"============================================================"
)
# # save_path = str(Path("~/data/models/tractate/1596089465").expanduser()) # local
# # save_path = str(Path("~/data/models/tractate/1596089465").expanduser()) # local
# save_path = "/
home/gmuser/data
/models/tractate/1596092061" # server
# save_path = "/
data/files
/models/tractate/1596092061" # server
predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
save_path
)
predict_fn
=
tf
.
contrib
.
predictor
.
from_saved_model
(
save_path
)
device_dict
=
device_fe
.
get_device_dict_from_redis
()
device_dict
=
device_fe
.
get_device_dict_from_redis
()
...
...
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