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
ca5aa2d6
Commit
ca5aa2d6
authored
Dec 06, 2018
by
高雅喆
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.wanmeizhensuo.com:ML/ffm-baseline
change pre data from merge 3 recall
parents
5513bf82
fe17b60f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
12 deletions
+30
-12
testt.scala
eda/feededa/src/main/scala/com/gmei/testt.scala
+20
-7
ffm.py
tensnsorflow/ffm.py
+5
-5
test.py
tensnsorflow/test.py
+5
-0
No files found.
eda/feededa/src/main/scala/com/gmei/testt.scala
View file @
ca5aa2d6
...
...
@@ -65,18 +65,15 @@ object testt {
// )
//// agency_id.show()
// agency_id.createOrReplaceTempView("agency_id")
val
a
=
Array
(
"personal_store_diary_list"
,
"question_detail"
,
"received_votes"
,
"search_result"
,
"search_result_diary"
,
"search_result_more"
,
"search_result_welfare"
,
"service_all_cases_service_comment"
,
"spell_special_list"
,
"topic_detail"
,
"welfare_detail"
,
"welfare_list"
,
"welfare_special"
,
"wiki_detail"
,
"zone_detail"
,
"zone_v3"
)
val
a
=
Array
(
"answer_detail"
,
"article_detail"
,
"diary_detail"
,
"home_page"
,
"question_detail"
,
"search_content"
,
"search_diary"
)
for
(
i
<-
0
until
a
.
length
){
val
diary_pv
=
sc
.
sql
(
s
"""
|select partition_date,count(cl_id)
|from online.tl_hdfs_maidian_view
|where action="page_view"
|and params["page_name"]="diary_detail"
|and params["referrer"]='${a(i)}'
|from online.ml_community_exposure_detail
|where business_type ='diary'
|and partition_date >='20181120'
|and event='${a(i)}'
|GROUP BY partition_date
|order by partition_date
"""
.
stripMargin
...
...
@@ -86,6 +83,22 @@ object testt {
}
// val diary_pv = sc.sql(
// s"""
// |select partition_date,count(cl_id)
// |from online.tl_hdfs_maidian_view
// |where action ='on_click_diary_card'
// |and params["page_name"]="home"
// |and params["tab_name"]="精选"
// |and partition_date >='20181120'
// |GROUP BY partition_date
// |order by partition_date
// """.stripMargin
// )
// diary_pv.show()
// GmeiConfig.writeToJDBCTable(view_count, "avg", SaveMode.Overwrite)
...
...
tensnsorflow/ffm.py
View file @
ca5aa2d6
...
...
@@ -21,7 +21,7 @@ def con_sql(db,sql):
def
get_data
():
db
=
pymysql
.
connect
(
host
=
'10.66.157.22'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_prod'
)
sql
=
"select * from esmm_data where stat_date >= '2018-11-20'"
sql
=
"select * from esmm_data where stat_date >= '2018-11-20'
limit 6
"
esmm
=
con_sql
(
db
,
sql
)
esmm
=
esmm
.
rename
(
columns
=
{
0
:
"stat_date"
,
1
:
"device_id"
,
2
:
"ucity_id"
,
3
:
"cid_id"
,
4
:
"diary_service_id"
,
5
:
"y"
,
6
:
"z"
,
7
:
"clevel1_id"
,
8
:
"slevel1_id"
})
...
...
@@ -29,13 +29,13 @@ def get_data():
print
(
esmm
.
head
())
print
(
esmm
.
shape
)
db
=
pymysql
.
connect
(
host
=
'10.66.157.22'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'eagle'
)
sql
=
"select * from home_tab_click"
sql
=
"select * from home_tab_click
limit 6
"
temp
=
con_sql
(
db
,
sql
)
temp
=
temp
.
rename
(
columns
=
{
0
:
"device_id"
})
print
(
"click data ok"
)
# print(temp.head())
df
=
pd
.
merge
(
esmm
,
temp
,
on
=
"device_id"
,
how
=
'left'
)
.
fillna
(
0
)
print
(
"合并后:"
)
#
print("合并后:")
print
(
df
.
shape
)
df
[
"diary_service_id"
]
=
df
[
"diary_service_id"
]
.
astype
(
"str"
)
...
...
@@ -135,9 +135,9 @@ class multiFFMFormatPandas:
col_type
=
t
[
col
]
name
=
'{}_{}'
.
format
(
col
,
val
)
if
col_type
.
kind
==
'O'
:
ffm
.
append
(
'{}:{}:1'
.
format
(
self
.
field_index_
[
col
]
+
1
,
self
.
feature_index_
[
name
]
+
1
))
ffm
.
append
(
'{}:{}:1'
.
format
(
self
.
field_index_
[
col
]
+
1
,
self
.
feature_index_
[
name
]))
elif
col_type
.
kind
==
'i'
:
ffm
.
append
(
'{}:{}:{}'
.
format
(
self
.
field_index_
[
col
]
+
1
,
self
.
feature_index_
[
col
]
+
1
,
val
))
ffm
.
append
(
'{}:{}:{}'
.
format
(
self
.
field_index_
[
col
]
+
1
,
self
.
feature_index_
[
col
],
val
))
result
=
' '
.
join
(
ffm
)
if
self
.
y
is
not
None
:
result
=
str
(
row
.
loc
[
row
.
index
==
self
.
y
][
0
])
+
","
+
result
...
...
tensnsorflow/test.py
0 → 100644
View file @
ca5aa2d6
import
time
for
i
in
range
(
1
,
100
):
print
(
i
)
time
.
sleep
(
5
)
\ 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