Regression Algorithms in Machine Learning

Data Science 270 views Nov 14, 2025 1 min read

Introduction

Regression is used to predict continuous values like price, salary, or temperature.

1. Linear Regression


from sklearn.linear_model import LinearRegression

model = LinearRegression()
model.fit(X_train, y_train)
pred = model.predict(X_test)
  

2. Polynomial Regression


from sklearn.preprocessing import PolynomialFeatures

poly = PolynomialFeatures(degree=2)
X_poly = poly.fit_transform(X)
  

3. Ridge Regression


from sklearn.linear_model import Ridge
model = Ridge(alpha=1.0)
  

4. Lasso Regression


from sklearn.linear_model import Lasso
model = Lasso(alpha=0.1)
  

5. Random Forest Regression


from sklearn.ensemble import RandomForestRegressor
model = RandomForestRegressor()
  

6. Evaluation Metrics

  • MAE – Mean Absolute Error
  • MSE – Mean Squared Error
  • RMSE – Root Mean Squared Error
  • R² Score

Conclusion

Regression algorithms help solve prediction tasks involving continuous values. Choosing the right model depends on dataset size, complexity, and feature relationships.

Some advanced sections are available for Registered Members
Share this Post
🚀 Want to Test Your Knowledge?

Take quizzes related to this topic and see where you stand!

Start Quiz Now
Back to Tutorials