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 similarproduct examples
Date Wed, 19 Jul 2017 01:26:53 GMT
Repository: incubator-predictionio
Updated Branches:
  refs/heads/develop 42d6d428e -> 96d4c54ab


Fix use of case class in similarproduct examples

Closes #413


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

Branch: refs/heads/develop
Commit: 96d4c54abca4aee2a7f4c83b8465337f140aa0fd
Parents: 42d6d42
Author: Naoki Takezoe <takezoe@apache.org>
Authored: Wed Jul 19 10:24:40 2017 +0900
Committer: Naoki Takezoe <takezoe@apache.org>
Committed: Wed Jul 19 10:24:40 2017 +0900

----------------------------------------------------------------------
 .../multi-events-multi-algos/src/main/scala/ALSAlgorithm.scala | 4 ++--
 .../src/main/scala/CooccurrenceAlgorithm.scala                 | 2 +-
 .../multi-events-multi-algos/src/main/scala/Engine.scala       | 6 +++---
 .../multi-events-multi-algos/src/main/scala/Serving.scala      | 2 +-
 .../recommended-user/src/main/scala/ALSAlgorithm.scala         | 4 ++--
 .../return-item-properties/src/main/scala/ALSAlgorithm.scala   | 4 ++--
 .../src/main/scala/CooccurrenceAlgorithm.scala                 | 2 +-
 .../return-item-properties/src/main/scala/Engine.scala         | 6 +++---
 .../rid-user-set-event/src/main/scala/ALSAlgorithm.scala       | 4 ++--
 .../src/main/scala/CooccurrenceAlgorithm.scala                 | 2 +-
 .../rid-user-set-event/src/main/scala/Engine.scala             | 6 +++---
 .../train-with-rate-event/src/main/scala/ALSAlgorithm.scala    | 4 ++--
 .../src/main/scala/CooccurrenceAlgorithm.scala                 | 2 +-
 .../train-with-rate-event/src/main/scala/Engine.scala          | 6 +++---
 14 files changed, 27 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/96d4c54a/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/ALSAlgorithm.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/ALSAlgorithm.scala
b/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/ALSAlgorithm.scala
index aae8322..64d570c 100644
--- a/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/ALSAlgorithm.scala
+++ b/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/ALSAlgorithm.scala
@@ -185,13 +185,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/blob/96d4c54a/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/CooccurrenceAlgorithm.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/CooccurrenceAlgorithm.scala
b/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/CooccurrenceAlgorithm.scala
index 30d0b3e..76307e7 100644
--- a/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/CooccurrenceAlgorithm.scala
+++ b/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/CooccurrenceAlgorithm.scala
@@ -146,7 +146,7 @@ class CooccurrenceAlgorithm(val ap: CooccurrenceAlgorithmParams)
         )
       }
 
