Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ydl_ai_recommender
Overview
Overview
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
闫发泽
ydl_ai_recommender
Commits
ae5af70b
Commit
ae5af70b
authored
Mar 13, 2023
by
柴鹏飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
精排模型调整
parent
9664b944
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
3 deletions
+7
-3
requirements.txt
requirements.txt
+2
-0
profile.py
src/core/profile.py
+1
-1
ranker.py
src/core/rank/ranker.py
+1
-1
train.py
src/core/rank/train.py
+3
-1
No files found.
requirements.txt
View file @
ae5af70b
...
...
@@ -5,3 +5,5 @@ numpy
openpyxl
tornado
==6.2
scikit-learn
src/core/profile.py
View file @
ae5af70b
...
...
@@ -237,7 +237,7 @@ class MultiChoiceProfile(BaseProfile):
def
__init__
(
self
,
option_dict
:
Dict
[
Any
,
int
])
->
None
:
super
()
.
__init__
()
self
.
dim
=
6
self
.
dim
=
len
(
option_dict
)
self
.
option_dict
=
option_dict
self
.
re_option_dict
=
{
v
:
k
for
k
,
v
in
self
.
option_dict
.
items
()}
...
...
src/core/rank/ranker.py
View file @
ae5af70b
...
...
@@ -34,7 +34,7 @@ class Ranker():
self
.
counselor_embeddings_dimension
=
171
self
.
counselor_embeddings
=
self
.
_load_counselor_embeddings
()
model_path
=
os
.
path
.
join
(
get_model_path
(),
'ranker'
,
'
LR_v1.1
.pkl'
)
model_path
=
os
.
path
.
join
(
get_model_path
(),
'ranker'
,
'
RF.1.0
.pkl'
)
with
open
(
model_path
,
'rb'
)
as
f
:
self
.
model
=
pickle
.
load
(
f
)
...
...
src/core/rank/train.py
View file @
ae5af70b
...
...
@@ -41,7 +41,7 @@ def main(args):
model
.
fit
(
x_train
,
y_train
)
print
(
'模型训练完成'
)
model_save_path
=
os
.
path
.
join
(
args
.
save_path
,
args
.
model
+
'
.pkl'
)
model_save_path
=
os
.
path
.
join
(
args
.
save_path
,
f
'{args.model}.{args.save_version}
.pkl'
)
with
open
(
model_save_path
,
'wb'
)
as
f
:
pickle
.
dump
(
model
,
f
)
print
(
'模型已保存至 '
,
model_save_path
)
...
...
@@ -63,6 +63,7 @@ if __name__ == '__main__':
parser
.
add_argument
(
'-m'
,
'--model'
,
type
=
str
,
default
=
'LR'
,
choices
=
list
(
models
.
keys
()),
help
=
'模型类型'
)
parser
.
add_argument
(
'--data_path'
,
type
=
str
,
default
=
'./data'
,
help
=
'训练数据存放目录'
)
parser
.
add_argument
(
'--save_path'
,
type
=
str
,
default
=
'./model'
,
help
=
'训练好的模型存放目录'
)
parser
.
add_argument
(
'-v'
,
'--save_version'
,
type
=
str
,
default
=
'latest'
,
help
=
'模型版本'
)
parser
.
add_argument
(
'--do_test'
,
default
=
False
,
action
=
'store_true'
,
help
=
'训练完成后执行测试程序'
)
args
=
parser
.
parse_args
()
main
(
args
)
\ No newline at end of file
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