picnicml / doddle-model

:cake: doddle-model: machine learning in Scala.
https://picnicml.github.io
Apache License 2.0
137 stars 23 forks source link

NotSerializableException when trying to persist a pipeline #97

Closed inejc closed 5 years ago

inejc commented 5 years ago

Describe the bug java.io.NotSerializableException is thrown when trying to persist a logistic regression model within a pipeline.

To Reproduce Steps to reproduce the behavior: Run this.

Versions Scala 2.13, doddle-model 0.0.1-beta4

Stacktrace

Exception in thread "main" java.io.NotSerializableException: io.picnicml.doddlemodel.linear.LogisticRegression$$anon$1
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
    at io.picnicml.doddlemodel.typeclasses.Estimator.save(Estimator.scala:11)
    at io.picnicml.doddlemodel.typeclasses.Estimator.save$(Estimator.scala:9)
    at io.picnicml.doddlemodel.pipeline.Pipeline$$anon$1.save(Pipeline.scala:19)
    at io.picnicml.doddlemodel.syntax.PredictorSyntax$PredictorOps$.save$extension(PredictorSyntax.scala:16)
    at io.picnicml.doddlemodel.spamham.TrainClassifier$.delayedEndpoint$io$picnicml$doddlemodel$spamham$TrainClassifier$1(TrainClassifier.scala:25)
    at io.picnicml.doddlemodel.spamham.TrainClassifier$delayedInit$body.apply(TrainClassifier.scala:18)
    at scala.Function0.apply$mcV$sp(Function0.scala:39)
    at scala.Function0.apply$mcV$sp$(Function0.scala:39)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
    at scala.App.$anonfun$main$1(App.scala:73)
    at scala.App.$anonfun$main$1$adapted(App.scala:73)
    at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:553)
    at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:551)
    at scala.collection.AbstractIterable.foreach(Iterable.scala:921)
    at scala.App.main(App.scala:73)
    at scala.App.main$(App.scala:71)
    at io.picnicml.doddlemodel.spamham.TrainClassifier$.main(TrainClassifier.scala:18)
    at io.picnicml.doddlemodel.spamham.TrainClassifier.main(TrainClassifier.scala)