Guest User

Untitled

a guest
Dec 12th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. my_data = np.genfromtxt('data.csv', delimiter=',') # read the data
  2. X = my_data[:, 0].reshape(-1,1) # -1 tells numpy to figure out the dimension by itself
  3. ones = np.ones([X.shape[0], 1]) # create a array containing only ones
  4. X = np.concatenate([ones, X],1) # cocatenate the ones to X matrix
  5. y = my_data[:, 1].reshape(-1,1) # create the y matrix
Add Comment
Please, Sign In to add comment