![]() Num_iters = 400 # create blank array to capture cost function value after each iteration ]) Perform Linear Regression # set learning rate X_norm = np.append(np.ones((m,1)),X_norm, axis=1) # Display normalized X data (appended 1's, normalized square footage, normalized bedrooms) X_norm = (X-mu)/sigma # Add a dimension/column of 1's and X_norm will be used instead of X # Set X_norm equal to the X normalized value ((value-meanValue)/standardDeviation) # Identify standard deviation value for each dimension/column # Identify mean value for each dimension/column Theta = np.ndarray.flatten(np.zeros((3, 1))) # Normalize X data ![]() # create array's of zeros for mu, sigma, amd theta # Store X values in X_norm which will become the normalized X values # set y data (value to predict) equal to selling price ]) Data Preprocessing # set X data equal to Square Feet and Bedrooms ![]() # display top 5 records (Square Feet, Bedrooms, Selling Price) Np.set_printoptions(precision=3,suppress=True) Import os # specify path to training dataĭata = np.genfromtxt(path + "housingData.csv", dtype=float, delimiter=',') # set the numpy display preferrences # display matplotlib graph's within notebook ![]() Linear Regression: Housing Prices Jupyter Notebook version of Matlab programming assingment for Andrew Ng's (Stanford University) Machine Learning Course # import libraries
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |