← All tutorials

GoCareerGo Tutorials

Machine Learning Tutorial

Supervised learning, classification, neural networks and core ML algorithms.

Linear Regression

Predicts a continuous numeric value by fitting the best straight line (or hyperplane) through the training data.

from sklearn.linear_model import LinearRegression

model = LinearRegression()
model.fit(X_train, y_train)
print(model.coef_, model.intercept_)
  • Assumes a linear relationship between features and the target
  • Minimizes mean squared error between predictions and actual values
  • Fast, interpretable — often the right first model to try