predictionio-toolbox


License

License

GroupId

GroupId

com.github.takezoe
ArtifactId

ArtifactId

predictionio-toolbox_2.11
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

predictionio-toolbox
predictionio-toolbox
Project URL

Project URL

https://github.com/takezoe/predictionio-toolbox
Project Organization

Project Organization

com.github.takezoe
Source Code Management

Source Code Management

https://github.com/takezoe/predictionio-toolbox

Download predictionio-toolbox_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.takezoe/predictionio-toolbox_2.11/ -->
<dependency>
    <groupId>com.github.takezoe</groupId>
    <artifactId>predictionio-toolbox_2.11</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.takezoe/predictionio-toolbox_2.11/
implementation 'com.github.takezoe:predictionio-toolbox_2.11:0.0.1'
// https://jarcasting.com/artifacts/com.github.takezoe/predictionio-toolbox_2.11/
implementation ("com.github.takezoe:predictionio-toolbox_2.11:0.0.1")
'com.github.takezoe:predictionio-toolbox_2.11:jar:0.0.1'
<dependency org="com.github.takezoe" name="predictionio-toolbox_2.11" rev="0.0.1">
  <artifact name="predictionio-toolbox_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.takezoe', module='predictionio-toolbox_2.11', version='0.0.1')
)
libraryDependencies += "com.github.takezoe" % "predictionio-toolbox_2.11" % "0.0.1"
[com.github.takezoe/predictionio-toolbox_2.11 "0.0.1"]

Dependencies

compile (19)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.8
org.apache.predictionio : apache-predictionio-common_2.11 jar 0.12.1
org.apache.predictionio : apache-predictionio-core_2.11 jar 0.12.1
org.apache.predictionio : apache-predictionio-data_2.11 jar 0.12.1
org.apache.predictionio : apache-predictionio-data-jdbc_2.11 jar 0.12.1
org.apache.predictionio : apache-predictionio-data-elasticsearch_2.11 jar 0.12.1
org.apache.predictionio : apache-predictionio-data-hbase_2.11 jar 0.12.1
org.postgresql : postgresql jar 42.1.4
mysql : mysql-connector-java jar 5.1.46
org.clapper : grizzled-slf4j_2.11 jar 1.3.2
com.github.nscala-time : nscala-time_2.11 jar 2.18.0
org.json4s : json4s-native_2.11 jar 3.2.11
org.json4s : json4s-ext_2.11 jar 3.2.11
org.scalikejdbc : scalikejdbc_2.11 jar 3.1.0
org.elasticsearch.client : rest jar 5.5.2
org.elasticsearch : elasticsearch-spark-20_2.11 jar 5.5.2
org.apache.hbase : hbase-common jar 0.98.5-hadoop2
org.apache.hbase : hbase-client jar 0.98.5-hadoop2
org.apache.hbase : hbase-server jar 0.98.5-hadoop2

provided (1)

Group / Artifact Type Version
org.apache.spark : spark-core_2.11 jar 2.1.1

Project Modules

There are no modules declared in this project.

Toolbox for Apache PredictionIO

predictionio-toolbox provides simple fashion to access event data stored via the event server.

For example, you can use this library on Apache Zeppelin to see event data.

First, load the library as follows:

%dep
z.load("com.github.takezoe:predictionio-toolbox_2.11:0.0.1")

Then you can get events using PIOToolbox as RDD and register them as tables which can be accessed from SparkSQL:

import com.github.takezoe.predictionio.toolbox._

// Create toolbox with PIO_HOME
val toolbox = PIOToolbox("/Users/naoki.takezoe/PredictionIO-0.12.1")
val eventsRDD = toolbox.find("MyApp1")(sc)

case class Rating(
  user: String,
  item: String,
  rating: Double
)

val ratingRDD = eventsRDD.map { event => 
  val ratingValue: Double = event.event match {
    case "rate" => event.properties.get[Double]("rating")
    case "buy" => 4.0 // map buy event to rating value of 4
    case _ => throw new Exception(s"Unexpected event ${event} is read.")
  }
  // entityId and targetEntityId is String
  Rating(event.entityId,
    event.targetEntityId.get,
    ratingValue)
}

val df = spark.createDataFrame(ratingRDD)
df.registerTempTable("rating")

Now you can analyze event data using SQL:

%sql
select rating, count(*) from rating group by rating

Zeppelin

In addition, you can also register event data using PIOToolbox. See the source code of PIOToolbox to know all out-of-the-box APIs.

Versions

Version
0.0.1