原文地址:http://www.jianshu.com/p/311141f2047d 问题描述 程序实现 13-15 # coding: utf-8 import numpy as np import numpy.random as random import matplotlib.pyplot as plt def sign(x): if(x>=0): return 1 else: return -1 def gen_data(): x1=random.uniform(-1,1,1000) x…
原文地址:http://www.jianshu.com/p/5b4a64874650 问题描述 程序实现 # coding: utf-8 import numpy as np import matplotlib.pyplot as plt import time def read_data(dataFile): with open(dataFile, 'r') as file: data_list = [] for line in file.readlines(): line = line.st…
原文地址:http://www.jianshu.com/p/4bc01760ac20 问题描述 程序实现 17-18 # coding: utf-8 import numpy as np import matplotlib.pyplot as plt def sign(n): if(n>0): return 1 else: return -1 def gen_data(): data_X=np.random.uniform(-1,1,(20,1))# [-1,1) data_Y=np.zeros…
原文地址:https://www.jianshu.com/p/6f86290e70f9 一.二元分类的线性模型 线性回归后的参数值常用于PLA/PA/Logistic Regression的参数初始化. 二.随机梯度下降 两种迭代优化模式: 若利用全部样本 ------> 利用随机的单个样本,则梯度下降 ------> 随机梯度下降. SGD与PLA的相似性: 当迭代次数足够多时,停止.步长常取0.1. 三.使用逻辑回归的多分类问题 是非题 ------> 选择题: 每次识别一类A,将其…
原文地址:https://www.jianshu.com/p/3f7d4aa6a7cf 问题描述 程序实现 # coding: utf-8 import numpy as np import math import matplotlib.pyplot as plt def sign(x): if(x>=0): return 1 else: return -1 def read_data(dataFile): with open(dataFile,'r') as f: lines=f.readli…
机器学习分为四步: When Can Machine Learn? Why Can Machine Learn? How Can Machine Learn? How Can Machine Learn Better? 一.What is Machine Learning Q:什么是“学习”? A:学习就是人类通过观察.积累经验,掌握某项技能或能力.就好像我们从小学习识别字母.认识汉字,就是学习的过程. 机器学习(Machine Learning),顾名思义,就是让机器(计算机)也能向人类一样,…
原文地址:https://www.jianshu.com/p/bd7cb6c78e5e 什么时候适合用机器学习算法? 存在某种规则/模式,能够使性能提升,比如准确率: 这种规则难以程序化定义,人难以给出准确定义: 存在能够反映这种规则的资料. 所以,机器学习就是设计算法\(A\),从包含许多假设的假设集合\(H\)里,根据所给的数据集\(D\),选出和实际规则\(f\)最为相似的假设\(g\). \(g\)和\(f\)相似度的衡量是基于所有数据,不仅仅是\(D\). \(Learning \ M…
原文地址:https://www.jianshu.com/p/f2f4d509060e 机器学习是设计算法\(A\),在假设集合\(H\)里,根据给定数据集\(D\),选出与实际模式\(f\)最为相近的假设\(g\)(\(g\)可能与\(f\)相同,也可能不同). 那什么情况下学习是可行的?即保证\(g\)和\(f\)是相似的. 数据集内的表现\(g\)约等于\(f\); \(g\)在数据集外的表现约等于\(g\)在数据集内的表现. 结合1.2可保证,由算法在给定数据集上学习到的\(g\)(即数…
原文地址:https://www.jianshu.com/p/86b2a9cef742 一.学习的分类 根据输出空间\(Y\):分类(二分类.多分类).回归.结构化(监督学习+输出空间有结构): 根据标签\(y\):监督学习.无监督学习(聚类.密度估计.异常点检测).半监督学习(标注成本高时).强化学习: 根据数据喂给方式:批.在线(PLA.强化学习).主动学习: 根据输入空间\(X\):具体(相关物理意义).原始(图像灰度值).抽象(用户id). 二.主动学习 vs 半监督学习 半监督学习是不…