np.ones(len(X), 1) and np.hstack((X, index)) and X.shape(0) and X.shape(1)

np.ones(len(X), 1)

Create a matrix with len(X) rows and 1 column

np.hstack((X, index))

Join the matrix X and index horizontally

X.shape(0)

Count the number of X columns of the matrix

X.shape(1)

Count the number of rows in the matrix X

Guess you like

Origin blog.csdn.net/banxiaCSDN/article/details/112755721