【第21期】观点:人工智能到底用 GPU?还是用 FPGA?

seaborn

原创 2016年05月31日 19:43:49
%matplotlib inline
import pandas as pd
import numpy as np
import seaborn as sns
from sklearn import preprocessing
import matplotlib.pyplot as plt
np.random.seed(sum(map(ord, "aesthetics")))
def sinplot(flip=1):
    x=np.linspace(0,14,100)
    for i in range(1,7):
        plt.plot(x,np.sin(x+i*.5)*(7-i)*flip)
sinplot()
![png](output_1_0.png)
sns.set_style('whitegrid')
data=np.random.normal(size=(20,6))+np.arange(6)/2
sns.boxplot(data=data)
stock=pd.read_csv('sample.csv',index_col=0)
ohcl=stock.ix[:15,:4][::-1].T
sns.boxplot(ohcl)
# set_style()
sns.set_style("dark")
sns.boxplot(ohcl)
sns.set_style("ticks",{'xtick.direction': u'out'})
sns.boxplot(ohcl)
sns.despine()
![png](output_6_0.png)
sns.violinplot(ohcl,palette="deep")
sns.despine(offset=10,trim=True,left=True)
![png](output_7_0.png)
sns.axes_style()
{‘axes.axisbelow’: True, ‘axes.edgecolor’: ‘.15’, ‘axes.facecolor’: ‘white’, ‘axes.grid’: False, ‘axes.labelcolor’: ‘.15’, ‘axes.linewidth’: 1.25, ‘figure.facecolor’: ‘white’, ‘font.family’: [u’sans-serif’], ‘font.sans-serif’: [u’Arial’, u’Liberation Sans’, u’Bitstream Vera Sans’, u’sans-serif’], ‘grid.color’: ‘.8’, ‘grid.linestyle’: u’-‘, ‘image.cmap’: u’Greys’, ‘legend.frameon’: False, ‘legend.numpoints’: 1, ‘legend.scatterpoints’: 1, ‘lines.solid_capstyle’: u’round’, ‘text.color’: ‘.15’, ‘xtick.color’: ‘.15’, ‘xtick.direction’: u’out’, ‘xtick.major.size’: 6.0, ‘xtick.minor.size’: 3.0, ‘ytick.color’: ‘.15’, ‘ytick.direction’: u’out’, ‘ytick.major.size’: 6.0, ‘ytick.minor.size’: 3.0}
sns.set_context('talk')   #notebook ,poster,talk
sns.boxplot(ohcl)
sns.set_style('darkgrid')
sns.regplot(x=stock.volume,y=stock.ma10,logx=True,x_estimator=np.mean)
sns.lmplot(x='ma5',y='ma20',data=stock,aspect=.5)
sns.lmplot(x='ma5',y='ma20',data=stock,aspect=.5)
sns.jointplot(x='ma10',y='price_change',data=stock,kind='reg')
#{ "scatter" | "reg" | "resid" | "kde" | "hex" }, optional
sns.jointplot(x='ma10',y='price_change',data=stock,kind='kde')
sns.jointplot(x='ma10',y='price_change',data=stock,kind='resid')
sns.jointplot(x='ma10',y='price_change',data=stock,kind='hex')
sns.jointplot(x='ma10',y='price_change',data=stock,kind='scatter')
titanic = sns.load_dataset("titanic")
tips = sns.load_dataset("tips")
iris = sns.load_dataset("iris")
tips
total_bill tip sex smoker day time size
0 16.99 1.01 Female No Sun Dinner 2
1 10.34 1.66 Male No Sun Dinner 3
2 21.01 3.50 Male No Sun Dinner 3
3 23.68 3.31 Male No Sun Dinner 2
4 24.59 3.61 Female No Sun Dinner 4
5 25.29 4.71 Male No Sun Dinner 4
6 8.77 2.00 Male No Sun Dinner 2
7 26.88 3.12 Male No Sun Dinner 4
8 15.04 1.96 Male No Sun Dinner 2
9 14.78 3.23 Male No Sun Dinner 2
10 10.27 1.71 Male No Sun Dinner 2
11 35.26 5.00 Female No Sun Dinner 4
12 15.42 1.57 Male No Sun Dinner 2
13 18.43 3.00 Male No Sun Dinner 4
14 14.83 3.02 Female No Sun Dinner 2
15 21.58 3.92 Male No Sun Dinner 2
16 10.33 1.67 Female No Sun Dinner 3
17 16.29 3.71 Male No Sun Dinner 3
18 16.97 3.50 Female No Sun Dinner 3
19 20.65 3.35 Male No Sat Dinner 3
20 17.92 4.08 Male No Sat Dinner 2
21 20.29 2.75 Female No Sat Dinner 2
22 15.77 2.23 Female No Sat Dinner 2
23 39.42 7.58 Male No Sat Dinner 4
24 19.82 3.18 Male No Sat Dinner 2
25 17.81 2.34 Male No Sat Dinner 4
26 13.37 2.00 Male No Sat Dinner 2
27 12.69 2.00 Male No Sat Dinner 2
28 21.70 4.30 Male No Sat Dinner 2
29 19.65 3.00 Female No Sat Dinner 2
214 28.17 6.50 Female Yes Sat Dinner 3
215 12.90 1.10 Female Yes Sat Dinner 2
216 28.15 3.00 Male Yes Sat Dinner 5
217 11.59 1.50 Male Yes Sat Dinner 2
218 7.74 1.44 Male Yes Sat Dinner 2
219 30.14 3.09 Female Yes Sat Dinner 4
220 12.16 2.20 Male Yes Fri Lunch 2
221 13.42 3.48 Female Yes Fri Lunch 2
222 8.58 1.92 Male Yes Fri Lunch 1
223 15.98 3.00 Female No Fri Lunch 3
224 13.42 1.58 Male Yes Fri Lunch 2
225 16.27 2.50 Female Yes Fri Lunch 2
226 10.09 2.00 Female Yes Fri Lunch 2
227 20.45 3.00 Male No Sat Dinner 4
228 13.28 2.72 Male No Sat Dinner 2
229 22.12 2.88 Female Yes Sat Dinner 2
230 24.01 2.00 Male Yes Sat Dinner 4
231 15.69 3.00 Male Yes Sat Dinner 3
232 11.61 3.39 Male No Sat Dinner 2
233 10.77 1.47 Male No Sat Dinner 2
234 15.53 3.00 Male Yes Sat Dinner 2
235 10.07 1.25 Male No Sat Dinner 2
236 12.60 1.00 Male Yes Sat Dinner 2
237 32.83 1.17 Male Yes Sat Dinner 2
238 35.83 4.67 Female No Sat Dinner 3
239 29.03 5.92 Male No Sat Dinner 3
240 27.18 2.00 Female Yes Sat Dinner 2
241 22.67 2.00 Male Yes Sat Dinner 2
242 17.82 1.75 Male No Sat Dinner 2
243 18.78 3.00 Female No Thur Dinner 2

