0
我的目標是基於等級評估添加到CrossValidator功能(PySpark)自定義計算器交叉驗證SPARK期間
cvExplicit = CrossValidator(estimator=cvSet, numFolds=8, estimatorParamMaps=paramMap,evaluator=rnkEvaluate)
雖然我需要評估的數據幀傳遞到功能,我不知道如何做那部分。
class rnkEvaluate():
def __init__(self, user_col = "user", rating_col ="rating", prediction_col = "prediction"):
print(user_col)
print(rating_col)
print(prediction_col)
def isLargerBetter():
return True
def evaluate(self,predictions):
denominator =
predictions.groupBy().sum(self._rating_col).collect()[0][0]
TODO
rest of the calculation ...
return numerator/denominator
不知怎的,我需要在每次迭代中傳遞預測數據幀,但我無法管理它。