Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
regression line: bug
#1
Hi All,
I have the two array bellow.
I am doing the simple regression and it gives me trouble. As soon as I add plotting line it gives me error of "SVD did not converge in Linear Least Squares". Though it runs just fine without plotting and does estimate coef. Any insights? Thank you!
coef = np.polyfit(arr_new,arr_old,1)
poly1d_fn = np.poly1d(coef) 
plt.plot(arr_new, poly1d_fn(arr_new), '--k')
arr_new =
[0.24 0.2 0.15 0.09 0.09 0.08 0.26 0.28 0.28 0.22 0.24 0.19 0.17 0.18
0.19 0.19 0.24 0.22 0.23 0.2 0.15 0.26 0.28 0.28 0.3 0.32 0.28 0.33
0.41 0.4 0.38 0.41 0.27 0.25 0.21 0.19 0.12 0.15 0.14 0.23 0.23 0.26
0.27 0.22 0.26 0.23 0.22 0.24 0.14 0.19 0.21 0.19 0.16 0.18 0.21 0.15
0.11 0.06 0.26 0.31 0.32 0.32 0.25 0.27 0.24 0.27 0.23 0.22 0.22 0.19
0.16 0.13 0.1 0.07 0.13 0.12 0.13 0.07 0.06 0.25 0.27 0.33 0.36 0.29
0.27 0.26 0.23 0.26 0.22 0.21 0.24 0.18 0.11 0.09 0.09 0.13 0.04 0.
0.19 0.22 0.26 0.3 0.33 0.31 0.32 0.28 0.28 0.25 0.2 0.25 0.18 0.14
0.14 0.14 0.09 0.07 0.02 0.25 0.26 0.3 0.31 0.29 0.3 0.31 0.3 0.32
0.29 0.35 0.37 0.39 0.38 0.32 0.23 0.17 0.12 0.13 0.07 0.11 0.31 0.14
0.16 0.13 0.15 0.11 0.18 0.19 0.21 0.24 0.23 0.23 0.21 0.16 0.14 0.1
0.12 0.25 0.24 0.23 0.17 0.22 0.18]
arr_old =
[0.03 0.02 0.02 0.02 0.02 0.01 0.02 0.03 0.03 0.03 0.02 0.02 0.02 0.03
0.02 0.02 0.04 0.16 0.27 0.18 0.15 0.24 0.26 0.27 0.26 0.21 0.2 0.22
0.32 0.27 0.25 0.15 0.29 0.14 0.24 0.19 0.12 0.03 0.04 0.03 0.27 0.27
0.23 0.24 0.21 0.23 0.22 0.19 0.24 0.17 0.11 0.11 0.03 0.28 0.01 0.23
0.24 0.2 0.2 0.23 0.24 0.21 0.26 0.18 0.21 0.02 0.22 0.2 0.18 0.19
0.18 0.03 0.04 0.24 0.24 0.04 0.03 0.03 0.03 0.03 0.03 0.02 0.02 0.02
0.02 0.02 0.01 0.02 0.02 0.02 0.03 0.3 0.27 0.23 0.02 0.28 0.25 0.24
0.21 0.18 0.15 0.15 0.25 0.24 0.22 0.19 0.17 0.15 0.25 0.25 0.24 0.2
0.24 0.22 0.23 0.22 0.19 0.2 0.2 0.01 0.33 0.31 0.31 0.28 0.25 0.21
0.25 0.26 0.26 0.25 0.04 0.18 0.03 0.18 0.03 0.03 0.04 0.03 0.02 0.4
0.33 0.29 0.31 0.3 0.14 0.32 0.32 0.33 0.35 0.02 0.02 0.02 0.07 0.14
0.19 0.23 0.04 0.03 0.03 0.03 0.03]
Reply
#2
It would be easier to help if you posted a complete working code and a complete not working code.
Reply
#3
how to delete answer
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020