为了账号安全,请及时绑定邮箱和手机立即绑定
  • 权重更新算法示例2

    查看全部
  • 权重更新算法示例2

    查看全部
  • 权重更新算法示例

    查看全部
  • 权重更新算法

    查看全部
  • 神经网络
    查看全部
    0 采集 收起 来源:课程的开篇词

    2018-03-21

  • 使用anaconda,jupyter
    查看全部
  • 喜欢这样念念碎的老师,哈哈
    查看全部
  • 2018/03/10
    查看全部
  • 软件、代码
    查看全部
  • 第3段 from matplotlib.colors import ListedColormap def plot_decision_regions(x,y,classifier,resolution=0.02): colors = ('red','blue','lightgreen','gray','cyan') cmap = ListedColormap(colors[:len(np.unique(y))]) x1_min,x1_max = X[:,0].min()-1,X[:,0].max() x2_min,x2_max = X[:,1].min()-1,X[:,1].max() xx1,xx2 = np.meshgrid(np.arange(x1_min,x1_max,resolution),np.arange(x2_min,x2_max,resolution)) Z = classifier.predict(np.array([xx1.ravel(),xx2.ravel()]).T) Z = Z.reshape(xx1.shape) plt.contourf(xx1,xx2,Z,alpha=0.4,cmap=cmap) plt.xlim(xx1.min(),xx1.max()) plt.ylim(xx2.min(),xx2.max()) plt.scatter(X[:50,0],X[:50,1],color='red',marker='o',label='setosa') plt.scatter(X[50:100,0],X[50:100,1],color='blue',marker='x',label='versicolor') plt.xlabel(u'花径长度',fontproperties='SimHei') plt.ylabel(u'花瓣长度',fontproperties='SimHei') plt.legend(loc='upper left') plt.show() plot_decision_regions(X,y,ppn,resolution=0.02)
    查看全部
  • 第2段 import pandas as pd file = 'http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data' df = pd.read_csv(file,header=None) #header=None 数据第一行是有用数据,不是表头 print(df.head(10)) # 显示前十行 #数据可视化 scatter 散点图 import matplotlib.pyplot as plt import numpy as np y = df.loc[0:100,4].values y = np.where(y == 'Iris-setosa',-1,1) X = df.iloc[0:100,[0,2]].values #plt.scatter(X[:50,0],X[:50,1],color='red',marker='o',label='setosa') #plt.scatter(X[50:100,0],X[50:100,1],color='blue',marker='x',label='versicolor') #plt.xlabel('花瓣长度') 乱码坐标不显示 #plt.xlabel(u'花瓣长度',fontproperties='SimHei') #plt.ylabel(u'花径长度',fontproperties='SimHei') #plt.legend(loc='upper left') #plt.show() ppn = Perceptron(eta=0.1,n_iter=10) ppn.fit(X,y) plt.plot(range(1,len(ppn.errors_)+1),ppn.errors_,marker='o') plt.xlabel(u'Epochs',fontproperties='SimHei') plt.ylabel(u'错误分类次数',fontproperties='SimHei') plt.show()
    查看全部
  • 基本按着老师的写的,能出图~ 笔记字数有限制,代码分了几部分,注释参考老师的讲解。 (第1段) # -*- coding: utf-8 -*- import numpy as np class Perceptron(object): def __init__(self, eta = 0.01, n_iter=10): self.eta = eta; self.n_iter = n_iter; pass def fit(self, X, y): self.w_ = np.zeros(1 + X.shape[1]); self.errors_ = []; for _ in range(self.n_iter) : errors = 0 for xi, target in zip(X,y): update = self.eta * (target - self.predict(xi)) self.w_[1:] += update * xi self.w_[0] += update; errors += int(update != 0.0) self.errors_.append(errors) pass pass pass def net_input(self, X): return np.dot(X, self.w_[1:]) + self.w_[0] pass def predict(self, X): return np.where(self.net_input(X) >= 0.0 , 1, -1) pass pass
    查看全部
  • 权重更新
    查看全部
  • 算法总结
    查看全部
  • 机器学习
    查看全部
    0 采集 收起 来源:课程的开篇词

    2018-02-26

举报

0/150
提交
取消
课程须知
有一定的编程基础,例如掌握C语言。
老师告诉你能学到什么?
1、机器学习的基本概念介绍 2、数据分类算法介绍 3、神经元感知器分类算法并进行实现 4、数据解析和可视化设计 5、使用数据训练神经网络 6、如何使用训练后的神经网络分类数据 7、适应性线性神经元的基本原理并实现 8、适应性线性神经元网络进行数据分类

微信扫码,参与3人拼团

意见反馈 帮助中心 APP下载
官方微信
友情提示:

您好,此课程属于迁移课程,您已购买该课程,无需重复购买,感谢您对慕课网的支持!