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
a766cc94
Commit
a766cc94
authored
Sep 03, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
service id for tractate
parent
e9d3ba5a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
4 deletions
+12
-4
fe.py
src/models/esmm/fe/fe.py
+1
-1
tractate_fe.py
src/models/esmm/fe/tractate_fe.py
+4
-0
tractate_model.py
src/models/esmm/tractate_model.py
+2
-0
train_tractate.py
src/train_tractate.py
+5
-3
No files found.
src/models/esmm/fe/fe.py
View file @
a766cc94
...
@@ -33,7 +33,7 @@ def build_features(df, int_columns, float_columns, categorical_columns, cross_co
...
@@ -33,7 +33,7 @@ def build_features(df, int_columns, float_columns, categorical_columns, cross_co
elif
col
in
[
elif
col
in
[
"show_tag_id"
,
"click_tractate_id1"
,
"click_tractate_id2"
,
"click_tractate_id3"
,
"click_tractate_id4"
,
"show_tag_id"
,
"click_tractate_id1"
,
"click_tractate_id2"
,
"click_tractate_id3"
,
"click_tractate_id4"
,
"click_tractate_id5"
,
"click_diary_id1"
,
"click_diary_id2"
,
"click_diary_id3"
,
"click_diary_id4"
,
"click_tractate_id5"
,
"click_diary_id1"
,
"click_diary_id2"
,
"click_diary_id3"
,
"click_diary_id4"
,
"click_diary_id5"
"click_diary_id5"
,
"service_id"
,
"recommend_service_id"
]:
]:
categorical_features
.
append
(
categorical_features
.
append
(
fc
.
embedding_column
(
fc
.
categorical_column_with_hash_bucket
(
col
,
20000
),
dimension
=
int
(
df
[
col
]
.
size
**
0.25
)))
fc
.
embedding_column
(
fc
.
categorical_column_with_hash_bucket
(
col
,
20000
),
dimension
=
int
(
df
[
col
]
.
size
**
0.25
)))
...
...
src/models/esmm/fe/tractate_fe.py
View file @
a766cc94
...
@@ -121,9 +121,11 @@ TRACTATE_COLUMNS = [
...
@@ -121,9 +121,11 @@ TRACTATE_COLUMNS = [
"business_second_skip_num"
,
"business_second_skip_num"
,
"effect_second_skip_rate"
,
"effect_second_skip_rate"
,
"business_second_skip_rate"
,
"business_second_skip_rate"
,
"service_id"
,
"service_price"
,
"service_price"
,
"service_sold_num"
,
"service_sold_num"
,
"service_city"
,
"service_city"
,
"recommend_service_id"
,
]
]
INT_COLUMNS
=
[
INT_COLUMNS
=
[
...
@@ -287,7 +289,9 @@ CATEGORICAL_COLUMNS = [
...
@@ -287,7 +289,9 @@ CATEGORICAL_COLUMNS = [
"click_tractate_id4"
,
"click_tractate_id4"
,
"click_tractate_id5"
,
"click_tractate_id5"
,
"is_related_service"
,
"is_related_service"
,
"service_id"
,
"service_city"
,
"service_city"
,
"recommend_service_id"
,
# "device_fd2",
# "device_fd2",
# "device_sd2",
# "device_sd2",
# "device_fs2",
# "device_fs2",
...
...
src/models/esmm/tractate_model.py
View file @
a766cc94
...
@@ -166,7 +166,9 @@ _categorical_columns = [
...
@@ -166,7 +166,9 @@ _categorical_columns = [
"click_tractate_id3"
,
"click_tractate_id3"
,
"click_tractate_id4"
,
"click_tractate_id4"
,
"click_tractate_id5"
,
"click_tractate_id5"
,
"service_id"
,
"service_city"
,
"service_city"
,
"recommend_service_id"
,
# "device_fd2",
# "device_fd2",
# "device_sd2",
# "device_sd2",
# "device_fs2",
# "device_fs2",
...
...
src/train_tractate.py
View file @
a766cc94
...
@@ -62,7 +62,8 @@ def main():
...
@@ -62,7 +62,8 @@ def main():
estimator_config
=
tf
.
estimator
.
RunConfig
(
session_config
=
session_config
)
estimator_config
=
tf
.
estimator
.
RunConfig
(
session_config
=
session_config
)
model
=
tf
.
estimator
.
Estimator
(
model_fn
=
esmm_model_fn
,
params
=
params
,
model_dir
=
model_path
,
config
=
estimator_config
)
model
=
tf
.
estimator
.
Estimator
(
model_fn
=
esmm_model_fn
,
params
=
params
,
model_dir
=
model_path
,
config
=
estimator_config
)
train_spec
=
tf
.
estimator
.
TrainSpec
(
input_fn
=
lambda
:
esmm_input_fn
(
train_df
,
shuffle
=
True
),
max_steps
=
50000
)
# TODO 50000
train_spec
=
tf
.
estimator
.
TrainSpec
(
input_fn
=
lambda
:
esmm_input_fn
(
train_df
,
shuffle
=
True
),
max_steps
=
15000
)
eval_spec
=
tf
.
estimator
.
EvalSpec
(
input_fn
=
lambda
:
esmm_input_fn
(
val_df
,
shuffle
=
False
))
eval_spec
=
tf
.
estimator
.
EvalSpec
(
input_fn
=
lambda
:
esmm_input_fn
(
val_df
,
shuffle
=
False
))
res
=
tf
.
estimator
.
train_and_evaluate
(
model
,
train_spec
,
eval_spec
)
res
=
tf
.
estimator
.
train_and_evaluate
(
model
,
train_spec
,
eval_spec
)
print
(
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
)
print
(
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
)
...
@@ -77,8 +78,9 @@ def main():
...
@@ -77,8 +78,9 @@ def main():
model_export_path
=
str
(
Path
(
"/data/files/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
)
# TODO save model
record_esmm_auc_to_db
(
"tractate"
,
ctr_auc
,
ctcvr_auc
,
total_time
,
save_path
)
# set_essm_model_save_path("tractate", save_path)
# record_esmm_auc_to_db("tractate", ctr_auc, ctcvr_auc, total_time, save_path)
print
(
"============================================================"
)
print
(
"============================================================"
)
# save_path = get_essm_model_save_path("tractate")
# save_path = get_essm_model_save_path("tractate")
...
...
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