244 rows × 7 columns

sns.stripplot(x='day',y='total_bill',data=tips)
<matplotlib.axes._subplots.AxesSubplot at 0x42fce940>

png

sns.stripplot(x='day',y='total_bill',data=tips,jitter=True)
<matplotlib.axes._subplots.AxesSubplot at 0x430546a0>

png

sns.swarmplot(x='day',y='total_bill',data=tips)
<matplotlib.axes._subplots.AxesSubplot at 0x4235d860>

png

sns.swarmplot(x='day',y='total_bill',hue='sex',data=tips)
<matplotlib.axes._subplots.AxesSubplot at 0x43503b00>

png

sns.swarmplot(x='size',y='total_bill',data=tips)
<matplotlib.axes._subplots.AxesSubplot at 0x435c7d30>

png

sns.swarmplot(x='total_bill',y='day',hue='time',data=tips)
<matplotlib.axes._subplots.AxesSubplot at 0x3e010828>

png

sns.boxplot(x='day',y='total_bill',data=tips)
<matplotlib.axes._subplots.AxesSubplot at 0x3e1b2240>

png


hs_stock=pd.read_csv('hs_stock.csv',index_col=0)
sns.boxplot(x='code',y='ma10',data=hs_stock)
<matplotlib.axes._subplots.AxesSubplot at 0x517754e0>

png

sns.violinplot(x="total_bill", y="day", hue="time", data=tips);

png

sns.violinplot(x="total_bill", y="day", hue="time", data=tips,
               bw=.1, scale="count", scale_hue=False);

png

sns.violinplot(x="day", y="total_bill", hue="sex", data=tips, split=True);

png

