斯坦福ML课程——python转写(Week2—课程作业ex1_1)

利用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
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值