Difference between python np.array shape (n,) and (n,1)
(n,)
1 | import numpy as np |

(n,1)
1 | shape_demo_1 = np.array([[1],[2],[3],[4]]) |

(2,4)
1 | shape_demo_2 = np.array([[1,2,3,4],[5,6,7,8]]) |

sklearn datasets.make_regression
1 | import matplotlib.pyplot as plt |
type of regressionData is tuple(2 items)
(ndarray with shape (10, 1), ndarray with shape (10,))1
type(regressionData)

1
regressionData[0]

1
regressionData[1]

ref [Day27]機器學習:建立線性迴歸資料與預測!
ref numpy.array 的shape属性理解
ref python 里 np.array 的shape ( ,)与( ,1)的区别