Created
June 17, 2014 21:56
-
-
Save alaiacano/4c3aa99a39ef088c1f66 to your computer and use it in GitHub Desktop.
pmml example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// load the data and convert it to a Glass object. | |
val data: TypedPipe[Glass] = TextLine(args("input")) | |
.map{line => Glass.fromTextLine(line)} | |
// open the SVM model used to predict the type of glass. | |
val svmModel = getClass.getResource(modelFile).openStream() | |
val svmModelEvaluator = Predictable.buildEvaluator(svmModel) | |
val predictedType: TypedPipe[(Int, GlassType.PredictType)] = data | |
// turn the Glass object into a GlassType | |
.map(GlassType.fromGlass) | |
// predict type | |
.map{ meas => (meas.id, meas.predict(svmModelEvaluator)) } | |
// write output | |
.write(TypedTsv[(Int, GlassType.PredictType)](outputTypeFile)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment