Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Data Science
  3. Question
Data Science

A user is learning python/numpy and wondering if anyone can help with doing a linear regression curve equation in python/numpy?

Asked by Jiten Miglani Jan 15, 2020 2.0K views 2 answers
Share

Your answer

2 Answers

Marykayintouch Latest answer

Answered on Mar 28, 2025

This is a great example of implementing linear regression in Python using curve_fit from SciPy. The code effectively fits a linear function to the given data points and visualizes the results with Matplotlib. MaryKayInTouch 

A couple of small improvements:



Adding comments for better readability, especially explaining curve_fit usage.


Fixing minor typos like "fittet function" → "fitted function".


Using plt.grid(True) to enhance the plot’s readability.


Overall, a solid implementation for basic linear regression!

Was this helpful?

More Data Science discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Data Science Blogs

Guides, tips and career advice on Data Science from JanBask experts.