利用python完成课程作业ex1的第一部分,第一部分的要求如下:
In this part of this exercise, you will implement linear regression with onevariable to predict prots for a food truck. Suppose you are the CEO of arestaurant franchise and are considering different cities for opening a newoutlet. The chain already has trucks in various cities and you have data forprots and populations from the cities.
在ex1.py的代码中,分为四个部分,每个部分分别如下:
- Part 1: Basic Function
- Part 2:Plotting
- Part 3: Cost and Gradient descent
- Part 4: Visualizing J(theta_0, theta_1)
具体改写代码如下:
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 16 10:40:51 2019
@author: Lonely_hanhan
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
''' ==================== Part 1: Basic Function ===================='''
print('Running warmUpExercise ... \n')
print('5x5 Identity Matrix: \n')
def w

最低0.47元/天 解锁文章
1435

被折叠的 条评论
为什么被折叠?



