Machine learning第6周编程作业】的更多相关文章

1.Gaussian Kernel function sim = gaussianKernel(x1, x2, sigma) %RBFKERNEL returns a radial basis function kernel between x1 and x2 % sim = gaussianKernel(x1, x2) returns a gaussian kernel between x1 and x2 % and returns the value in sim % Ensure that…
1.linearRegCostFunction: function [J, grad] = linearRegCostFunction(X, y, theta, lambda) %LINEARREGCOSTFUNCTION Compute cost and gradient for regularized linear %regression with multiple variables % [J, grad] = LINEARREGCOSTFUNCTION(X, y, theta, lamb…
1.findClosestCentroids function idx = findClosestCentroids(X, centroids) %FINDCLOSESTCENTROIDS computes the centroid memberships for every example % idx = FINDCLOSESTCENTROIDS (X, centroids) returns the closest centroids % in idx for a dataset X wher…
1.Sigmoid Gradient function g = sigmoidGradient(z) %SIGMOIDGRADIENT returns the gradient of the sigmoid function %evaluated at z % g = SIGMOIDGRADIENT(z) computes the gradient of the sigmoid function % evaluated at z. This should work regardless if z…
1.lrCostFunction: 和第三周的那个一样的: function [J, grad] = lrCostFunction(theta, X, y, lambda) %LRCOSTFUNCTION Compute cost and gradient for logistic regression with %regularization % J = LRCOSTFUNCTION(theta, X, y, lambda) computes the cost of using % theta…
问题描述: 做吴恩达深度学习第4课第3周编程作业时导入PIL包报错. 我的环境: 已经安装了Tensorflow GPU 版本 Python3 Anaconda 解决办法: 安装pillow模块,而不是PIL模块.原因是PIL模块不支持python3, 只支持python2. Python3下应安装pillow模块代, 替PIL即可. 下面内容是根据自己环境的记录: Ubuntu下我用Anaconda已经搭建好了Tensorflow GPU环境,环境名字是tf. 命令行下输入(下面命令不加sud…
我python2.7, 做吴恩达深度学习第2课第2周编程作业 Optimization Methods 时有2个坑: 第一坑 需将辅助文件 opt_utils.py 的 nitialize_parameters(layer_dims) 函数中的 2 改成 2.0 , 保存后再重启jupyter notebook. 第二坑 需将辅助文件 opt_utils.py 的 plot_decision_boundary(model, X, y) 函数中的 c=y 改成 c=y[0], 保存后再重启jupy…
做题记录 风影影,景色明明,淡淡云雾中,小鸟轻灵. c++的文件操作已经好玩起来了,不过掌握好控制结构显得更为重要了. 我这也不做啥题目分析了,直接就题干-代码. 总结--留着自己看 1. 流是指从一个位置向另一个位置传输的一连串数据的集合. 2. 标准输入流一一从标准输入设备(键盘)流向程序的数据.,一般用cin流对象进行输入 3. ">>",这个符号是输入ios类的符号重载函数.以回车和空格作为分隔符.就是说中间的空格符号无法获得. 4. 着重介绍:get 和 getl…
SVMs are considered by many to be the most powerful 'black box' learning algorithm, and by posing构建 a cleverly-chosen optimization objective优化目标, one of the most widely used learning algorithms today. 第一节 向量的内积(SVM的基本数学知识) Support Vector Machines 支持向…
In Week 6, you will be learning about systematically improving your learning algorithm. The videos for this week will teach you how to tell when a learning algorithm is doing poorly, and describe the 'best practices' for how to 'debug' your learning…
Machine Learning – Coursera Octave for Microsoft Windows GNU Octave官网 GNU Octave帮助文档 (有900页的pdf版本) Octave 4.0.0 安装 win7(文库) Octave学习笔记(文库) octave入门(文库) WIN7 64位系统安装JDK并配置环境变量(总是显示没有安装Java) MathWorks This week we're covering linear regression with mul…
The Neural Network is one of the most powerful learning algorithms (when a linear classifier doesn't work, this is what I usually turn to), and this week's videos explain the 'backprogagation' algorithm for training these models. In this week's progr…
Logistic regression is a method for classifying data into discrete outcomes. For example, we might use logistic regression to classify an email as spam or not spam. In this module, we introduce the notion of classification, the cost function for logi…
博客已经迁移至Marcovaldo's blog (http://marcovaldong.github.io/) 刚刚完毕了Cousera上Machine Learning的最后一周课程.这周介绍了machine learning的一个应用:photo OCR(optimal character recognition,光学字符识别),以下将笔记整理在以下. Photo OCR Problem Description and Pipeline 最后几小节介绍机器学习的一个应用--photo O…
博客已经迁移到Marcovaldo's blog (http://marcovaldong.github.io/) 刚刚完毕了Andrew Ng在Cousera上的Machine Learning的第十周课程,这周主要介绍的是大规模机器学习.现将笔记整理在以下. Gradient Descent with Large Datasets Learning With Large Datasets 在前面介绍bias-variance的时候.我们曾提到一个比較各种算法孰优孰劣的实验,结论是"it's…
一.准备工作 从网站上将编程作业要求下载解压后,在Octave中使用cd命令将搜索目录移动到编程作业所在目录,然后使用ls命令检查是否移动正确.如: 提交作业:提交时候需要使用自己的登录邮箱和提交令牌,如下: 二.单变量线性回归 绘制图形:rx代表图形中标记的点为红色的x,数字10表示标记的大小. plot(x, y, ); % Plot the data 计算代价函数(Cost Funtion):迭代次数1500,学习速率0.01.  iterations = 1500; alpha = 0.…
# ML week 1 2 一.关于machine learning的名词 学习 从无数数据提供的E:experience中找到一个函数使得得到T:task后能够得到P:prediction 监督学习 experience中的数据都是有t和p的,计算机通过t和p得到函数 1.分类 p是明确的类 如:书有小说,教科书,故事书 2.回归 p是线性的,如:书的价格 非监督学习 experience中的数据只有t没有p,计算机仅通过t得到可以分成不同类的p函数 1.聚类 将产生的结果分成不同的集合,每个…
一.准备工作 从网站上将编程作业要求下载解压后,在Octave中使用cd命令将搜索目录移动到编程作业所在目录,然后使用ls命令检查是否移动正确.如: 提交作业:提交时候需要使用自己的登录邮箱和提交令牌,如下: 二.单变量线性回归 绘制图形:rx代表图形中标记的点为红色的x,数字10表示标记的大小. plot(x, y, ); % Plot the data 计算代价函数(Cost Funtion):迭代次数1500,学习速率0.01.  iterations = 1500; alpha = 0.…
import os import email import email.policy 1. 读取邮件数据 SPAM_PATH = os.path.join( "E:\\3.Study\\机器学习\\Hand on Machine Learning\\第三章:分类\\spam_data") spam_path = os.path.join(SPAM_PATH, "spam") ham_path = os.path.join(SPAM_PATH, "easy_…
必做: [*] warmUpExercise.m - Simple example function in Octave/MATLAB[*] plotData.m - Function to display the dataset[*] computeCost.m - Function to compute the cost of linear regression[*] gradientDescent.m - Function to run gradient descent 1.warmUpE…
    这个作业属于哪个课程 C语言程序设计 这个作业的要求在哪里 https://pintia.cn/problem-sets/1120145772099268608 我在这个课程的目标是 了解结构类型,并用结构类型去解决一些实际问题 这个作业在哪个具体方面帮助帮助我实现目标 使我学习了相关知识,能够去解决一些实际问题 参考文献 <C语言程序设计> 按等级统计学生成绩 本题要求实现一个根据学生成绩设置其等级,并统计不及格人数的简单函数. 函数接口定义: int set_grade( stru…
    这个作业属于哪个课程 C语言程序设计 这个作业要求在哪 https://edu.cnblogs.com/campus/zswxy/computer-scienceclass3-2018/homework/3078 我在这个课程的目标是 学习字符串的几种函数以及内存动态分配并解决实际问题 这个作业在哪个具体方面帮助我实现目标 多练习,学会用所学知识去解决实际问题 参考文献 <C语言程序设计> 函数实现字符串逆序 本题要求实现一个字符串逆序的简单函数. 函数接口定义: void f( ch…
2分类1隐层nn, 作业默认设置: 1个输出单元, sigmoid激活函数. (因为二分类); 4个隐层单元, tanh激活函数. (除作为输出单元且为二分类任务外, 几乎不选用 sigmoid 做激活函数); n_x个输入单元, n_x为训练数据维度; 总的来说共三层: 输入层(n_x = X.shape[0]), 隐层(n_h = 4), 输出层(n_y = 1). import 和预设置 # Package imports import numpy as np import matplot…
一.  编程题 1.  结合turtle库使用手册,读懂下列代码,并在jupyter编译器中运行观察结果: 依次分析下代码: 第一行 通过保留字import引用了Python中用于绘制图形的turtle库,as是作为别名之用. (使用import引用函数库有两种方式,但其对函数的使用方式略有不同 import <库名>  | from <库名> import *) 第二行 使用了turtle.setup()函数.turtle.setup(width,height,startx,st…
Neural networks is a model inspired by how the brain works. It is widely used today in many applications: when your phone interprets(解释口译) and understand your voice commands, it is likely that a neural network is helping to understand your speech; wh…
分解质因数 题目内容: 每个非素数(合数)都可以写成几个素数(也可称为质数)相乘的形式,这几个素数就都叫做这个合数的质因数.比如,6可以被分解为2x3,而24可以被分解为2x2x2x3. 现在,你的程序要读入一个[2,100000]范围内的整数,然后输出它的质因数分解式:当读到的就是素数时,输出它本身. 提示:可以用一个函数来判断某数是否是素数. 输入格式: 一个整数,范围在[2,100000]内. 输出格式: 形如: n=axbxcxd 或 n=n 所有的符号之间都没有空格,x是小写字母x.a…
题目内容: 对数字求特征值是常用的编码算法,奇偶特征是一种简单的特征值.对于一个整数,从个位开始对每一位数字编号,个位是1号,十位是2号,以此类推.这个整数在第n位上的数字记作x,如果x和n的奇偶性相同,则记下一个1,否则记下一个0.按照整数的顺序把对应位的表示奇偶性的0和1都记录下来,就形成了一个二进制数字.比如,对于342315,这个二进制数字就是001101. 这里的计算可以用下面的表格来表示: 数字 3 4 2 3 1 5 数位 6 5 4 3 2 1 数字奇偶 奇 偶 偶 奇 奇 奇…
可能因为Andrew Ng用的是python3,而我是python2.7的缘故,我发现了坑.如下: 在辅助文件tf_utils.py中的random_mini_batches(X, Y, mini_batch_size = 64, seed = 0)函数中,把 math.floor(m/mini_batch_size) 改成 int(math.floor(m/mini_batch_size))就ok了. 就是下面的这个函数: def random_mini_batches(X, Y, mini_…
一. 逻辑回归 1.背景:使用逻辑回归预测学生是否会被大学录取. 2.首先对数据进行可视化,代码如下: pos = find(y==); %找到通过学生的序号向量 neg = find(y==); %找到未通过学生的序号向量 plot(X(pos,),X(pos,),,); %使用+绘制通过学生 hold on; plot(X(neg,),X(neg,),); %使用o绘制未通过学生 % Put some labels hold on; % Labels and Legend xlabel('E…
ML week3 逻辑回归 Logistic Function h_\theta(x)=g(\theta^Tx) g(t)=\frac{1}{1+e^{-z}} 当t大于0, 即下面公式成立时,y=1 \frac{1}{1+e^{-{\theta^Tx}}}>0.5 => {\theta^Tx}>0 关于theta与数据 y(x)=\theta_0+\theta_1x1+\theta_2x2 y(x)=\theta_0+\theta_1x_1+\theta_2x_2+\theta_3 x…