import numpy as np
      from sklearn.linear_model import LinearRegression
      x = np.array([]).reshape((-1, 1))
      y = np.array([])
      model = LinearRegression().fit(x, y)
      r_sq = model.score(x, y)
      print('coefficient of determination:', r_sq)
      print('intercept:', model.intercept_)
      print('slope:', model.coef_)
      y_pred = model.predict(x)
      print('predicted response:', y_pred, sep='\n')
      Python language logo

      Linear Regression

      Linear Regression code in Python


        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.