predictionio-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From take...@apache.org
Subject incubator-predictionio git commit: Fix use of case class in recommender examples
Date Sat, 15 Jul 2017 16:55:47 GMT
Repository: incubator-predictionio
Updated Branches:
  refs/heads/develop 0fc9f7f65 -> 4e2abe5c5


Fix use of case class in recommender examples

Closes #408


Project: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/commit/4e2abe5c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/tree/4e2abe5c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/diff/4e2abe5c

Branch: refs/heads/develop
Commit: 4e2abe5c5bebf8992a89935674131b4dfd11619d
Parents: 0fc9f7f
Author: Naoki Takezoe <takezoe@apache.org>
Authored: Sun Jul 16 01:54:29 2017 +0900
Committer: Naoki Takezoe <takezoe@apache.org>
Committed: Sun Jul 16 01:54:29 2017 +0900

----------------------------------------------------------------------
 .../blacklist-items/src/main/scala/ALSAlgorithm.scala        | 4 ++--
 .../blacklist-items/src/main/scala/Engine.scala              | 8 ++++----
 .../customize-data-prep/src/main/scala/ALSAlgorithm.scala    | 4 ++--
 .../customize-data-prep/src/main/scala/Engine.scala          | 8 ++++----
 .../customize-serving/src/main/scala/ALSAlgorithm.scala      | 4 ++--
 .../customize-serving/src/main/scala/Engine.scala            | 8 ++++----
 .../reading-custom-events/src/main/scala/ALSAlgorithm.scala  | 4 ++--
 .../reading-custom-events/src/main/scala/Engine.scala        | 8 ++++----
 .../train-with-view-event/src/main/scala/ALSAlgorithm.scala  | 4 ++--
 .../train-with-view-event/src/main/scala/Engine.scala        | 8 ++++----
 10 files changed, 30 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/4e2abe5c/examples/scala-parallel-recommendation/blacklist-items/src/main/scala/ALSAlgorithm.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-recommendation/blacklist-items/src/main/scala/ALSAlgorithm.scala
b/examples/scala-parallel-recommendation/blacklist-items/src/main/scala/ALSAlgorithm.scala
index f613f66..d500d67 100644
--- a/examples/scala-parallel-recommendation/blacklist-items/src/main/scala/ALSAlgorithm.scala
+++ b/examples/scala-parallel-recommendation/blacklist-items/src/main/scala/ALSAlgorithm.scala
@@ -103,10 +103,10 @@ class ALSAlgorithm(val ap: ALSAlgorithmParams)
       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/4e2abe5c/examples/scala-parallel-recommendation/blacklist-items/src/main/scala/Engine.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-recommendation/blacklist-items/src/main/scala/Engine.scala
