sklearnutils_param_validationInvalidParameterError The weights parameter of KNeighborsClassifier must be a str among distance uniform a callable or None Got 1 1 1 1 2 1 1 1 1 1 1 instead报错解决
这个错误是因为KNeighborsClassifier模型的weights参数需要传入字符串'distance'或'uniform',或者传入一个可调用对象或None,但是你传入了一个列表[1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1]。你需要检查你的代码,找到设置KNeighborsClassifier模型的weights参数的地方,确保传入的是正确的参数类型。如果你想使用自定义权重,你需要传入一个可调用对象来计算权重。
原文地址: https://www.cveoy.top/t/topic/eEPI 著作权归作者所有。请勿转载和采集!