sns.violinplot(x="day", y="total_bill", data=tips, inner=None)
sns.swarmplot(x="day", y="total_bill", data=tips, color="w", alpha=.5);

png

sns.barplot(x="sex", y="survived", hue="class", data=titanic);

png

sns.countplot(x="deck", data=titanic, palette="Greens_d");

png

sns.factorplot(x="day", y="total_bill", hue="smoker", data=tips);

png

sns.factorplot(x="day", y="total_bill", hue="smoker", data=tips, kind="bar");

png

sns.factorplot(x="day", y="total_bill", hue="smoker",
               col="time", data=tips, kind="swarm");

png

sns.factorplot(x="time", y="total_bill", hue="smoker",
               col="day", data=tips, kind="box", size=4, aspect=.5);

png

g = sns.PairGrid(tips,
                 x_vars=["smoker", "time", "sex"],
                 y_vars=["total_bill", "tip"],
                 aspect=.75, size=3.5)
g.map(sns.violinplot, palette="pastel");

png

ohls=hs_stock.ix[:3000,:]
g=sns.FacetGrid(ohls,col='code')
g.map(sns.boxplot,'open',"ma5")
g.add_legend()
<seaborn.axisgrid.FacetGrid at 0x660e4f28>

png

gk=sns.PairGrid(ohls.ix[:,:9])
gk.map(plt.scatter)
<seaborn.axisgrid.PairGrid at 0xaa438828>

png

版权声明:本文为博主原创文章,未经博主允许不得转载。 举报

相关文章推荐

用python实现Kaggle的Titanic数据分析例子

一、做项目了解用到了sql语句,java,R,但是我觉得python更接近编程语言,就想先学一学python,就直接上手学数据处理吧,也就是pandas包的内容,之后再学习sklearn包运用,先这样...

04_2Python绘图_seaborn

Python中的一个制图工具库,可以制作出吸引人的、信息量大的统计图在Matplotlib上构建,支持numpy和pandas的数据结构可视化,甚至是scipy和statsmodels的统计模型可视化...

基于Python的数据可视化 matplotlib seaborn pandas

原文地址: https://www.kaggle.com/benhamner/d/uciml/iris/python-data-visualizations 看了本文后不禁佩服Python强大的数据可...

Python数据可视化—seaborn简介和实例

这里实例采用的数据集都是seaborn提供的几个经典数据集,dataset文件可见于Github。 1  set_style( ) 设置主题 Seaborn有五个预设好的主题: darkgrid , ...

量化交易——传统技术分析能量潮指标OBV的原理及实现

能量潮指标OBV股市分析中有四个要素,分别是价、量、时、空。其中OBV便是从成交量作为分析的突破口。它反映的是在股市起伏波动时相关的市场人气变化,可以用来判断股市是否处于有较强的想上冲的牛市中还是即将...

limma包的使用技巧

limmar package是一个功能比较全的包,既含有cDNA芯片的RAW data输入、前处理(归一化)功能,同时也有差异化基因分析的“线性”算法(limma: Linear Models f...
  • hzs106
  • hzs106
  • 2014-05-06 16:44
  • 1715

使用牛顿法确定逻辑斯谛回归(Logistic Regression)最佳回归系数

逻辑斯谛回归 关于逻辑斯谛回归,这篇文章http://blog.csdn.net/zouxy09/article/details/20319673 讲的很好;Andrew Ng的机器学习公开课也很不错...

离开之前的小总结

离开了,不为了什么,开始新的旅程吧!这一年多的小知识还是很多的,零零散散的一堆,能总结多少是多少吧。   R:       heatmap:heatmap.2(mat0, Colv =F, Ro...
  • skenoy
  • skenoy
  • 2013-06-14 09:39
  • 1082

样品表达量的相关性系数计算及画图

在刚开始学的时候不会用R来计算相关性系数,也不会画图,结果博主很悲催地用perl的svg进行画图,很久之前的作品: #!/usr/bin/env perl use warnings; use str...
  • skenoy
  • skenoy
  • 2013-03-13 16:26
  • 1246

Gnuradio结合hackrf 通过FSK调制实现文本文件的发送与接收

Gnuradio结合hackrf 通过FSK调制实现文本文件的发送与接收   一、实现目标 1、将我们要发送的文件封装成帧; 2、通过FSK调制与解调实现文件的传输; 3、将接受到的文件进行...
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)