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
75a889f4
Commit
75a889f4
authored
Aug 06, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs
parent
8b0682b3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
diary-training.py
diary-training.py
+5
-2
No files found.
diary-training.py
View file @
75a889f4
...
...
@@ -4,6 +4,8 @@ import pandas as pd
from
sklearn.utils
import
shuffle
import
numpy
as
np
import
xlearn
as
xl
# 从数据库的表里获取数据,并转化成df格式
def
con_sql
(
sql
):
db
=
pymysql
.
connect
(
host
=
'10.66.157.22'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
...
...
@@ -14,6 +16,7 @@ def con_sql(sql):
db
.
close
()
return
df
# 获取点击表里的device_id
sql
=
"select distinct device_id from data_feed_click"
click_device_id
=
con_sql
(
sql
)[
0
]
.
values
.
tolist
()
...
...
@@ -161,9 +164,9 @@ ffm_model.setTrain("/home/zhangyanzhao/data.csv")
# ffm_model.setValidate("/home/zhangyanzhao/validation.csv")
param
=
{
'task'
:
'binary'
,
'lr'
:
0.05
,
'lambda'
:
0.002
,
'metric'
:
'auc'
}
'lambda'
:
0.002
,
'metric'
:
'auc'
,
'fold'
:
3
}
ffm_model
.
fit
(
param
,
'/home/zhangyanzhao/model.out'
)
ffm_model
.
cv
(
param
,
'/home/zhangyanzhao/model.out'
)
'''
ffm_model.setTest("/home/zhangyanzhao/test.csv")
...
...
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