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
2a7fc7fc
Commit
2a7fc7fc
authored
Sep 30, 2018
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add log
parent
db865d0f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
Main.scala
eda/node2vec/src/main/scala/com/gmei/Main.scala
+7
-2
No files found.
eda/node2vec/src/main/scala/com/gmei/Main.scala
View file @
2a7fc7fc
...
@@ -167,11 +167,12 @@ object Main {
...
@@ -167,11 +167,12 @@ object Main {
(
word1
,
word2
,
entry
.
value
)
(
word1
,
word2
,
entry
.
value
)
}
}
//
remapSecond.take(20).foreach(println)
remapSecond
.
take
(
20
).
foreach
(
println
)
val
score_result
=
remapSecond
.
toDF
(
"cid1"
,
"cid2"
,
"score"
)
val
score_result
=
remapSecond
.
toDF
(
"cid1"
,
"cid2"
,
"score"
)
GmeiConfig
.
writeToJDBCTable
(
score_result
,
table
=
"nd_cid_pairs_cosine_distince"
,
SaveMode
.
Overwrite
)
GmeiConfig
.
writeToJDBCTable
(
score_result
,
table
=
"nd_cid_pairs_cosine_distince"
,
SaveMode
.
Overwrite
)
println
(
"done1"
)
// group by neighbours to get a list of similar words and then take top k
// group by neighbours to get a list of similar words and then take top k
val
result
=
remapSecond
.
groupBy
(
_
.
_1
).
map
{
val
result
=
remapSecond
.
groupBy
(
_
.
_1
).
map
{
...
@@ -180,10 +181,12 @@ object Main {
...
@@ -180,10 +181,12 @@ object Main {
val
similar
=
similarWords
.
toSeq
.
sortBy
(-
1
*
_
.
_3
).
filter
(
_
.
_2
.
startsWith
(
"diary"
)).
take
(
10
).
map
(
_
.
_2
).
mkString
(
","
)
val
similar
=
similarWords
.
toSeq
.
sortBy
(-
1
*
_
.
_3
).
filter
(
_
.
_2
.
startsWith
(
"diary"
)).
take
(
10
).
map
(
_
.
_2
).
mkString
(
","
)
(
word1
,
s
"$similar"
)
(
word1
,
s
"$similar"
)
}
}
//
result.take(20).foreach(println)
result
.
take
(
20
).
foreach
(
println
)
val
similar_result
=
result
.
toDF
(
"cid"
,
"similarity_cid"
)
val
similar_result
=
result
.
toDF
(
"cid"
,
"similarity_cid"
)
GmeiConfig
.
writeToJDBCTable
(
similar_result
,
table
=
"nd_cid_similarity_matrix"
,
SaveMode
.
Overwrite
)
GmeiConfig
.
writeToJDBCTable
(
similar_result
,
table
=
"nd_cid_similarity_matrix"
,
SaveMode
.
Overwrite
)
println
(
"done2"
)
//3. cids queue map to device_id
//3. cids queue map to device_id
...
@@ -213,6 +216,8 @@ object Main {
...
@@ -213,6 +216,8 @@ object Main {
device_queue
.
take
(
20
).
foreach
(
println
)
device_queue
.
take
(
20
).
foreach
(
println
)
GmeiConfig
.
writeToJDBCTable
(
device_queue
,
table
=
"nd_device_cid_similarity_matrix"
,
SaveMode
.
Overwrite
)
GmeiConfig
.
writeToJDBCTable
(
device_queue
,
table
=
"nd_device_cid_similarity_matrix"
,
SaveMode
.
Overwrite
)
println
(
"done3"
)
...
...
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