Fix use of case class in similarproduct examples Closes #414
Project: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/commit/83f5ef70 Tree: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/tree/83f5ef70 Diff: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/diff/83f5ef70 Branch: refs/heads/master Commit: 83f5ef706b6bedcfb00c3dd522f4fd82057b3009 Parents: 5aea927 Author: Naoki Takezoe <[email protected]> Authored: Wed Jul 19 10:27:07 2017 +0900 Committer: Naoki Takezoe <[email protected]> Committed: Wed Jul 19 10:27:07 2017 +0900 ---------------------------------------------------------------------- .../source/templates/similarproduct/dase.html.md.erb | 14 +++++++------- .../multi-events-multi-algos.html.md.erb | 2 +- .../similarproduct/return-item-properties.html.md.erb | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/83f5ef70/docs/manual/source/templates/similarproduct/dase.html.md.erb ---------------------------------------------------------------------- diff --git a/docs/manual/source/templates/similarproduct/dase.html.md.erb b/docs/manual/source/templates/similarproduct/dase.html.md.erb index a7db937..d9dd677 100644 --- a/docs/manual/source/templates/similarproduct/dase.html.md.erb +++ b/docs/manual/source/templates/similarproduct/dase.html.md.erb @@ -35,7 +35,7 @@ case class Query( categories: Option[Set[String]], whiteList: Option[Set[String]], blackList: Option[Set[String]] -) extends Serializable +) ``` The `PredictedResult` case class defines the format of **predicted result**, @@ -55,12 +55,12 @@ with: ```scala case class PredictedResult( itemScores: Array[ItemScore] -) extends Serializable +) case class ItemScore( item: String, score: Double -) extends Serializable +) ``` Finally, `SimilarProductEngine` is the *Engine Factory* that defines the @@ -531,13 +531,13 @@ INFO: You can easily modify `isCandidate()` checking or `whiteList` generation i val topScores = getTopN(filteredScore, query.num)(ord).toArray val itemScores = topScores.map { case (i, s) => - new ItemScore( + ItemScore( item = model.itemIntStringMap(i), score = s ) } - new PredictedResult(itemScores) + PredictedResult(itemScores) } ``` @@ -545,13 +545,13 @@ Note that the item IDs in top N results are the `Int` indices. You map them back ```scala val itemScores = topScores.map { case (i, s) => - new ItemScore( + ItemScore( item = model.itemIntStringMap(i), score = s ) } - new PredictedResult(itemScores) + PredictedResult(itemScores) ``` PredictionIO passes the returned `PredictedResult` object to *Serving*. http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/83f5ef70/docs/manual/source/templates/similarproduct/multi-events-multi-algos.html.md.erb ---------------------------------------------------------------------- diff --git a/docs/manual/source/templates/similarproduct/multi-events-multi-algos.html.md.erb b/docs/manual/source/templates/similarproduct/multi-events-multi-algos.html.md.erb index 9c93750..f863df1 100644 --- a/docs/manual/source/templates/similarproduct/multi-events-multi-algos.html.md.erb +++ b/docs/manual/source/templates/similarproduct/multi-events-multi-algos.html.md.erb @@ -331,7 +331,7 @@ class Serving .take(query.num) .map { case (k,v) => ItemScore(k, v) } - new PredictedResult(combined) + PredictedResult(combined) } } http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/83f5ef70/docs/manual/source/templates/similarproduct/return-item-properties.html.md.erb ---------------------------------------------------------------------- diff --git a/docs/manual/source/templates/similarproduct/return-item-properties.html.md.erb b/docs/manual/source/templates/similarproduct/return-item-properties.html.md.erb index a23518e..3f70e6c 100644 --- a/docs/manual/source/templates/similarproduct/return-item-properties.html.md.erb +++ b/docs/manual/source/templates/similarproduct/return-item-properties.html.md.erb @@ -102,7 +102,7 @@ Modify how to create the ItemScore object using the properties. val itemScores = topScores.map { case (i, s) => // MODIFIED val it = model.items(i) - new ItemScore( + ItemScore( item = model.itemIntStringMap(i), title = it.title, date = it.date,
