Ex1_机器学习_吴恩达课程作业(Python):线性回归(Linear Regression)
文章目录
使用说明:
本文章为关于吴恩达老师在Coursera上的机器学习课程的学习笔记。
- 本文第一部分首先介绍课程对应周次的知识回顾以及重点笔记,以及代码实现的库引入。
- 本文第二部分包括代码实现部分中的自定义函数实现细节。
- 本文第三部分即为与课程练习题目相对应的具体代码实现。
0. Pre-condition
This section includes some introductions of libraries, as well as some indispensable points you need to know before implementing.
A. Notes
-
机器学习(Machine Learning)
英文:
A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E.
中文:
机器学习(Machine Learning)是研究计算机怎样模拟或实现人类的学习行为,以获取新的知识或技能,重新组织已有的知识结构使之不断改善自身的性能。一个程序被认为能从经验E中学习,解决任务 T,达到性能度量值P,当且仅当,有了经验E后,经过P评判, 程序在处理T时的性能有所提升。
-
监督学习(Supervised Learning)
英文:
In supervised learning, we are given a data set and already know what our correct output should look like, having the idea that there is a relationship between the input and the output.
Supervised learning problems are categorized into “regression” and “classification” problems.
- Regression(回归):In a regression problem, we are trying to predict results within a continuous output, meaning that we are trying to map input variables to some continuous function. (i.e. House price problem)
- Classification(分类):In a classification problem, we are instead trying to predict results in a discrete output. In other words, we are trying to map input variables into discrete categories. (i.e. Tumor problem)
中文:
监督学习(Supervised Learning):对于数据集中每一个样本都有对应的标签,包括回归(regression)和分类(classification);
-
无监督学习(Unsupervised Learning)
英文:
Unsupervised learning allows us to approach problems with little or no idea what our results should look like. We can derive structure from data where we don’t necessarily know the effect of the variables.
We can derive this structure by clustering the data based on relationships among the variables in the data.
With unsupervised learning there is no feedback based on the prediction results.
- Clustering(聚类): Take a collection of 1,000,000 different genes, and find a way to automatically group these genes into groups that are somehow similar or related by different variables, such as lifespan, location, roles, and so on.
- Non-clustering(非聚类): The “Cocktail Party Algorithm”, allows you to find structure in a chaotic environment. (i.e. identifying individual voices and music from a mesh of sounds at a cocktail party).
中文:
无监督学习(Unsupervised Learning):数据集中没有任何的标签,包括聚类(clustering),著名的一个例子是鸡尾酒晚会。 -
单变量线性回归
-
模型表示(Model Representation)
线性回归模型:

给定训练样本 ( x i , y i ) (x^i , y^i) (xi,yi),其中:$ i = 1 , 2 , . . . , m; i=1,2,…,m$。 x x x 表示特征, y y y 表示输出目标,监督学习算法的工作方式如图所示:

-
假设函数(Hypothesis)
是一个从输入 x x x 到输出 y y y 的映射, h ( x ) = θ 0 + θ 1 h(x) = θ_0 + θ_1 h(x)=θ0+θ1。 θ 0 θ_0 θ0 和 θ 1 θ_1 θ1
-

:线性回归(Linear Regression)&spm=1001.2101.3001.5002&articleId=122564783&d=1&t=3&u=6579d696cb62448381c292a1c9042f11)
9593

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



