Fix use of case class
Closes #16
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 @@
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
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 @@
)
}
- new PredictedResult(itemScores)
+ PredictedResult(itemScores)
}
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 @@
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() = {