You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@predictionio.apache.org by ta...@apache.org on 2017/07/19 01:18:28 UTC
incubator-predictionio-template-similar-product git commit: Fix use
of case class
Repository: incubator-predictionio-template-similar-product
Updated Branches:
refs/heads/develop a0585011e -> 392f34769
Fix use of case class
Closes #16
Project: http://git-wip-us.apache.org/repos/asf/incubator-predictionio-template-similar-product/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-predictionio-template-similar-product/commit/392f3476
Tree: http://git-wip-us.apache.org/repos/asf/incubator-predictionio-template-similar-product/tree/392f3476
Diff: http://git-wip-us.apache.org/repos/asf/incubator-predictionio-template-similar-product/diff/392f3476
Branch: refs/heads/develop
Commit: 392f34769e3e523d8818aa5ac46e3a40de4b2390
Parents: a058501
Author: Naoki Takezoe <ta...@apache.org>
Authored: Wed Jul 19 10:13:10 2017 +0900
Committer: Naoki Takezoe <ta...@apache.org>
Committed: Wed Jul 19 10:13:10 2017 +0900
----------------------------------------------------------------------
src/main/scala/ALSAlgorithm.scala | 4 ++--
src/main/scala/CooccurrenceAlgorithm.scala | 2 +-
src/main/scala/Engine.scala | 6 +++---
3 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-predictionio-template-similar-product/blob/392f3476/src/main/scala/ALSAlgorithm.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/ALSAlgorithm.scala b/src/main/scala/ALSAlgorithm.scala
index 7cdf6e9..435a9b5 100644
--- a/src/main/scala/ALSAlgorithm.scala
+++ b/src/main/scala/ALSAlgorithm.scala
@@ -168,13 +168,13 @@ class ALSAlgorithm(val ap: ALSAlgorithmParams)
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)
}
private
http://git-wip-us.apache.org/repos/asf/incubator-predictionio-template-similar-product/blob/392f3476/src/main/scala/CooccurrenceAlgorithm.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/CooccurrenceAlgorithm.scala b/src/main/scala/CooccurrenceAlgorithm.scala
index b56ecec..c6e0e08 100644
--- a/src/main/scala/CooccurrenceAlgorithm.scala
+++ b/src/main/scala/CooccurrenceAlgorithm.scala
@@ -129,7 +129,7 @@ class CooccurrenceAlgorithm(val ap: CooccurrenceAlgorithmParams)
)
}
- new PredictedResult(itemScores)
+ PredictedResult(itemScores)
}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio-template-similar-product/blob/392f3476/src/main/scala/Engine.scala
----------------------------------------------------------------------
diff --git a/src/main/scala/Engine.scala b/src/main/scala/Engine.scala
index c4a7459..df1e007 100644
--- a/src/main/scala/Engine.scala
+++ b/src/main/scala/Engine.scala
@@ -10,18 +10,18 @@ case class Query(
categoryBlackList: Option[Set[String]],
whiteList: Option[Set[String]],
blackList: Option[Set[String]]
-) extends Serializable
+)
case class PredictedResult(
itemScores: Array[ItemScore]
-) extends Serializable {
+){
override def toString: String = itemScores.mkString(",")
}
case class ItemScore(
item: String,
score: Double
-) extends Serializable
+)
object SimilarProductEngine extends EngineFactory {
def apply() = {