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/15 17:02:36 UTC

[1/3] incubator-predictionio git commit: Fix use of case class in recommender examples

Repository: incubator-predictionio
Updated Branches:
  refs/heads/develop fdcd9218c -> 42d6d428e


Fix use of case class in recommender examples

Closes #409


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

Branch: refs/heads/develop
Commit: 49a6a78a364ea786b22cb3ccb60ea74d98847acd
Parents: 75cfe46
Author: Naoki Takezoe <ta...@apache.org>
Authored: Sun Jul 16 01:59:27 2017 +0900
Committer: Naoki Takezoe <ta...@apache.org>
Committed: Sun Jul 16 01:59:27 2017 +0900

----------------------------------------------------------------------
 .../templates/recommendation/blacklist-items.html.md      |  6 +++---
 .../source/templates/recommendation/dase.html.md.erb      | 10 +++++-----
 .../templates/recommendation/evaluation.html.md.erb       |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/49a6a78a/docs/manual/source/templates/recommendation/blacklist-items.html.md
----------------------------------------------------------------------
diff --git a/docs/manual/source/templates/recommendation/blacklist-items.html.md b/docs/manual/source/templates/recommendation/blacklist-items.html.md
index 70d1585..99e1bc7 100644
--- a/docs/manual/source/templates/recommendation/blacklist-items.html.md
+++ b/docs/manual/source/templates/recommendation/blacklist-items.html.md
@@ -37,7 +37,7 @@ case class Query(
   user: String,
   num: Int,
   blackList: Set[String] // ADDED
-) extends Serializable
+)
 ```
 
 ## Filter the Data
@@ -93,10 +93,10 @@ Lets modify method `predict` in MyRecommendation/src/main/scala/***ALSAlgorithm.
       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/49a6a78a/docs/manual/source/templates/recommendation/dase.html.md.erb
----------------------------------------------------------------------
diff --git a/docs/manual/source/templates/recommendation/dase.html.md.erb b/docs/manual/source/templates/recommendation/dase.html.md.erb
index 3a3f58b..32f1f8b 100644
--- a/docs/manual/source/templates/recommendation/dase.html.md.erb
+++ b/docs/manual/source/templates/recommendation/dase.html.md.erb
@@ -36,7 +36,7 @@ defines the format of such **query**:
 case class Query(
   user: String,
   num: Int
-) extends Serializable
+)
 ```
 
 The `PredictedResult` case class defines the format of **predicted result**,
@@ -56,12 +56,12 @@ with:
 ```scala
 case class PredictedResult(
   itemScores: Array[ItemScore]
-) extends Serializable
+)
 
 case class ItemScore(
   item: String,
   score: Double
-) extends Serializable
+)
 ```
 
 Finally, `RecommendationEngine` is the *Engine Factory* that defines the
@@ -386,10 +386,10 @@ predicts the top *num* of items a user will like.
       // 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/49a6a78a/docs/manual/source/templates/recommendation/evaluation.html.md.erb
----------------------------------------------------------------------
diff --git a/docs/manual/source/templates/recommendation/evaluation.html.md.erb b/docs/manual/source/templates/recommendation/evaluation.html.md.erb
index 15522a7..564c83c 100644
--- a/docs/manual/source/templates/recommendation/evaluation.html.md.erb
+++ b/docs/manual/source/templates/recommendation/evaluation.html.md.erb
@@ -180,7 +180,7 @@ It stores the list of ratings in the validation set for a user.
 ```scala
 case class ActualResult(
   ratings: Array[Rating]
-) extends Serializable
+)
 ```
 
 ### Implement Data Generate Method in DataSource


[2/3] incubator-predictionio git commit: Fix use of case class in classification examples

Posted by ta...@apache.org.
Fix use of case class in classification examples

Closes #411


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

Branch: refs/heads/develop
Commit: 5aea9272e87f1505798c883709364833ae504b88
Parents: 49a6a78
Author: Naoki Takezoe <ta...@apache.org>
Authored: Sun Jul 16 02:00:40 2017 +0900
Committer: Naoki Takezoe <ta...@apache.org>
Committed: Sun Jul 16 02:00:40 2017 +0900

----------------------------------------------------------------------
 .../templates/classification/add-algorithm.html.md  |  2 +-
 .../templates/classification/dase.html.md.erb       | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/5aea9272/docs/manual/source/templates/classification/add-algorithm.html.md
----------------------------------------------------------------------
diff --git a/docs/manual/source/templates/classification/add-algorithm.html.md b/docs/manual/source/templates/classification/add-algorithm.html.md
index 6d5ad3d..90d7e6d 100644
--- a/docs/manual/source/templates/classification/add-algorithm.html.md
+++ b/docs/manual/source/templates/classification/add-algorithm.html.md
@@ -102,7 +102,7 @@ class RandomForestAlgorithm(val ap: RandomForestAlgorithmParams) // CHANGED
     val label = model.predict(Vectors.dense(
       Array(query.attr0, query.attr1, query.attr2)
     ))
-    new PredictedResult(label)
+    PredictedResult(label)
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/5aea9272/docs/manual/source/templates/classification/dase.html.md.erb
----------------------------------------------------------------------
diff --git a/docs/manual/source/templates/classification/dase.html.md.erb b/docs/manual/source/templates/classification/dase.html.md.erb
index 140c677..8476db4 100644
--- a/docs/manual/source/templates/classification/dase.html.md.erb
+++ b/docs/manual/source/templates/classification/dase.html.md.erb
@@ -36,11 +36,11 @@ In MyClassification/src/main/scala/***Engine.scala***, the `Query` case class
 defines the format of **query**, such as `{ "attr0":4, "attr1":3, "attr2":8 }`:
 
 ```scala
-class Query(
-  val attr0 : Double,
-  val attr1 : Double,
-  val attr2 : Double
-) extends Serializable
+case class Query(
+  attr0 : Double,
+  attr1 : Double,
+  attr2 : Double
+)
 
 ```
 
@@ -48,9 +48,9 @@ The `PredictedResult` case class defines the format of **predicted result**,
 such as `{"label":2.0}`:
 
 ```scala
-class PredictedResult(
+case class PredictedResult(
   val label: Double
-) extends Serializable
+)
 ```
 
 Finally, `ClassificationEngine` is the Engine Factory that defines the
@@ -261,7 +261,7 @@ label of the item represented by this feature vector.
     val label = model.predict(Vectors.dense(
     	query.attr0, query.attr1, query.attr2
     ))
-    new PredictedResult(label)
+    PredictedResult(label)
   }
 ```
 


[3/3] incubator-predictionio git commit: Merge branch 'livedoc' into develop

Posted by ta...@apache.org.
Merge branch 'livedoc' into develop

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

Branch: refs/heads/develop
Commit: 42d6d428efef2f23270c77615ec4634cf191ce79
Parents: fdcd921 5aea927
Author: Naoki Takezoe <ta...@apache.org>
Authored: Sun Jul 16 02:02:07 2017 +0900
Committer: Naoki Takezoe <ta...@apache.org>
Committed: Sun Jul 16 02:02:07 2017 +0900

----------------------------------------------------------------------
 .../templates/classification/add-algorithm.html.md  |  2 +-
 .../templates/classification/dase.html.md.erb       | 16 ++++++++--------
 .../recommendation/blacklist-items.html.md          |  6 +++---
 .../templates/recommendation/dase.html.md.erb       | 10 +++++-----
 .../templates/recommendation/evaluation.html.md.erb |  2 +-
 5 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------