Fade Temple
@小差小差- Posts
- Categories
- Galleries
- Dixit
-
Jun 4, 2017
机器学习(Week6)-偏差与方差(Bias vs. Variance)
Lecture1: Bias vs. Variance 下一步需要做什么 假设使用线性回归来预测房价,当训练好的预测函数无法应用于新房子的房价预测(预测值与实际偏差很大)时,我们应该如何改进? 获取更多的样本数据 减少特征项,保留更重要的特征项 添加特征项 加入多项式(\(x_1^2,x_2^2,x_1x_2\)等等) 增大\(\lambda\)值 减小\(\lambda\)值 但如何选择以上这些方法呢? 机器学习诊断: 诊断程序会评价学习算法是否有效,并给你下一步应该如何改进提供指引; 虽然实现会花点时间,但对提高算法很有帮助 评估假设函数 实际工作中由于太多特征无法画出曲线,所以需要有一种方法识别过拟合(high variance) 将样本数据分成两组: 一组训练集(70%); 一组是测试集(30%),表示为\((x_{test}^{(i)}, y_{test}^{(i)})\) 使用训练集学习得到参数\(\theta\)和预测函数 线性回归时,使用测试集计算代价函数:\(J_{test}(\theta) = \frac{1}{2m_{test}}\sum_{i=1}^{m_{test}}(h_\theta(x_{test}^{(i)}) - y_{test}^{(i)})^2\) 分类回归问题时,使用测试集计算代价函数:\(J_{test}(\theta)...
Read More -
May 29, 2017
机器学习(Week5)-反向传播(BP)
Lecture1: Backpropagation 神经网络的代价函数 \[\class{myMJSmall}{ J(\Theta) = -\frac{1}{m}\sum_{i=1}^{m}\sum_{k=1}^K \left[ y_k^{(i)}log((h_\Theta(x^{(i)}))_k) + (1-y_k^{(i)})log(1- (h_\Theta(x^{(i)}))_k) \right] + \frac{\lambda}{2m}\sum_{l=1}^{L-1}\sum_{i=1}^{s_l}\sum_{j=1}^{s_{l+1}}(\Theta_{j,i}^{(l)})^2 }\] \(L\): 表示神经网络的层数 \(s_l\): 表示第\(l\)层的激活单元数量(不算上偏置单元bias unit) \(K\): 表示输出层单元数量(分类数量);\(s_L=K\) \(h\Theta(x) \in \mathbb{R}^{K}, (h\Theta(x))_j\)表示第\(j\)个输出 \(y \in \mathbb{R}^{K}\),例如有4种分类,那么如果\(y\)属于第1个分类,则记做...
Read More -
May 24, 2017
机器学习(Week4)-神经网络
Lecture1: Neural Networks 为什么我们需要神经网络 当特征特别多(计算机视觉问题)时,如果计算多次多项式,得出来的最终特征会特别多,多到计算机无法处理。 产生的原因 Algorithms that try to mimic the brain. Was very widely used in 80s and early 90s; popularity diminished in late 90s Recent resurgence: State-of-the-art...
Read More -
May 22, 2017
机器学习(Week3)-逻辑回归
Lecture1: Classification and Representation 分类问题(Classification) 二元分类问题(Binary Classification) \[\class{myMJSmall}{y \in \{0,1\}}\] \(y\)只有两个值(即分成两类) 标记为0的分类:也叫负类(Negative Class),例如0代表良性肿瘤 标记为1的分类:也叫正类(Positive Class),例如1代表恶性肿瘤 预测函数/逻辑回归(Logistic Regression) \[\class{myMJSmall}{h_\theta(x) = g(\theta^Tx) \\ g(z) = \frac{1}{1+e^{-z}} \\ 即 h_\theta(x) = \frac{1}{1+e^{-\theta^Tx}}}\] \(0...
Read More -
May 20, 2017
机器学习(Week2)-多变量线性回归
Lecture1: Multivariate Linear Regression 多变量线性回归(Multivariate Linear Regression) 符号 \(n\):特征数量 \(x^{(i)}\):第i个样本的所有特征 \(x^{(i)}_j\):第i个样本的第j个特征。特别的\(x^{(i)}_0 = 1\) 预测函数(Hypothesis) \[\class{myMJSmall}{h_\theta(x)=\theta_0x_0+\theta_1x_1+ \cdots + \theta_nx_n}\\ \theta^Tx\] 其中\(x_0 = 0\) 代价函数(Cost Function/Squared Error Function/Mean Squared Error) \[\class{myMJSmall}{J(\theta)=J(\theta_0,\theta_1,\ldots,\theta_n)=\frac 1{2m}\sum_{i=1}^m(h_\theta(x^{(i)})-y^{(i)})^2}\]...
Read More