吴裕雄 python深度学习与实践(5)
import numpy as np data = np.mat([[1,200,105,3,False],
[2,165,80,2,False],
[3,184.5,120,2,False],
[4,116,70.8,1,False],
[5,270,150,4,True]])
row = 0
for line in data:
row += 1
print(row)
print(data.size)
import numpy as np data = np.mat([[1,200,105,3,False],
[2,165,80,2,False],
[3,184.5,120,2,False],
[4,116,70.8,1,False],
[5,270,150,4,True]])
print(data[0,3])
print(data[0,4])
import numpy as np data = np.mat([[1,200,105,3,False],
[2,165,80,2,False],
[3,184.5,120,2,False],
[4,116,70.8,1,False],
[5,270,150,4,True]])
print(data)
col1 = []
for row in data:
print(row)
col1.append(row[0,1]) print(col1)
print(np.sum(col1))
print(np.mean(col1))
print(np.std(col1))
print(np.var(col1))
import pylab
import numpy as np
import scipy.stats as stats data = np.mat([[1,200,105,3,False],
[2,165,80,2,False],
[3,184.5,120,2,False],
[4,116,70.8,1,False],
[5,270,150,4,True]]) col1 = []
for row in data:
col1.append(row[0,1]) stats.probplot(col1,plot=pylab)
pylab.show()
import pandas as pd
import matplotlib.pyplot as plot rocksVMines = pd.DataFrame([[1,200,105,3,False],
[2,165,80,2,False],
[3,184.5,120,2,False],
[4,116,70.8,1,False],
[5,270,150,4,True]])
print(rocksVMines)
dataRow1 = rocksVMines.iloc[1,0:3]
dataRow2 = rocksVMines.iloc[2,0:3]
print(type(dataRow1))
print(dataRow1)
print(dataRow2)
plot.scatter(dataRow1, dataRow2)
plot.xlabel("Attribute1")
plot.ylabel("Attribute2")
plot.show() dataRow3 = rocksVMines.iloc[3,0:3]
plot.scatter(dataRow2, dataRow3)
plot.xlabel("Attribute2")
plot.ylabel("Attribute3")
plot.show()
import numpy as np
import pandas as pd
import matplotlib.pyplot as plot filePath = ("G:\\MyLearning\\TensorFlow_deep_learn\\data\\dataTest.csv")
dataFile = pd.read_csv(filePath,header=None, prefix="V")
print(np.shape(dataFile))
dataRow1 = dataFile.iloc[100,1:300]
dataRow2 = dataFile.iloc[101,1:300]
plot.scatter(dataRow1, dataRow2)
plot.xlabel("Attribute1")
plot.ylabel("Attribute2")
plot.show()
import pandas as pd
import matplotlib.pyplot as plot filePath = ("G:\\MyLearning\\TensorFlow_deep_learn\\data\\dataTest.csv")
dataFile = pd.read_csv(filePath,header=None, prefix="V") target = []
for i in range(200):
if dataFile.iat[i,10] >= 7:
target.append(1.0)
else:
target.append(0.0) dataRow = dataFile.iloc[0:200,10]
plot.scatter(dataRow, target)
plot.xlabel("Attribute")
plot.ylabel("Target")
plot.show()
import random as rd
import pandas as pd
import matplotlib.pyplot as plot filePath = ("G:\\MyLearning\\TensorFlow_deep_learn\\data\\dataTest.csv")
dataFile = pd.read_csv(filePath,header=None, prefix="V") target = []
for i in range(200):
if dataFile.iat[i,10] >= 7:
target.append(1.0 + rd.uniform(-0.3, 0.3))
else:
target.append(0.0 + rd.uniform(-0.3, 0.3))
dataRow = dataFile.iloc[0:200,10]
plot.scatter(dataRow, target, alpha=0.5, s=100)
plot.xlabel("Attribute")
plot.ylabel("Target")
plot.show()
from pylab import *
import pandas as pd
import matplotlib.pyplot as plot filePath = ("G:\\MyLearning\\TensorFlow_deep_learn\\data\\dataTest.csv")
dataFile = pd.read_csv(filePath,header=None, prefix="V") print(dataFile.head())
print(dataFile.tail()) summary = dataFile.describe()
print(summary) array = dataFile.iloc[:,10:16].values
boxplot(array)
plot.xlabel("Attribute")
plot.ylabel("Score")
show()
吴裕雄 python深度学习与实践(5)的更多相关文章
- 吴裕雄 python深度学习与实践(18)
# coding: utf-8 import time import numpy as np import tensorflow as tf import _pickle as pickle impo ...
- 吴裕雄 python深度学习与实践(17)
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data import time # 声明输 ...
- 吴裕雄 python深度学习与实践(16)
import struct import numpy as np import matplotlib.pyplot as plt dateMat = np.ones((7,7)) kernel = n ...
- 吴裕雄 python深度学习与实践(15)
import tensorflow as tf import tensorflow.examples.tutorials.mnist.input_data as input_data mnist = ...
- 吴裕雄 python深度学习与实践(14)
import numpy as np import tensorflow as tf import matplotlib.pyplot as plt threshold = 1.0e-2 x1_dat ...
- 吴裕雄 python深度学习与实践(13)
import numpy as np import matplotlib.pyplot as plt x_data = np.random.randn(10) print(x_data) y_data ...
- 吴裕雄 python深度学习与实践(12)
import tensorflow as tf q = tf.FIFOQueue(,"float32") counter = tf.Variable(0.0) add_op = t ...
- 吴裕雄 python深度学习与实践(11)
import numpy as np from matplotlib import pyplot as plt A = np.array([[5],[4]]) C = np.array([[4],[6 ...
- 吴裕雄 python深度学习与实践(10)
import tensorflow as tf input1 = tf.constant(1) print(input1) input2 = tf.Variable(2,tf.int32) print ...
- 吴裕雄 python深度学习与实践(9)
import numpy as np import tensorflow as tf inputX = np.random.rand(100) inputY = np.multiply(3,input ...
随机推荐
- windows模拟linux部分功能
--------------------------------------------分割线----------------------------------------------- 系统 wi ...
- RecyclerView拖拽排序;
效果就是这样,RecyclerView列表可拖拽排序,可删除,可添加: RecyclerView给我们提供了一个手势器: ItemTouchHelper helper = new ItemTouchH ...
- 【CF1132F】Clear the String (DP)
/* 区间dp题目, 考虑当前区间l,r 是可以枚举最后一次拿的分界点来考虑最右边节点是不是具有贡献 */ #include<cstdio> #include<algorithm&g ...
- Debug版本正常运行,Release版本编译通过但运行崩溃
解决这个问题之前,第一个想的是Debug版本和Release版本有什么区别 Debug版: 经过编译器编译出的项目.exe文件大,而且生成的二进制命令没有经过编译器的优化.项目中包含着丰富的调试信息, ...
- Nodejs总结(一)
Node.js 是一个基于Chrome JavaScript 运行时建立的一个平台,事件驱动I/O服务端JavaScript环境,基于Google的V8引擎,V8引擎执行Javascript的速度非常 ...
- 登录iOS Dev Center
打开网站iOS Dev Center使用苹果开发者账号登录iOS Dev Center:登录成功后在页面右侧选择“Certificates, Identifiers & Profiles”:在 ...
- poi 导入Excel解析 2003 2007
Workbook wb = WorkbookFactory.create(new FileInputStream(file)); Sheet sheet = wb.getSheetAt(0);// 第 ...
- uva-10714-贪心
题意:有一条杆,长度为L,上面很几只蚂蚁,蚂蚁的朝向未知,爬速1cm/s,在爬行过程中,蚂蚁相撞了就往反方向爬,问,杆上没有蚂蚁至少要多久,至多要多久 解题思路: 蚂蚁1和蚂蚁2相撞,我们只要交换一下 ...
- Weblogic环境(JSP)文件下载问题(下载的文件与原文件大小不一致问题)
最近发现一个问题有个download.jsp文件下载jsp在Tomcat下正常,在Weblogic下不太正常! Weblogic下载的文件比原文件大两个字节,查看文件像是文件内容最后多了空行 检查do ...
- Flex Iris效果放大或缩小组件演示
Iris效果通过扩展或收缩集中在目标上的矩形遮罩为效果目标设置动画.该效果可以从目标的中心放大遮罩来显示目标,也可以向中心收缩遮罩来隐藏目标.演示: 源码如下: <?xml version=&q ...