整理自Andrew Ng 的 machine learnig 课程 week1. 目录: 什么是机器学习 监督学习 非监督学习 一元线性回归 模型表示 损失函数 梯度下降算法 1.什么是机器学习 Arthur Samuel不是一个playing checker的高手,但是他编了一个程序,每天和这个程序playing checker,后来这个程序最后变得特别厉害,可以赢很多很厉害的人了.所以Arthur Samuel就给机器学习下了一个比较old,不太正式的定义: " the field of s
视频学习来源 https://www.bilibili.com/video/av40787141?from=search&seid=17003307842787199553 笔记 环境为 anaconda + python3.7 Keras 线性回归 import keras from keras.layers import Dense from keras.models import Sequential import numpy as np import matplotlib.pyplot
由于python中的for循环不像C++这么灵活,因此该用枚举法实现该算法: C="abcdefhe" D="cdefghe" m=0 n=len(C) E=[] b=0 while(m<n): i=n-m while(i>=0): E.append(C[m:m+i]) i-=1 m+=1 for x in E: a=0 if x in D: a=len(x) c=E.index(x) if a > b:#保存符合要求的最长字符串长度和地址 b=a
梯度下降法是非常常见的优化方法,在神经网络的深度学习中更是必会方法,但是直接从深度学习去实现,会比较复杂.本文试图使用梯度下降来优化最简单的LSR线性回归问题,作为进一步学习的基础. import numpy as np import pandas as pd from numpy import * from pandas import * import matplotlib.pyplot as plt x = np.array([[1,2],[2,1],[3,2.5],[4,3], [5,4]