从 pyspark.ml.param
,我注意到 toListListFloat
所以我按照它的结构来创建一个 toListListString
功能:
def toListListString(value):
"""
Convert a value to a list of list of strings, if possible
"""
if TypeConverters._can_convert_to_list(value):
value = TypeConverters.toList(value)
return [TypeConverters.toListString(v) for v in value]
raise TypeError("Could not convert %s to list of list of strings" % value)
打电话的时候 getOrDefault
对于我的参数,我得到一个错误:
Param Param(parent='MeanImputer_420bad667a95e27adfa3',
name='impute_by_groups_cols',
doc='A list of lists of column names to impute by group')
does not belong to MeanImputer_420bad667a95e27adfa3.
然后我试着 toListListString
在课堂上, CustomerTypeConverters
延伸到 TypeConverters
,但同样的错误正在发生。
问题出现在 Params
电话 _shouldOwn
```
def _shouldOwn(self, param):
"""
Validates that the input param belongs to this Params instance.
"""
if not (self.uid == param.parent and self.hasParam(param.name)):
raise ValueError("Param %r does not belong to %r." % (param, self))
我不知道如何解决这个问题。任何帮助都会很棒的,谢谢!
暂无答案!
目前还没有任何答案,快来回答吧!