-    new PredictedResult(itemScores)
+    PredictedResult(itemScores)
 
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/96d4c54a/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/Engine.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/Engine.scala
b/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/Engine.scala
index dcfee6f..8691e71 100644
--- a/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/Engine.scala
+++ b/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/Engine.scala
@@ -27,18 +27,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() = {

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/96d4c54a/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/Serving.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/Serving.scala
b/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/Serving.scala
index 79b33a2..831dea2 100644
--- a/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/Serving.scala
+++ b/examples/scala-parallel-similarproduct/multi-events-multi-algos/src/main/scala/Serving.scala
@@ -65,6 +65,6 @@ 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/96d4c54a/examples/scala-parallel-similarproduct/recommended-user/src/main/scala/ALSAlgorithm.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-similarproduct/recommended-user/src/main/scala/ALSAlgorithm.scala
b/examples/scala-parallel-similarproduct/recommended-user/src/main/scala/ALSAlgorithm.scala
index 8e93824..fd84284 100644
--- a/examples/scala-parallel-similarproduct/recommended-user/src/main/scala/ALSAlgorithm.scala
+++ b/examples/scala-parallel-similarproduct/recommended-user/src/main/scala/ALSAlgorithm.scala
@@ -175,13 +175,13 @@ class ALSAlgorithm(val ap: ALSAlgorithmParams)
     val topScores = getTopN(filteredScore, query.num)(ord).toArray
 
     val similarUserScores = topScores.map { case (i, s) =>
-      new SimilarUserScore(
+      SimilarUserScore(
         user = model.similarUserIntStringMap(i),
         score = s
       )
     }
 
-    new PredictedResult(similarUserScores)
+    PredictedResult(similarUserScores)
   }
 
   private

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/96d4c54a/examples/scala-parallel-similarproduct/return-item-properties/src/main/scala/ALSAlgorithm.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-similarproduct/return-item-properties/src/main/scala/ALSAlgorithm.scala
b/examples/scala-parallel-similarproduct/return-item-properties/src/main/scala/ALSAlgorithm.scala
index fabb098..3bf3402 100644
--- a/examples/scala-parallel-similarproduct/return-item-properties/src/main/scala/ALSAlgorithm.scala
+++ b/examples/scala-parallel-similarproduct/return-item-properties/src/main/scala/ALSAlgorithm.scala
@@ -187,7 +187,7 @@ class ALSAlgorithm(val ap: ALSAlgorithmParams)
     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,
@@ -196,7 +196,7 @@ class ALSAlgorithm(val ap: ALSAlgorithmParams)
       )
     }
 
-    new PredictedResult(itemScores)
+    PredictedResult(itemScores)
   }
 
   private

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/96d4c54a/examples/scala-parallel-similarproduct/return-item-properties/src/main/scala/CooccurrenceAlgorithm.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-similarproduct/return-item-properties/src/main/scala/CooccurrenceAlgorithm.scala
b/examples/scala-parallel-similarproduct/return-item-properties/src/main/scala/CooccurrenceAlgorithm.scala
index 7a75bf0..470d87d 100644
--- a/examples/scala-parallel-similarproduct/return-item-properties/src/main/scala/CooccurrenceAlgorithm.scala
+++ b/examples/scala-parallel-similarproduct/return-item-properties/src/main/scala/CooccurrenceAlgorithm.scala
@@ -151,7 +151,7 @@ class CooccurrenceAlgorithm(val ap: CooccurrenceAlgorithmParams)
         )
       }
 
-    new PredictedResult(itemScores)
+    PredictedResult(itemScores)
 
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/96d4c54a/examples/scala-parallel-similarproduct/return-item-properties/src/main/scala/Engine.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-similarproduct/return-item-properties/src/main/scala/Engine.scala
b/examples/scala-parallel-similarproduct/return-item-properties/src/main/scala/Engine.scala
index 595383e..bd556f0 100644
--- a/examples/scala-parallel-similarproduct/return-item-properties/src/main/scala/Engine.scala
+++ b/examples/scala-parallel-similarproduct/return-item-properties/src/main/scala/Engine.scala
@@ -27,11 +27,11 @@ 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(",")
 }
 
