吴裕雄 python 机器学习-NBYS(2)
import matplotlib
import numpy as np
import matplotlib.pyplot as plt n = 1000
xcord0 = []
ycord0 = []
xcord1 = []
ycord1 = []
markers =[]
colors =[] for i in range(n):
[r0,r1] = np.random.standard_normal(2)
myClass = np.random.uniform(0,1)
if (myClass <= 0.5):
fFlyer = r0 + 9.0
tats = 1.0*r1 + fFlyer - 9.0
xcord0.append(fFlyer)
ycord0.append(tats)
else:
fFlyer = r0 + 2.0
tats = r1+fFlyer - 2.0
xcord1.append(fFlyer)
ycord1.append(tats) fig = plt.figure()
ax = fig.add_subplot(111)
ax.scatter(xcord0,ycord0, marker='^', s=90)
ax.scatter(xcord1,ycord1, marker='o', s=50, c='red')
plt.plot([2,4], label='going up')
plt.show()
import matplotlib
import numpy as np
import matplotlib.pyplot as plt t = np.arange(0.0, 0.5, 0.01)
s = np.sin(2*np.pi*t)
logS = np.log(s) fig = plt.figure()
ax = fig.add_subplot(211)
ax.plot(t,s)
ax.set_ylabel('f(x)')
ax.set_xlabel('x') ax = fig.add_subplot(212)
ax.plot(t,logS)
ax.set_ylabel('ln(f(x))')
ax.set_xlabel('x')
plt.show()
吴裕雄 python 机器学习-NBYS(2)的更多相关文章
- 吴裕雄 python 机器学习-NBYS(1)
import numpy as np def loadDataSet(): postingList=[['my', 'dog', 'has', 'flea', 'problems', 'help', ...
- 吴裕雄 python 机器学习——分类决策树模型
import numpy as np import matplotlib.pyplot as plt from sklearn import datasets from sklearn.model_s ...
- 吴裕雄 python 机器学习——回归决策树模型
import numpy as np import matplotlib.pyplot as plt from sklearn import datasets from sklearn.model_s ...
- 吴裕雄 python 机器学习——线性判断分析LinearDiscriminantAnalysis
import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot ...
- 吴裕雄 python 机器学习——逻辑回归
import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot ...
- 吴裕雄 python 机器学习——ElasticNet回归
import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot ...
- 吴裕雄 python 机器学习——Lasso回归
import numpy as np import matplotlib.pyplot as plt from sklearn import datasets, linear_model from s ...
- 吴裕雄 python 机器学习——岭回归
import numpy as np import matplotlib.pyplot as plt from sklearn import datasets, linear_model from s ...
- 吴裕雄 python 机器学习——线性回归模型
import numpy as np from sklearn import datasets,linear_model from sklearn.model_selection import tra ...
随机推荐
- Structrued Streaming业务数据实时分析
先启动spark-shell,记得启动nc服务 输入以下代码 scala> import org.apache.spark.sql.functions._ import org.apache.s ...
- 用VirtualBox快速安装虚拟机virtual Machine(Win7+IE10)
前端测试,经常需要各种环境, 用“Virtual Box + OVA文件”安装虚拟机, 是简单高效的一种方法,可以安装各种window和IE的版本.下面以IE10 + Win7为例说明. 1) 下载和 ...
- Java连接postgreSQL数据库,找不到表。
postgreSQL数据库遵守SQL标准,表名库名不区分大小写. 数据库中是存在 gongan_address_ALL的表的,但是执行下列代码就会出错. stmt = c.createStatemen ...
- 安全测试8_Web安全实战1(DVWA部署)
1.渗透神器的打造(火狐浏览器的打造) Firebug HackBar(渗透插件) Tamper Data(抓包.截包.改包等功能) Proxy Switcher(代理设置) 2.PHP环境安装(ph ...
- Elasticsearch5.5.2安装和启动遇到哪些问题
最近学习Elasticsearch,顺便记录下操作步骤,供日后参考 安装环境 CentOS release 6.6 1.因Elasticsearch是基于java写的,所以它的运行环境中需要java的 ...
- iOS跳转洁面时隐藏tabBar的方法
//1.设置self.tabBarController.tabBar.hidden=YES; self.tabBarController.tabBar.hidden=YES; //2. ...
- Maven上传jar包到私服
1.认证,在M2_HOME/conf/settings.xml配置用户名密码 <server> <id>releases</id> <username> ...
- openx
1openx 插件开发——终端用 2openx _金额 3openx ————带整理 4openx url 5Openx 2.8.x 在php5.4.x下数据统计不能正常显示解决方案 6openx改造 ...
- for循环、in、not in
for循环可以遍历集合中任意一个元素 1 a = ["hello", "world", "dlrb"] 2 for b in a: 3 pr ...
- Ignoring query to other database
Ignoring query to other database 自己今天刚遇到,进入MySQL的时候,输入show databases; 产生如下错误 错误提示 Ignoring query to ...