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 <[email protected]> Authored: Sun Jul 16 02:00:40 2017 +0900 Committer: Naoki Takezoe <[email protected]> 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) } ```