b/examples/scala-parallel-recommendation/blacklist-items/src/main/scala/Engine.scala
index db8351a..4856647 100644
--- a/examples/scala-parallel-recommendation/blacklist-items/src/main/scala/Engine.scala
+++ b/examples/scala-parallel-recommendation/blacklist-items/src/main/scala/Engine.scala
@@ -24,20 +24,20 @@ case class Query(
   user: String,
   num: Int,
   blackList: Set[String] // ADDED
-) extends Serializable
+)
 
 case class PredictedResult(
   itemScores: Array[ItemScore]
-) extends Serializable
+)
 
 case class ActualResult(
   ratings: Array[Rating]
-) extends Serializable
+)
 
 case class ItemScore(
   item: String,
   score: Double
-) extends Serializable
+)
 
 object RecommendationEngine extends EngineFactory {
   def apply() = {

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/4e2abe5c/examples/scala-parallel-recommendation/customize-data-prep/src/main/scala/ALSAlgorithm.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-recommendation/customize-data-prep/src/main/scala/ALSAlgorithm.scala
b/examples/scala-parallel-recommendation/customize-data-prep/src/main/scala/ALSAlgorithm.scala
index b0f874d..65f2f15 100644
--- a/examples/scala-parallel-recommendation/customize-data-prep/src/main/scala/ALSAlgorithm.scala
+++ b/examples/scala-parallel-recommendation/customize-data-prep/src/main/scala/ALSAlgorithm.scala
@@ -101,10 +101,10 @@ class ALSAlgorithm(val ap: ALSAlgorithmParams)
       // 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/4e2abe5c/examples/scala-parallel-recommendation/customize-data-prep/src/main/scala/Engine.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-recommendation/customize-data-prep/src/main/scala/Engine.scala
b/examples/scala-parallel-recommendation/customize-data-prep/src/main/scala/Engine.scala
index b2a668b..65ef516 100644
--- a/examples/scala-parallel-recommendation/customize-data-prep/src/main/scala/Engine.scala
+++ b/examples/scala-parallel-recommendation/customize-data-prep/src/main/scala/Engine.scala
@@ -23,20 +23,20 @@ import org.apache.predictionio.controller.Engine
 case class Query(
   user: String,
   num: Int
-) extends Serializable
+)
 
 case class PredictedResult(
   itemScores: Array[ItemScore]
-) extends Serializable
+)
 
 case class ActualResult(
   ratings: Array[Rating]
-) extends Serializable
+)
 
 case class ItemScore(
   item: String,
   score: Double
-) extends Serializable
+)
 
 object RecommendationEngine extends EngineFactory {
   def apply() = {

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/4e2abe5c/examples/scala-parallel-recommendation/customize-serving/src/main/scala/ALSAlgorithm.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-recommendation/customize-serving/src/main/scala/ALSAlgorithm.scala
b/examples/scala-parallel-recommendation/customize-serving/src/main/scala/ALSAlgorithm.scala
index b0f874d..65f2f15 100644
--- a/examples/scala-parallel-recommendation/customize-serving/src/main/scala/ALSAlgorithm.scala
+++ b/examples/scala-parallel-recommendation/customize-serving/src/main/scala/ALSAlgorithm.scala
@@ -101,10 +101,10 @@ class ALSAlgorithm(val ap: ALSAlgorithmParams)
       // 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/4e2abe5c/examples/scala-parallel-recommendation/customize-serving/src/main/scala/Engine.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-recommendation/customize-serving/src/main/scala/Engine.scala
b/examples/scala-parallel-recommendation/customize-serving/src/main/scala/Engine.scala
index b2a668b..65ef516 100644
--- a/examples/scala-parallel-recommendation/customize-serving/src/main/scala/Engine.scala
+++ b/examples/scala-parallel-recommendation/customize-serving/src/main/scala/Engine.scala
@@ -23,20 +23,20 @@ import org.apache.predictionio.controller.Engine
 case class Query(
   user: String,
   num: Int
-) extends Serializable
+)
 
 case class PredictedResult(
   itemScores: Array[ItemScore]
-) extends Serializable
+)
 
 case class ActualResult(
   ratings: Array[Rating]
-) extends Serializable
+)
 
 case class ItemScore(
   item: String,
   score: Double
-) extends Serializable
+)
 
 object RecommendationEngine extends EngineFactory {
   def apply() = {

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/4e2abe5c/examples/scala-parallel-recommendation/reading-custom-events/src/main/scala/ALSAlgorithm.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-recommendation/reading-custom-events/src/main/scala/ALSAlgorithm.scala
b/examples/scala-parallel-recommendation/reading-custom-events/src/main/scala/ALSAlgorithm.scala
index b0f874d..65f2f15 100644
--- a/examples/scala-parallel-recommendation/reading-custom-events/src/main/scala/ALSAlgorithm.scala
+++ b/examples/scala-parallel-recommendation/reading-custom-events/src/main/scala/ALSAlgorithm.scala
@@ -101,10 +101,10 @@ class ALSAlgorithm(val ap: ALSAlgorithmParams)
       // 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/4e2abe5c/examples/scala-parallel-recommendation/reading-custom-events/src/main/scala/Engine.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-recommendation/reading-custom-events/src/main/scala/Engine.scala
b/examples/scala-parallel-recommendation/reading-custom-events/src/main/scala/Engine.scala
index b2a668b..65ef516 100644
--- a/examples/scala-parallel-recommendation/reading-custom-events/src/main/scala/Engine.scala
+++ b/examples/scala-parallel-recommendation/reading-custom-events/src/main/scala/Engine.scala
@@ -23,20 +23,20 @@ import org.apache.predictionio.controller.Engine
 case class Query(
   user: String,
   num: Int
-) extends Serializable
+)
 
 case class PredictedResult(
   itemScores: Array[ItemScore]
-) extends Serializable
+)
 
 case class ActualResult(
   ratings: Array[Rating]
-) extends Serializable
+)
 
 case class ItemScore(
   item: String,
   score: Double
-) extends Serializable
+)
 
 object RecommendationEngine extends EngineFactory {
   def apply() = {

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/4e2abe5c/examples/scala-parallel-recommendation/train-with-view-event/src/main/scala/ALSAlgorithm.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-recommendation/train-with-view-event/src/main/scala/ALSAlgorithm.scala
b/examples/scala-parallel-recommendation/train-with-view-event/src/main/scala/ALSAlgorithm.scala
index 3aa1953..234aa0d 100644
--- a/examples/scala-parallel-recommendation/train-with-view-event/src/main/scala/ALSAlgorithm.scala
+++ b/examples/scala-parallel-recommendation/train-with-view-event/src/main/scala/ALSAlgorithm.scala
@@ -102,10 +102,10 @@ class ALSAlgorithm(val ap: ALSAlgorithmParams)
       // 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/4e2abe5c/examples/scala-parallel-recommendation/train-with-view-event/src/main/scala/Engine.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-recommendation/train-with-view-event/src/main/scala/Engine.scala
b/examples/scala-parallel-recommendation/train-with-view-event/src/main/scala/Engine.scala
index b2a668b..65ef516 100644
--- a/examples/scala-parallel-recommendation/train-with-view-event/src/main/scala/Engine.scala
+++ b/examples/scala-parallel-recommendation/train-with-view-event/src/main/scala/Engine.scala
@@ -23,20 +23,20 @@ import org.apache.predictionio.controller.Engine
 case class Query(
   user: String,
   num: Int
-) extends Serializable
+)
 
 case class PredictedResult(
   itemScores: Array[ItemScore]
-) extends Serializable
+)
 
 case class ActualResult(
   ratings: Array[Rating]
-) extends Serializable
+)
 
 case class ItemScore(
   item: String,
   score: Double
-) extends Serializable
+)
 
 object RecommendationEngine extends EngineFactory {
   def apply() = {


Mime
View raw message