blob: df1e007d6f17a5d09a1f9579d311fcee727145e5 [file] [log] [blame]
package org.example.similarproduct
import org.apache.predictionio.controller.EngineFactory
import org.apache.predictionio.controller.Engine
case class Query(
items: List[String],
num: Int,
categories: Option[Set[String]],
categoryBlackList: Option[Set[String]],
whiteList: Option[Set[String]],
blackList: Option[Set[String]]
)
case class PredictedResult(
itemScores: Array[ItemScore]
){
override def toString: String = itemScores.mkString(",")
}
case class ItemScore(
item: String,
score: Double
)
object SimilarProductEngine extends EngineFactory {
def apply() = {
new Engine(
classOf[DataSource],
classOf[Preparator],
Map(
"als" -> classOf[ALSAlgorithm],
"cooccurrence" -> classOf[CooccurrenceAlgorithm]),
classOf[Serving])
}
}