【问题标题】:Not getting correct output in linear regression在线性回归中没有得到正确的输出
【发布时间】:2021-04-28 14:02:23
【问题描述】:

嗨,我在 (mean_squared_error=(y_test,y_pred)) 这个命令之后我没有得到任何输出,并且在 lr_fit(x_train ,y_train) 之后我只得到线性回归

【问题讨论】:

    标签: python jupyter-notebook linear-regression


    【解决方案1】:
    # doesn't return anything
    # it just fit the model
    # https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html
    lr.fit(x_train, y_train) 
    
    # to get mean squared error, the correct syntax is
    mae = mean_squared_error(y_test,y_pred)
    print(mea)
    

    【讨论】:

      猜你喜欢
      • 2020-05-22
      • 2023-03-06
      • 2017-01-03
      • 2020-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-24
      相关资源
      最近更新 更多