Computer scienceData scienceInstrumentsScikit-learnTraining ML models with scikit-learnRegression in scikit-learn

Linear Regression with scikit-learn

Exploring simple linear regression

Report a typo

Hey there! This problem might be a bit unpredictable, but give it a go and let us know how you do!
Given the simple linear regression equation Y = a + bX, consider the following Python code:
import numpy as np
from sklearn.linear_model import LinearRegression

X = np.array([5, 15, 25, 35, 45, 55]).reshape((-1, 1))
Y = np.array([5, 20, 14, 32, 22, 38])

model = LinearRegression().fit(X, Y)

print('Intercept:', model.intercept_)
print('Slope:', model.coef_)

What will this code mainly accomplish?

Select one option from the list

Create a free account to access the full topic