Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. def inpro(fname):
  2.     data=np.genfromtxt(fname, delimiter=',')
  3.     xtemp=data[:,1:] #getting the inputs
  4.     y=data[:,0] #getting the labels
  5.     n=len(data) #total number of training points
  6.     d=len(data[0])-1 #dimensions
  7.     x=np.ones((n,d+1))
  8.     x[:,:-1]=xtemp #adding a column of ones to the outside, for the constant term
  9.     return (x,y,d,n) #x is input, y is output, d is dimension, and n is number of points
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement