吴裕雄 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 ...
随机推荐
- Java方法通过RestTemplate调用restful接口
背景:项目A需要在代码内部调用项目B的一个restful接口,该接口是POST方式,header中 Authorization为自定义内容,主要传输的内容封装在body中,所以使用到了RestTemp ...
- MySQL死锁问题分析及解决方法实例详解(转)
出处:http://www.jb51.net/article/51508.htm MySQL死锁问题是很多程序员在项目开发中常遇到的问题,现就MySQL死锁及解决方法详解如下: 1.MySQL常用 ...
- 38.纯 CSS 创作阶梯文字特效
原文地址:https://segmentfault.com/a/1190000015107942 HTML code: <div class="container"> ...
- 《汇编语言 基于x86处理器》第十三章高级语言接口部分的代码 part 2
▶ 书中第十三章的程序,主要讲了汇编语言和 C/++ 相互调用的方法 ● 代码,汇编中调用 C++ 函数 ; subr.asm INCLUDE Irvine32.inc askForInteger P ...
- spark 运行架构
spark 运行架构基本由三部分组成,包括SparkContext(驱动程序),ClusterManager(集群资源管理器)和Executor(任务执行过程)组成. 其中SparkContext负责 ...
- 转载:VS项目属性配置总结
本文来自:http://www.mamicode.com/info-detail-232474.html https://www.cnblogs.com/alinh/p/8066820.h ...
- django之Model类
Model是model的基类,该类的metaclass是modelbase,在生成model类对象时是采用modelbase的.django.setup()时,apps会把app建立app_confi ...
- Oracle服务无法启动,报:Windows无法启动OracleOraDb10g_home1TNSListener服务,错误 1067:进程意外终止。
运行配置和移植工具中的Net Configuration Assistant,进行监听程序配置.删除配置,然后重新配置. 切记 一定是先删除配置,再重新配置,而不是新建配置. 或者 打开Net Man ...
- nopi设置excel只读
- Mysql 隐式转换
表定义: CREATE TABLE `ids` ( id ) not null auto_increment, PRIMARY KEY (id) ); 表中存在一些IDs: 111, 112, 113 ...