我有一个Pyspark定制的Transformer,我试图将其序列化为mLeap捆绑对象以供以后的模型评分,但出现以下错误:
---> 42 self._java_obj.serializeToBundle(transformer._to_java(), path, dataset._jdf)
43
44 def deserializeFromBundle(self, path):
/usr/lib/spark/python/pyspark/ml/pipeline.py in _to_java(self)
314 java_stages = gateway.new_array(cls, len(self.stages))
315 for idx, stage in enumerate(self.stages):
--> 316 java_stages[idx] = stage._to_java()
317
318 _java_obj =\
AttributeError: 'MyCustomTransformer' object has no attribute '_to_java'
我的自定义转换器继承自pyspark.ml.Transformer
,但似乎需要_to_java()
实现才能使mleap序列化正常工作?
我有什么选择?