data=np.loadtxt('ex1data1.txt',delimiter=',')
X=data[:,0]
Y=data[:,1]
X=(np.column_stack((np.ones(np.size(X)),X)))
打印x给出[[ 1. 6.1101]
[ 1. 5.5277]
[ 1. 8.5186]
[ 1. 7.0032]
[ 1. 5.8598]
[ 1. 8.3829]
[ 1. 7.4764]
[ 1. 8.5781]
[ 1. 6.4862]
[ 1. 5.0546]
[ 1. 5.7107]
[ 1. 14.164 ]
[ 1. 5.734 ]
[ 1. 8.4084]
[ 1. 5.6407]
[ 1. 5.3794]
[ 1. 6.3654]
[ 1. 5.1301]
[ 1. 6.4296]
[ 1. 7.0708]
[ 1. 6.1891]
[ 1. 20.27 ]
[ 1. 5.4901]
[ 1. 6.3261]
[ 1. 5.5649]
[ 1. 18.945 ]
[ 1. 12.828 ]
[ 1. 10.957 ]
[ 1. 13.176 ]
[ 1. 22.203 ]
[ 1. 5.2524]
[ 1. 6.5894]
[ 1. 9.2482]
[ 1. 5.8918]
[ 1. 8.2111]