X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vector, where n_samples is the number of samples and
n_features is the number of features.
Input validation on an array, list, sparse matrix or similar.
By default, the input is checked to be a non-empty 2D array containing
only finite values. If the dtype of the array is object, attempt
converting to float, raising on failure.
这就是scikit learn afaik中ML模型的
fit
方法的设计选择。这主要是为了与输入形状的规范保持一致:(n_samples, n_features)
:在^{} 的顶部,也清楚地表明了这一点,即引发错误的验证步骤:
LinearRegression
确实接受2D
目标数组,在这种情况下,它将执行多元线性回归相关问题 更多 >
编程相关推荐