Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my_data = np.genfromtxt('data.csv', delimiter=',') # read the data
- X = my_data[:, 0].reshape(-1,1) # -1 tells numpy to figure out the dimension by itself
- ones = np.ones([X.shape[0], 1]) # create a array containing only ones
- X = np.concatenate([ones, X],1) # cocatenate the ones to X matrix
- y = my_data[:, 1].reshape(-1,1) # create the y matrix
Add Comment
Please, Sign In to add comment