Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

embedding.scala #9

Closed
monkeyshichi opened this issue Oct 25, 2020 · 1 comment
Closed

embedding.scala #9

monkeyshichi opened this issue Oct 25, 2020 · 1 comment

Comments

@monkeyshichi
Copy link

monkeyshichi commented Oct 25, 2020

userEmb = user._2.foldRightArray[Float]((row, newEmb) => {
val movieId = row.getAsString
val movieEmb = word2VecModel.getVectors.get(movieId)
if(movieEmb.isDefined){
newEmb.zip(movieEmb.get).map { case (x, y) => x + y }
}else{
newEmb
}
})

老师,这段代码能解释下吗?user._2.foldRightArray[Float],(userEmb) 是什么意思,row, newEmb,这些参数是啥意思 ,movieEmb.get 为啥能这么写,是什么意思,
if(movieEmb.isDefined){
newEmb.zip(movieEmb.get).map { case (x, y) => x + y }
}else{
newEmb
}
这个又是起什么作用?

@monkeyshichi
Copy link
Author

解决了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant