- 今天在处理一个多标签分类问题的时候,采用了自适应算法的建模策略。初始化MLkNN模型,
拟合训练集'X_train, Y_train'之后
,得到报错信息如下:
'DataFrame' object has no attribute 'getformat'
# 原因是参数数据类型不对,API要求参数类型为array,而我原始代码fit()的参数为DataFrame类型;
X : array-like of shape (n_samples, n_features)
Training vector, where n_samples is the number of samples and
n_features is the number of features.
y : array-like of shape (n_samples, n_output) or (n_samples,), default=None
Target relative to X for classification or regression;
None for unsupervised learning.
- 修改后的代码,运行无误;这里将参数通过np.array转为array格式。