Repository: incubator-predictionio Updated Branches: refs/heads/develop aebe43acf -> 19c47adf5
[PIO-48] scala-local-helloword Sample Not working Closes #332 Project: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/commit/19c47adf Tree: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/tree/19c47adf Diff: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/diff/19c47adf Branch: refs/heads/develop Commit: 19c47adf553ad6c70c4020db9e50d65ec561e642 Parents: aebe43a Author: Rajdeep Dua <[email protected]> Authored: Tue Mar 7 10:50:45 2017 -0800 Committer: Donald Szeto <[email protected]> Committed: Tue Mar 7 10:50:45 2017 -0800 ---------------------------------------------------------------------- .../scala-local-helloworld/HelloWorld.scala | 20 +++++++++++++++----- .../scala-local-helloworld/build.sbt | 5 +++-- 2 files changed, 18 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/19c47adf/examples/experimental/scala-local-helloworld/HelloWorld.scala ---------------------------------------------------------------------- diff --git a/examples/experimental/scala-local-helloworld/HelloWorld.scala b/examples/experimental/scala-local-helloworld/HelloWorld.scala index bc565ce..6ec4f0a 100644 --- a/examples/experimental/scala-local-helloworld/HelloWorld.scala +++ b/examples/experimental/scala-local-helloworld/HelloWorld.scala @@ -42,11 +42,17 @@ class MyPredictedResult( val temperature: Double ) extends Serializable -// controller components -class MyDataSource extends LDataSource[EmptyDataSourceParams, EmptyDataParams, - MyTrainingData, MyQuery, EmptyActualResult] { +case class MyDataSourceParams(val multiplier: Int + ) extends Params + +class MyDataSource extends LDataSource[ + MyTrainingData, + EmptyEvaluationInfo, + MyQuery, + EmptyActualResult] { /* override this to return Training Data only */ + override def readTraining(): MyTrainingData = { val lines = Source.fromFile("../data/helloworld/data.csv").getLines() @@ -59,8 +65,12 @@ class MyDataSource extends LDataSource[EmptyDataSourceParams, EmptyDataParams, } } -class MyAlgorithm extends LAlgorithm[EmptyAlgorithmParams, MyTrainingData, - MyModel, MyQuery, MyPredictedResult] { +class MyAlgorithm extends LAlgorithm[ + MyTrainingData, + MyModel, + MyQuery, + MyPredictedResult] { + override def train(pd: MyTrainingData): MyModel = { http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/19c47adf/examples/experimental/scala-local-helloworld/build.sbt ---------------------------------------------------------------------- diff --git a/examples/experimental/scala-local-helloworld/build.sbt b/examples/experimental/scala-local-helloworld/build.sbt index df7ba52..e14c05b 100644 --- a/examples/experimental/scala-local-helloworld/build.sbt +++ b/examples/experimental/scala-local-helloworld/build.sbt @@ -24,6 +24,7 @@ name := "example-scala-local-helloworld" organization := "org.sample" libraryDependencies ++= Seq( - "org.apache.predictionio" %% "core" % "0.9.1" % "provided", - "org.apache.predictionio" %% "data" % "0.9.1" % "provided", + "org.slf4j" % "slf4j-api" % "1.6.1", + "org.apache.predictionio" %% "apache-predictionio-data" % "0.10.0-incubating", + "org.apache.predictionio" %% "apache-predictionio-core" % "0.10.0-incubating", "org.apache.spark" %% "spark-core" % "1.2.0" % "provided")