@@ -42,7 +42,7 @@ case class ItemScore(
   date: String,
   imdbUrl: String,
   score: Double
-) extends Serializable
+)
 
 object SimilarProductEngine extends EngineFactory {
   def apply() = {

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/96d4c54a/examples/scala-parallel-similarproduct/rid-user-set-event/src/main/scala/ALSAlgorithm.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-similarproduct/rid-user-set-event/src/main/scala/ALSAlgorithm.scala
b/examples/scala-parallel-similarproduct/rid-user-set-event/src/main/scala/ALSAlgorithm.scala
index b413c08..50c26b5 100644
--- a/examples/scala-parallel-similarproduct/rid-user-set-event/src/main/scala/ALSAlgorithm.scala
+++ b/examples/scala-parallel-similarproduct/rid-user-set-event/src/main/scala/ALSAlgorithm.scala
@@ -181,13 +181,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/blob/96d4c54a/examples/scala-parallel-similarproduct/rid-user-set-event/src/main/scala/CooccurrenceAlgorithm.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-similarproduct/rid-user-set-event/src/main/scala/CooccurrenceAlgorithm.scala
b/examples/scala-parallel-similarproduct/rid-user-set-event/src/main/scala/CooccurrenceAlgorithm.scala
index 30d0b3e..76307e7 100644
--- a/examples/scala-parallel-similarproduct/rid-user-set-event/src/main/scala/CooccurrenceAlgorithm.scala
+++ b/examples/scala-parallel-similarproduct/rid-user-set-event/src/main/scala/CooccurrenceAlgorithm.scala
@@ -146,7 +146,7 @@ class CooccurrenceAlgorithm(val ap: CooccurrenceAlgorithmParams)
         )
       }
 
-    new PredictedResult(itemScores)
+    PredictedResult(itemScores)
 
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/96d4c54a/examples/scala-parallel-similarproduct/rid-user-set-event/src/main/scala/Engine.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-similarproduct/rid-user-set-event/src/main/scala/Engine.scala
b/examples/scala-parallel-similarproduct/rid-user-set-event/src/main/scala/Engine.scala
index 2563fdf..1c81b32 100644
--- a/examples/scala-parallel-similarproduct/rid-user-set-event/src/main/scala/Engine.scala
+++ b/examples/scala-parallel-similarproduct/rid-user-set-event/src/main/scala/Engine.scala
@@ -27,18 +27,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() = {

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/96d4c54a/examples/scala-parallel-similarproduct/train-with-rate-event/src/main/scala/ALSAlgorithm.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-similarproduct/train-with-rate-event/src/main/scala/ALSAlgorithm.scala
b/examples/scala-parallel-similarproduct/train-with-rate-event/src/main/scala/ALSAlgorithm.scala
index eaefe17..507343e 100644
--- a/examples/scala-parallel-similarproduct/train-with-rate-event/src/main/scala/ALSAlgorithm.scala
+++ b/examples/scala-parallel-similarproduct/train-with-rate-event/src/main/scala/ALSAlgorithm.scala
@@ -193,13 +193,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/blob/96d4c54a/examples/scala-parallel-similarproduct/train-with-rate-event/src/main/scala/CooccurrenceAlgorithm.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-similarproduct/train-with-rate-event/src/main/scala/CooccurrenceAlgorithm.scala
b/examples/scala-parallel-similarproduct/train-with-rate-event/src/main/scala/CooccurrenceAlgorithm.scala
index b5035f8..0edc76e 100644
--- a/examples/scala-parallel-similarproduct/train-with-rate-event/src/main/scala/CooccurrenceAlgorithm.scala
+++ b/examples/scala-parallel-similarproduct/train-with-rate-event/src/main/scala/CooccurrenceAlgorithm.scala
@@ -147,7 +147,7 @@ class CooccurrenceAlgorithm(val ap: CooccurrenceAlgorithmParams)
         )
       }
 
-    new PredictedResult(itemScores)
+    PredictedResult(itemScores)
 
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/96d4c54a/examples/scala-parallel-similarproduct/train-with-rate-event/src/main/scala/Engine.scala
----------------------------------------------------------------------
diff --git a/examples/scala-parallel-similarproduct/train-with-rate-event/src/main/scala/Engine.scala
b/examples/scala-parallel-similarproduct/train-with-rate-event/src/main/scala/Engine.scala
index 2563fdf..1c81b32 100644
--- a/examples/scala-parallel-similarproduct/train-with-rate-event/src/main/scala/Engine.scala
+++ b/examples/scala-parallel-similarproduct/train-with-rate-event/src/main/scala/Engine.scala
@@ -27,18 +27,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() = {


Mime
View raw message