Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x sklearn Logistic回归上的数据转换警告_Python 3.x_Pandas_Scikit Learn_Sklearn Pandas - Fatal编程技术网

Python 3.x sklearn Logistic回归上的数据转换警告

Python 3.x sklearn Logistic回归上的数据转换警告,python-3.x,pandas,scikit-learn,sklearn-pandas,Python 3.x,Pandas,Scikit Learn,Sklearn Pandas,我试图在SKL中执行物流回归,了解以下内容: from sklearn.linear_model import LogisticRegression classifier = LogisticRegression(random_state = 0) mod_data2 = mod_data.copy() classifier.fit(mod_data2[['prob1_norm', 'prob2_norm']].values.reshape(-1,2), mod_data2['Succes

我试图在SKL中执行物流回归,了解以下内容:

from sklearn.linear_model import LogisticRegression

classifier = LogisticRegression(random_state = 0)

mod_data2 = mod_data.copy()

classifier.fit(mod_data2[['prob1_norm', 'prob2_norm']].values.reshape(-1,2), mod_data2['Success'].values.reshape(-1,1))
但它给了我一个错误信息:

 DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().
  y = column_or_1d(y, warn=True)
我曾尝试在输入数据的末尾使用.ravel(),但它告诉我我的维度错误


谢谢

您是否尝试过
mod_data2['Success'].values.ravel()
?是的,我尝试过了,而不是仅仅给我一个警告,它告诉我ValueError:预期的2D数组,改为1D数组:数组=[0.46062633 0.39853439 0.46062633…0.21442516 0.06186648 0.02173996]。使用数组重塑数据。如果数据具有单个功能或数组,则重塑(-1,1)。如果数据包含单个样本,则重塑(1,-1)。您是否尝试过
mod_data2['Success'].values.ravel()
?是的,我尝试过,而不仅仅是给我一个警告,它告诉我ValueError:预期的2D数组,改为1D数组:数组=[0.46062633 0.39853439 0.46062633…0.21442516 0.06186648 0.02173996]。使用数组重塑数据。如果数据具有单个特征或数组,则重塑(-1,1)。如果数据包含单个样本,则重塑(1,-1)。