Linear Regression on Pandas DataFrame using Sklearn ( IndexError: tuple index out of range)

后端 未结 5 2214
孤街浪徒
孤街浪徒 2020-12-08 15:14

I\'m new to Python and trying to perform linear regression using sklearn on a pandas dataframe. This is what I did:

data = pd.read_csv(\'xxxx.csv\')
<         


        
5条回答
  •  一向
    一向 (楼主)
    2020-12-08 15:51

    make predictions based on the result?

    To predict,

    lr = linear_model.LinearRegression().fit(X,Y)
    lr.predict(X)
    

    Is there any way I can view details of the regression?

    The LinearRegression has coef_ and intercept_ attributes.

    lr.coef_
    lr.intercept_
    

    show the slope and intercept.

提交回复
热议问题