Repository: incubator-predictionio Updated Branches: refs/heads/livedoc 75cfe461c -> 5aea9272e
Fix use of case class in recommender examples Closes #409 Project: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/commit/49a6a78a Tree: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/tree/49a6a78a Diff: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/diff/49a6a78a Branch: refs/heads/livedoc Commit: 49a6a78a364ea786b22cb3ccb60ea74d98847acd Parents: 75cfe46 Author: Naoki Takezoe <[email protected]> Authored: Sun Jul 16 01:59:27 2017 +0900 Committer: Naoki Takezoe <[email protected]> Committed: Sun Jul 16 01:59:27 2017 +0900 ---------------------------------------------------------------------- .../templates/recommendation/blacklist-items.html.md | 6 +++--- .../source/templates/recommendation/dase.html.md.erb | 10 +++++----- .../templates/recommendation/evaluation.html.md.erb | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/49a6a78a/docs/manual/source/templates/recommendation/blacklist-items.html.md ---------------------------------------------------------------------- diff --git a/docs/manual/source/templates/recommendation/blacklist-items.html.md b/docs/manual/source/templates/recommendation/blacklist-items.html.md index 70d1585..99e1bc7 100644 --- a/docs/manual/source/templates/recommendation/blacklist-items.html.md +++ b/docs/manual/source/templates/recommendation/blacklist-items.html.md @@ -37,7 +37,7 @@ case class Query( user: String, num: Int, blackList: Set[String] // ADDED -) extends Serializable +) ``` ## Filter the Data @@ -93,10 +93,10 @@ Lets modify method `predict` in MyRecommendation/src/main/scala/***ALSAlgorithm. val itemScores = model .recommendProductsWithFilter(userInt, query.num, blackList) // MODIFIED .map (r => ItemScore(itemIntStringMap(r.product), r.rating)) - new PredictedResult(itemScores) + PredictedResult(itemScores) }.getOrElse{ logger.info(s"No prediction for unknown user ${query.user}.") - new PredictedResult(Array.empty) + PredictedResult(Array.empty) } } ``` http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/49a6a78a/docs/manual/source/templates/recommendation/dase.html.md.erb ---------------------------------------------------------------------- diff --git a/docs/manual/source/templates/recommendation/dase.html.md.erb b/docs/manual/source/templates/recommendation/dase.html.md.erb index 3a3f58b..32f1f8b 100644 --- a/docs/manual/source/templates/recommendation/dase.html.md.erb +++ b/docs/manual/source/templates/recommendation/dase.html.md.erb @@ -36,7 +36,7 @@ defines the format of such **query**: case class Query( user: String, num: Int -) extends Serializable +) ``` The `PredictedResult` case class defines the format of **predicted result**, @@ -56,12 +56,12 @@ with: ```scala case class PredictedResult( itemScores: Array[ItemScore] -) extends Serializable +) case class ItemScore( item: String, score: Double -) extends Serializable +) ``` Finally, `RecommendationEngine` is the *Engine Factory* that defines the @@ -386,10 +386,10 @@ predicts the top *num* of items a user will like. // index. Convert it to String ID for returning PredictedResult val itemScores = model.recommendProducts(userInt, query.num) .map (r => ItemScore(itemIntStringMap(r.product), r.rating)) - new PredictedResult(itemScores) + PredictedResult(itemScores) }.getOrElse{ logger.info(s"No prediction for unknown user ${query.user}.") - new PredictedResult(Array.empty) + PredictedResult(Array.empty) } } ``` http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/49a6a78a/docs/manual/source/templates/recommendation/evaluation.html.md.erb ---------------------------------------------------------------------- diff --git a/docs/manual/source/templates/recommendation/evaluation.html.md.erb b/docs/manual/source/templates/recommendation/evaluation.html.md.erb index 15522a7..564c83c 100644 --- a/docs/manual/source/templates/recommendation/evaluation.html.md.erb +++ b/docs/manual/source/templates/recommendation/evaluation.html.md.erb @@ -180,7 +180,7 @@ It stores the list of ratings in the validation set for a user. ```scala case class ActualResult( ratings: Array[Rating] -) extends Serializable +) ``` ### Implement Data Generate Method in DataSource
