社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Python

错误文件“<ipython-input-88-aaa9a8a07a7b>”,第12行y掼u predict=column掼u或掼1d(y,warn=True)^缩进错误:意外缩进

Khalil • 5 年前 • 322 次点击  

第一个错误是:

当你有1D时需要2D

意外缩进

我的代码是:

from sklearn import metrics
    from sklearn.linear_model import LogisticRegression

    model=LogisticRegression(solver="liblinear")

    #x_train=x_train.values.reshape(-1,1)
    #y_train=y_train.values.reshape(-1,1)
    model.fit(x_train,y_train)

    y_predict=model.predict(y_test)
    y_predict = y_predict.values.reshape(-1,1)
     y_predict = column_or_1d(y, warn=True)
    coef_df=pd.DataFrame(model_coef_)
    coef_df['intercept']=model_intercept_

    print(coef_df)
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/56800
 
322 次点击  
文章 [ 1 ]  |  最新文章 5 年前