Serialize mleap defaultleapframe to json
- Dominant language
- Scala
- Stars
- 1.5k
- Forks
- 315
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to serialize mleap's DefaultLeapFrame to json format.
The doc shows the following example:
val schema = StructType(StructField("features", TensorType(BasicType.Double)),
StructField("name", ScalarType.String),
StructField("list_data", ListType(BasicType.String)),
StructField("nullable_double", ScalarType(BasicType.Double, true)),
StructField("float", ScalarType.Float),
StructField("byte_tensor", TensorType(BasicType.Byte)),
StructField("short_list", ListType(BasicType.Short)),
StructField("nullable_string", ScalarType(BasicType.String, true))).get
val dataset = Seq(Row(Tensor.denseVector(Array(20.0, 10.0, 5.0)),
"hello", Seq("hello", "there"),
Option(56.7d), 32.4f,
Tensor.denseVector(Array[Byte](1, 2, 3, 4)),
Seq[Short](99, 12, 45),
None))
val frame = DefaultLeapFrame(schema, dataset)
// Store Leap Frame
for(bytes <- frame.writer("ml.combust.mleap.json").toBytes();
frame2 <- FrameReader("ml.combust.mleap.json").fromBytes(bytes)) {
println(new String(bytes)) // print the JSON bytes
assert(frame == frame2)
}
But locally I don't find the method `writer` for the DefaultLeapFrame object. I checked the source code for [`DefaultLeapFrame`][1] and [`LeapFrame`][2] as well but couldn't find the `writer` method there as well, as mentioned in the doc example.
Is it some implicit import or something ? Please do let know.
Thanks in advance.
[1]: https://github.com/combust/mleap/blob/master/mleap-runtime/src/main/scala/ml/combust/mleap/runtime/frame/DefaultLeapFrame.scala
[2]: https://github.com/combust/mleap/blob/master/mleap-runtime/src/main/scala/ml/combust/mleap/runtime/frame/LeapFrame.scala
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.