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
36a2cdf5
Commit
36a2cdf5
authored
Jan 09, 2019
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add check
parent
e33b91dc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
16 deletions
+5
-16
ffm.py
tensnsorflow/ffm.py
+4
-5
test.py
tensnsorflow/test.py
+1
-11
No files found.
tensnsorflow/ffm.py
View file @
36a2cdf5
...
@@ -141,16 +141,15 @@ def check():
...
@@ -141,16 +141,15 @@ def check():
sql
=
"select max(stat_date) from esmm_train_data"
sql
=
"select max(stat_date) from esmm_train_data"
validate_date
=
con_sql
(
db
,
sql
)[
0
]
.
values
.
tolist
()[
0
]
validate_date
=
con_sql
(
db
,
sql
)[
0
]
.
values
.
tolist
()[
0
]
print
(
"validate_date:"
+
validate_date
)
print
(
"validate_date:"
+
validate_date
)
temp
=
datetime
.
datetime
.
strptime
(
validate_date
,
"
%
Y-
%
m-
%
d"
)
#
temp = datetime.datetime.strptime(validate_date, "%Y-%m-%d")
start
=
(
temp
-
datetime
.
timedelta
(
days
=
3
0
))
.
strftime
(
"
%
Y-
%
m-
%
d"
)
# start = (temp - datetime.timedelta(days=9
0)).strftime("%Y-%m-%d")
print
(
start
)
#
print(start)
db
=
pymysql
.
connect
(
host
=
'10.66.157.22'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
db
=
pymysql
.
connect
(
host
=
'10.66.157.22'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
sql
=
"select e.y,e.z,e.stat_date,e.ucity_id,e.clevel1_id,e.ccity_name,"
\
sql
=
"select e.y,e.z,e.stat_date,e.ucity_id,e.clevel1_id,e.ccity_name,"
\
"u.device_type,u.manufacturer,u.channel,c.top,df.level2_ids,e.device_id "
\
"u.device_type,u.manufacturer,u.channel,c.top,df.level2_ids,e.device_id "
\
"from esmm_train_data e left join user_feature u on e.device_id = u.device_id "
\
"from esmm_train_data e left join user_feature u on e.device_id = u.device_id "
\
"left join cid_type_top c on e.device_id = c.device_id "
\
"left join cid_type_top c on e.device_id = c.device_id "
\
"left join diary_feat df on e.cid_id = df.diary_id "
\
"left join diary_feat df on e.cid_id = df.diary_id"
"where e.stat_date >= '{}'"
.
format
(
start
)
df
=
con_sql
(
db
,
sql
)
df
=
con_sql
(
db
,
sql
)
print
(
df
.
shape
)
print
(
df
.
shape
)
df
=
df
.
rename
(
columns
=
{
0
:
"y"
,
1
:
"z"
,
2
:
"stat_date"
,
3
:
"ucity_id"
,
4
:
"clevel1_id"
,
5
:
"ccity_name"
,
df
=
df
.
rename
(
columns
=
{
0
:
"y"
,
1
:
"z"
,
2
:
"stat_date"
,
3
:
"ucity_id"
,
4
:
"clevel1_id"
,
5
:
"ccity_name"
,
...
...
tensnsorflow/test.py
View file @
36a2cdf5
...
@@ -29,6 +29,7 @@ def exp():
...
@@ -29,6 +29,7 @@ def exp():
db
=
pymysql
.
connect
(
host
=
'10.66.157.22'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_prod'
)
db
=
pymysql
.
connect
(
host
=
'10.66.157.22'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_prod'
)
sql
=
"select diary_id,level1_ids,level2_ids,level3_ids from diary_feat where diary_id in {}"
.
format
(
native
)
sql
=
"select diary_id,level1_ids,level2_ids,level3_ids from diary_feat where diary_id in {}"
.
format
(
native
)
df
=
con_sql
(
db
,
sql
)
df
=
con_sql
(
db
,
sql
)
df
.
drop_duplicates
n
=
df
.
shape
[
0
]
n
=
df
.
shape
[
0
]
one
=
df
[
1
]
.
unique
()
one
=
df
[
1
]
.
unique
()
...
@@ -75,19 +76,8 @@ def get_cid():
...
@@ -75,19 +76,8 @@ def get_cid():
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
writer
=
tf
.
python_io
.
TFRecordWriter
(
'csv_train.tfrecords'
)
for
i
in
xrange
(
train_values
.
shape
[
0
]):
image_raw
=
train_values
[
i
]
.
tostring
()
# build example protobuf
example
=
tf
.
train
.
Example
(
features
=
tf
.
train
.
Features
(
feature
=
{
'image_raw'
:
tf
.
train
.
Feature
(
bytes_list
=
tf
.
train
.
BytesList
(
value
=
[
image_raw
])),
'label'
:
tf
.
train
.
Feature
(
int64_list
=
tf
.
train
.
Int64List
(
value
=
[
train_labels
[
i
]]))
}))
writer
.
write
(
record
=
example
.
SerializeToString
())
writer
.
close
()
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