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
d5f8d3a9
Commit
d5f8d3a9
authored
Apr 01, 2019
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改预测集sql
parent
7f03848e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
feature.py
tensnsorflow/es/feature.py
+1
-1
test.py
tensnsorflow/test.py
+11
-11
No files found.
tensnsorflow/es/feature.py
View file @
d5f8d3a9
...
...
@@ -136,7 +136,7 @@ def get_predict(date,value_map,app_list_map,level2_map):
"left join cid_type_top c on e.device_id = c.device_id "
\
"left join cid_time_cut cut on e.cid_id = cut.cid "
\
"left join device_app_list dl on e.device_id = dl.device_id "
\
"left join diary_feat feat on e.cid_id = feat.diary_id
limit 600
"
"left join diary_feat feat on e.cid_id = feat.diary_id"
df
=
con_sql
(
db
,
sql
)
df
=
df
.
rename
(
columns
=
{
0
:
"y"
,
1
:
"z"
,
2
:
"label"
,
3
:
"ucity_id"
,
4
:
"clevel2_id"
,
5
:
"ccity_name"
,
6
:
"device_type"
,
7
:
"manufacturer"
,
8
:
"channel"
,
9
:
"top"
,
...
...
tensnsorflow/test.py
View file @
d5f8d3a9
import
datetime
#
from pyspark.sql import HiveContext
#
from pyspark.context import SparkContext
#
from pyspark.conf import SparkConf
#
from pyspark.sql import SQLContext
#
from pyspark.sql import SparkSession
from
pyspark.sql
import
HiveContext
from
pyspark.context
import
SparkContext
from
pyspark.conf
import
SparkConf
from
pyspark.sql
import
SQLContext
from
pyspark.sql
import
SparkSession
# from py4j.java_gateway import java_import
# import pytispark.pytispark as pti
import
pandas
as
pd
...
...
@@ -26,12 +26,12 @@ def con_sql(db,sql):
# def test():
#
conf = SparkConf().setAppName("My App").set("spark.io.compression.codec", "lzf")
#
sc = SparkContext(conf = conf)
#
hive_context = HiveContext(sc)
#
hive_context.sql(''' select device["device_type"] from online.tl_hdfs_maidian_view
#
where partition_date = '20181012' and action = "page_view"
#
and params["page_name"] = "diary_detail" and params["referrer"] = "home" limit 10 ''').show(6)
conf
=
SparkConf
()
.
setAppName
(
"My App"
)
.
set
(
"spark.io.compression.codec"
,
"lzf"
)
sc
=
SparkContext
(
conf
=
conf
)
hive_context
=
HiveContext
(
sc
)
hive_context
.
sql
(
''' select device["device_type"] from online.tl_hdfs_maidian_view
where partition_date = '20181012' and action = "page_view"
and params["page_name"] = "diary_detail" and params["referrer"] = "home" limit 10 '''
)
.
show
(
6
)
# def esmm_pre():
...
...
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