求大神echart 散点图 data散点地图本地源码,简单粗暴的。

他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)&figure&&img src=&https://pic4.zhimg.com/v2-88d393f2c086cfd1720c_b.jpg& data-rawwidth=&1400& data-rawheight=&600& class=&origin_image zh-lightbox-thumb& width=&1400& data-original=&https://pic4.zhimg.com/v2-88d393f2c086cfd1720c_r.jpg&&&/figure&&h1&鱼缸式百分比比较信息图&/h1&
&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&library(tidyverse)
require(grid)
library(&Rmisc&)
&/code&&/pre&&/div&
&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&px1&-seq(from=0,to=10,length=1000)
py1&-sqrt(5^2-(px1-5)^2)
Project1x&-c(px1,rev(px1))
Project1y&-c(py1,-py1)
&/code&&/pre&&/div&
&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&Project1&-data.frame(lon=Project1x,lat=Project1y)
Project1$group&-&ProjectA&
Project1$order&-1:nrow(Project1)
Project2&-data.frame(lon=Project1x+15,lat=Project1y)
Project2$group&-&ProjectB&
Project2$order&-1:nrow(Project2)
Project3&-data.frame(lon=Project1x+30,lat=Project1y)
Project3$group&-&ProjectC&
Project3$order&-1:nrow(Project3)
Project4&-data.frame(lon=Project1x+45,lat=Project1y)
Project4$group&-&ProjectD&
Project4$order&-1:nrow(Project4)
Project5&-data.frame(lon=Project1x+60,lat=Project1y)
Project5$group&-&ProjectE&
Project5$order&-1:nrow(Project5)
Project&-rbind(Project1,Project2,Project3,Project4,Project5)
&/code&&/pre&&/div&
&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&ggplot(Project)+geom_path(aes(lon,lat,group=group))
&/code&&/pre&&/div&
&figure&&img src=&http://pic3.zhimg.com/v2-8f16d64ef5dbc0b4be360ae4fe9f418e_b.jpg& data-rawwidth=&1336& data-rawheight=&558& class=&origin_image zh-lightbox-thumb& width=&1336& data-original=&http://pic3.zhimg.com/v2-8f16d64ef5dbc0b4be360ae4fe9f418e_r.jpg&&&/figure&&br&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&Proj1&-Project1[,1:2]%&%filter(lat&=-4)
Proj1[nrow(Proj1)+1,]&-c(8,-4)
Proj1$group&-&ProjA&
Proj1$order&-1:nrow(Proj1)
Proj2&-Project2[,1:2]%&%filter(lat&=-3)
Proj2[nrow(Proj2)+1,]&-c(24,-3)
Proj2$group&-&ProjB&
Proj2$order&-1:nrow(Proj2)
Proj3&-Project3[,1:2]%&%filter(lat&=0)
Proj3[nrow(Proj3)+1,]&-c(40,0)
Proj3$group&-&ProjC&
Proj3$order&-1:nrow(Proj3)
Proj4&-Project4[,1:2]%&%filter(lat&=3)
Proj4$group&-&ProjD&
Proj4$order&-1:nrow(Proj4)
Proj5&-Project5[,1:2]%&%filter(lat&=4)
Proj5$group&-&ProjE&
Proj5$order&-1:nrow(Proj5)
Projdata&-rbind(Proj1,Proj2,Proj3,Proj4,Proj5)
&/code&&/pre&&/div&
&figure&&img src=&http://pic2.zhimg.com/v2-86bbdd672d52d1_b.jpg& data-rawwidth=&1219& data-rawheight=&551& class=&origin_image zh-lightbox-thumb& width=&1219& data-original=&http://pic2.zhimg.com/v2-86bbdd672d52d1_r.jpg&&&/figure&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&windowsFonts(myFont=windowsFont(&msyh.ttc&))
labeldata&-data.frame(x=seq(from=5,to=65,length=5),y=c(-4,-3,0,3,4),label=sprintf(&%2d%%&,c(10,20,50,80,90)))
&/code&&/pre&&/div&
&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&p1&-ggplot()+
geom_polygon(data=Projdata,aes(x=lon,y=lat,group=group),fill=&#92D24F&,col=NA)+
geom_path(data=Project,aes(x=lon,y=lat,group=group),col=&black&,size=1.2)+
geom_text(data=labeldata,aes(x=x,y=y+1,label=label),hjust=.5)+
scale_x_continuous(breaks=labeldata$x,labels=paste0(&Project&,LETTERS[1:5]))+
ylim(-5.5,6)+
theme_minimal()+
panel.grid=element_blank(),
axis.title=element_blank(),
axis.text.y=element_blank(),
plot.margin = unit(c(.2,.2,1,.2), &cm&)
&/code&&/pre&&/div&&br&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&p2&-ggplot()+
geom_polygon(data=Projdata,aes(x=lon,y=lat,group=group),fill=&#FFC000&,col=NA)+
geom_path(data=Project,aes(x=lon,y=lat,group=group),col=&black&,size=1.2)+
geom_text(data=labeldata,aes(x=x,y=y+1,label=label),hjust=.5)+
scale_x_continuous(breaks=labeldata$x,labels=paste0(&Project&,LETTERS[1:5]))+
ylim(-5.5,6)+
theme_minimal()+
panel.grid=element_blank(),
axis.title=element_blank(),
axis.text.y=element_blank(),
plot.margin = unit(c(.2,.2,1,.2), &cm&)
&/code&&/pre&&/div&&br&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&grid.newpage()
pushViewport(viewport(layout=grid.layout(2,2)))
vplayout &- function(x,y){viewport(layout.pos.row = x, layout.pos.col = y)}
print(p1,vp=vplayout(1,1:2))
print(p2,vp=vplayout(2,1:2))
&/code&&/pre&&/div&
&figure&&img src=&http://pic4.zhimg.com/v2-6cf84c3a733f1bc3ff837_b.png& data-rawwidth=&852& data-rawheight=&406& class=&origin_image zh-lightbox-thumb& width=&852& data-original=&http://pic4.zhimg.com/v2-6cf84c3a733f1bc3ff837_r.png&&&/figure&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&library(gridExtra)
library(&plyr&)
library(&lattice&)
multiplot(p1,p2,layout=matrix(c(1,1,2,2),nrow=2,byrow=TRUE))
&/code&&/pre&&/div&
&figure&&img src=&http://pic3.zhimg.com/v2-171d2caf5cae_b.jpg& data-rawwidth=&1024& data-rawheight=&569& class=&origin_image zh-lightbox-thumb& width=&1024& data-original=&http://pic3.zhimg.com/v2-171d2caf5cae_r.jpg&&&/figure&&h2&联系方式:&/h2&
&p&wechat:ljty1991
&br&&br&Mail: &br&&br&个人公众号:数据小魔方(datamofang) &br&&br&团队公众号:EasyCharts &br&&br&qq交流群:[魔方学院]&/p&
鱼缸式百分比比较信息图
library(tidyverse)
require(grid)
library("Rmisc")
px1&-seq(from=0,to=10,length=1000)
py1&-sqrt(5^2-(px1-5)^2)
Project1x&-c(px1,rev(px1))
Project1y&-c(py1,-py1)
Project1&-data.frame(lon=Project1x,lat=Project1y)
&p&作为互联网营销策划,经常需要查询一些数据来完善方案逻辑,因此整理了一些数据网站,分享给大家。&/p&&p&主要为互联网数据和一些传统数据的查询,主要包括:&/p&&p&1. 互联网部分:移动端数据(微信、微博、APP),网站数据,综合数据,票房和电视收视率,视频指数,内容数据&/p&&p&2. 传统数据部分:经济数据,企业数据,金融数据,汽车数据,建筑数据,医疗数据,服装数据,建筑数据&/p&&p&只涉及数据查询不涉及报告下载,至于下载数据报告网站(看点赞情况再分享吧),用完这些网站,如果还有什么数据查不到,私信我,再分享一些网站给你查(我就说说别当真/调皮)&/p&&p&特地将数据网站整理为书签,点击此链接直接导入书签:&a href=&//link.zhihu.com/?target=https%3A//pan.baidu.com/s/1nvSBeBn& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&https://&/span&&span class=&visible&&pan.baidu.com/s/1nvSBeB&/span&&span class=&invisible&&n&/span&&span class=&ellipsis&&&/span&&i class=&icon-external&&&/i&&/a&&/p&最近看了一下数据(感谢195,2385次收藏/流汗)别光收藏、感谢呀,顺便点个赞呗:越点赞越好运&br&&p&一、移动端数据&/p&&p&l 微信数据(营销老是要分析一些KOL和自媒体)&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//www.newrank.cn/public/info/list.html%3Fperiod%3Dday%26type%3Ddata%23%23%23& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&排名列表_日榜&i class=&icon-external&&&/i&&/a&&/p&&p&2. &a href=&//link.zhihu.com/?target=http%3A//www.gsdata.cn/index.php/rank/detail%3Fgid%3D0& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&新媒体指数&i class=&icon-external&&&/i&&/a&&/p&&p&3. &a href=&//link.zhihu.com/?target=http%3A//wewen.io/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&微问数据_微信公众号分析&i class=&icon-external&&&/i&&/a&&/p&&p&4. &a href=&//link.zhihu.com/?target=http%3A//top.aiweibang.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&微榜 | 爱微帮新媒体榜 Beta&i class=&icon-external&&&/i&&/a&&/p&&p&5. &a href=&//link.zhihu.com/?target=http%3A//kol.simplybrand.com/KOLSec/Page/index.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&simplyKOL微信数据&i class=&icon-external&&&/i&&/a&&/p&&p&6. &a href=&//link.zhihu.com/?target=http%3A//www.weizhishu.com/monitor/account& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&微指数_微信大数据领导者_微信文章_微信营销_微信公众账号大全_微信排行榜&i class=&icon-external&&&/i&&/a&&/p&&p&7. &a href=&//link.zhihu.com/?target=http%3A//wosao.cn/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&微信公众平台导航_微信公众账号大全&i class=&icon-external&&&/i&&/a&&/p&&p&8. &a href=&//link.zhihu.com/?target=http%3A//www.yeezan.com/web/public/search& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&可查90数据-易赞&i class=&icon-external&&&/i&&/a& (部分数据配合数据透视,有更多惊喜)&/p&&p&l 微博数据(宝强过后微博又开始红了一段时间)&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//www.weiboreach.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&知微传播分析-WeiboReach&i class=&icon-external&&&/i&&/a&&/p&&p&2. &a href=&//link.zhihu.com/?target=http%3A//verified.weibo.com/%3Fo%3D1& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&微博认证-名人堂&i class=&icon-external&&&/i&&/a&&/p&&p&3. &a href=&//link.zhihu.com/?target=http%3A//d.weibo.com/%3Ffrom%3Dsignin& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&发现-热门微博&i class=&icon-external&&&/i&&/a&&/p&&p&4. &a href=&//link.zhihu.com/?target=http%3A//www.tfengyun.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&微风云_微博风云榜&i class=&icon-external&&&/i&&/a&&/p&&p&5. &a href=&//link.zhihu.com/?target=http%3A//data.weibo.com/datacenter/recommendapp& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&数据首页-微博数据中心-新浪微博&i class=&icon-external&&&/i&&/a&&/p&&p&l APP数据(帮几家金融机构的APP,做过推广和优化,所以收藏了一些网站)&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//www.asou.com/AsouHot/index& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&热门苹果应用搜索&i class=&icon-external&&&/i&&/a& 只查IOS&/p&&p&2. &a href=&//link.zhihu.com/?target=https%3A//www.appannie.com/apps/ios/top/china/overall/%3Fdevice%3Diphone& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&App Annie App Store Stats | iOS热门 App 排行榜 中国 - 所有类别&i class=&icon-external&&&/i&&/a& 只查IOS&/p&&p&3. &a href=&//link.zhihu.com/?target=http%3A//www.ann9.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&应用雷达-iOS深度移动推广运营服务平台|苹果APP排名搜索优化统计分析&i class=&icon-external&&&/i&&/a& 只查IOS&/p&&p&4. &a href=&//link.zhihu.com/?target=http%3A//www.umindex.com/devices/ios_provinces& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&友盟指数 - 最专业的移动互联网行业发展趋势指数&i class=&icon-external&&&/i&&/a&&/p&&p&5. &a href=&//link.zhihu.com/?target=http%3A//rank.aiyingli.com/index.php/home/index/index.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&首页-应用排名分析平台-爱盈利&i class=&icon-external&&&/i&&/a&&/p&&p&6. &a href=&//link.zhihu.com/?target=http%3A//aso100.com/index.php& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&ASO100 - 中国最专业的 App Store 排名、ASO 数据平台&i class=&icon-external&&&/i&&/a&&/p&&p&7. &a href=&//link.zhihu.com/?target=http%3A//www.appduu.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&App竞品大数据平台_App运营、ASO优化必上APPDUU&i class=&icon-external&&&/i&&/a&&/p&&p&8. &a href=&//link.zhihu.com/?target=http%3A//www.umindex.com/%3Fspm%3D0.0.0.0.RuO8Ft& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&APP宏观数据—友盟指数 - 最专业的移动互联网行业发展趋势指数&i class=&icon-external&&&/i&&/a&&/p&&p&9. &a href=&//link.zhihu.com/?target=http%3A//rank.aiyingli.com/index.php/home/index/index.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&应用排名分析平台-爱盈利&i class=&icon-external&&&/i&&/a&&/p&&p&10. &a href=&//link.zhihu.com/?target=http%3A//qianfan.analysys.cn/view/app/detail.html%3FappIds%3DcategoryIds%3D1191160& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&APP排名查询-易观千帆&i class=&icon-external&&&/i&&/a&(数据比较详细,可惜只能免费查三天)&/p&&p&11. &a href=&//link.zhihu.com/?target=http%3A//jk.coolchuan.com/add%3Fsource%3Djk_index& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&安卓&IOS APP数据-酷传 - 添加应用&i class=&icon-external&&&/i&&/a& 安卓和IOS都可以查&/p&&p&二、网站权重和数据(网站SEO和SEM不太懂,但是有一家很牛的供应商,主要做中间商,整理方案)营销的时候,SEO和舆情更配&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//www.alexa.cn/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Alexa网站排名查询&i class=&icon-external&&&/i&&/a&&/p&&p&2. &a href=&//link.zhihu.com/?target=http%3A//www.chinaz.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&中国站长站&i class=&icon-external&&&/i&&/a&&/p&&p&3. &a href=&//link.zhihu.com/?target=http%3A//www.aizhan.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&站长工具-百度权重排名查询-站长seo查询 - 爱站网&i class=&icon-external&&&/i&&/a&&/p&&p&4. &a href=&//link.zhihu.com/?target=http%3A//www.iwebchoice.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&网站排名_网站数据流量查询_中国网站排名_网络媒体精品推荐&i class=&icon-external&&&/i&&/a&&/p&&p&5. &a href=&//link.zhihu.com/?target=http%3A//check.links.cn/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&友情链接—友情链接查询|友情链接检查工具-站长帮手网&i class=&icon-external&&&/i&&/a&&/p&&p&6. &a href=&//link.zhihu.com/?target=http%3A//pr.links.cn/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&PR真假—PR查询|PR真假查询|PR劫持检测-站长帮手网&i class=&icon-external&&&/i&&/a&&/p&&p&7. &a href=&//link.zhihu.com/?target=http%3A//www.go9go.cn/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&友情链接交换—go9go友情链接平台--想链就链go9go&i class=&icon-external&&&/i&&/a&&/p&&p&8. &a href=&//link.zhihu.com/?target=http%3A//top.chinaz.com/hangye/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&行业网站排名_行业网站排行榜_行业网站大全 - 网站排行榜&i class=&icon-external&&&/i&&/a&&/p&&p&三、综合指数(写传播结案和分析客户传播节奏的时候用)&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//index.baidu.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&百度指数&i class=&icon-external&&&/i&&/a&&/p&&p&2. &a href=&//link.zhihu.com/?target=http%3A//zhishu.sogou.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&搜狗指数&i class=&icon-external&&&/i&&/a&&/p&&p&3. &a href=&//link.zhihu.com/?target=http%3A//www.google.cn/trends/%3Fhl%3Dzh-CN& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Google 趋势&i class=&icon-external&&&/i&&/a&&/p&&p&4. &a href=&//link.zhihu.com/?target=http%3A//index.haosou.com/%23index& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&好搜指数-搜索大数据分享平台&i class=&icon-external&&&/i&&/a&&/p&&p&5. &a href=&//link.zhihu.com/?target=http%3A//data.weibo.com/index%3Fsudaref%3Dwww.digitaling.com& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&微指数首页&i class=&icon-external&&&/i&&/a&&/p&&p&6. &a href=&//link.zhihu.com/?target=http%3A//top.baidu.com/category%3Fc%3D12%26fr%3Dtopbuzz_b396_c12& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&热搜榜单首页--百度搜索风云榜&i class=&icon-external&&&/i&&/a&&/p&&p&7. &a href=&//link.zhihu.com/?target=http%3A//www.imzs.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&艾曼指数首页&i class=&icon-external&&&/i&&/a&&/p&&p&8. &a href=&//link.zhihu.com/?target=http%3A//shu.taobao.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&淘宝指数 - 淘宝消费者数据研究平台&i class=&icon-external&&&/i&&/a&(已经没有了,以前很好用)&/p&&p&9. &a href=&//link.zhihu.com/?target=https%3A//alizs.taobao.com/%3Fspm%3D0.0.0.0.yhqwuK& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&阿里指数 - 社会化大数据分析平台&i class=&icon-external&&&/i&&/a&(必须要开过淘宝店的账号,更可气的是只能查询单一行业)&/p&&p&10. &a href=&//link.zhihu.com/?target=http%3A//index.1688.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&阿里指数_最权威专业的行业价格、供应、采购趋势分析&i class=&icon-external&&&/i&&/a&(这个就能完美解决上面的问题)&/p&&p&四、票房和电视收视率(额……为什么有这些网站,才不会告诉别人,是因为我喜欢看电影)&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//www.cbooo.cn/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&中国票房&i class=&icon-external&&&/i&&/a&&/p&&p&2. &a href=&//link.zhihu.com/?target=http%3A//www.csm.com.cn/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&电视收视率—CSM&i class=&icon-external&&&/i&&/a&&/p&&p&3. &a href=&//link.zhihu.com/?target=http%3A//piaofang.maoyan.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&猫眼票房分析&i class=&icon-external&&&/i&&/a&&/p&&p&4. &a href=&//link.zhihu.com/?target=http%3A//www.yugaopian.com/highlight& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&精选预告片 - 预告片世界&i class=&icon-external&&&/i&&/a&&/p&&p&五、视频指数(近期想切入视频IP市场的推广,也就是想想)&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//www.soku.com/newtop/all.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&搜库-专找视频&i class=&icon-external&&&/i&&/a&&/p&&p&2. &a href=&//link.zhihu.com/?target=http%3A//v.qq.com/datacenter/index.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&腾讯视频指数&i class=&icon-external&&&/i&&/a&&/p&&p&3. &a href=&//link.zhihu.com/?target=http%3A//index.youku.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&中国网络视频指数 – 网络视频收视数据分析平台&i class=&icon-external&&&/i&&/a&&/p&&p&4. &a href=&//link.zhihu.com/?target=http%3A//index.youku.com/rank_top/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&优酷指数 - 中国第一视频网,提供视频播放,视频发布,视频搜索&i class=&icon-external&&&/i&&/a&&/p&&p&5. &a href=&//link.zhihu.com/?target=http%3A//index.tv.sohu.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&搜狐视频指数中心 - 搜狐视频&i class=&icon-external&&&/i&&/a&&/p&&p&6. &a href=&//link.zhihu.com/?target=http%3A//index.iqiyi.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&爱奇艺指数&i class=&icon-external&&&/i&&/a&&/p&&p&六、内容排行(这个网站偶尔看一下热点吧,用的比较少)&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//comment.news.sohu.com/djpm/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&网评排行-搜狐&i class=&icon-external&&&/i&&/a&&/p&&p&一、经济数据&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//www.pbc.gov.cn/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&人民银行&i class=&icon-external&&&/i&&/a&&/p&&p&2. &a href=&//link.zhihu.com/?target=http%3A//data.stats.gov.cn/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&国家数据&i class=&icon-external&&&/i&&/a&&/p&&p&3. &a href=&//link.zhihu.com/?target=http%3A//www.cbrc.gov.cn/index.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&中国银行业监督管理委员会&i class=&icon-external&&&/i&&/a&&/p&&p&4. &a href=&//link.zhihu.com/?target=http%3A//www.tjcn.org/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&中国统计信息网&i class=&icon-external&&&/i&&/a&&/p&&p&5. &a href=&//link.zhihu.com/?target=http%3A//www.stats.gov.cn/tjsj/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&统计数据&i class=&icon-external&&&/i&&/a&&/p&&p&6. &a href=&//link.zhihu.com/?target=http%3A//www.stats.gov.cn/tjsj/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&中华人民共和国国家统计局 统计数据&i class=&icon-external&&&/i&&/a&&/p&&p&7. &a href=&//link.zhihu.com/?target=http%3A//www.sac.net.cn/hysj/zxtjsj/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&专项统计数据-中国证券业协会&i class=&icon-external&&&/i&&/a&&/p&&p&8. &a href=&//link.zhihu.com/?target=http%3A//data.eastmoney.com/cjsj/cpi.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&居民消费价格指数(CPI) _ 数据中心 _ 东方财富网&i class=&icon-external&&&/i&&/a&&/p&&p&二、企业数据(有时候接到一些Brief,大部分客户不靠谱,可能会问候一下他企业背景)&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//gsxt.saic.gov.cn/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&全国企业信用信息公示系统&i class=&icon-external&&&/i&&/a& (官方出品)&/p&&p&2. &a href=&//link.zhihu.com/?target=http%3A//www.tianyancha.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&企业信息—天眼查-最专业的企业工商信息查询&i class=&icon-external&&&/i&&/a&(这个比官方的好用)&/p&&p&3. &a href=&//link.zhihu.com/?target=http%3A//china.b2b.cn/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&企业名录-企业黄页_必途网企业黄页大全&i class=&icon-external&&&/i&&/a&&/p&&p&4. &a href=&//link.zhihu.com/?target=http%3A//www.x315.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&企业信用查询_企业信用报告查询系统_注册信息查询网-信用视界&i class=&icon-external&&&/i&&/a&&/p&&p&三、金融数据&/p&&p&l 网贷数据(去年P2P,不,是互联网金融很火的)&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//www.wd315.cn/p/list-0-0-%25E9%E6%25B1%%E8%259E%258D-0-1.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&金汇金融__平台指数_P2P网贷平台评级_网贷315&i class=&icon-external&&&/i&&/a&&/p&&p&2. &a href=&//link.zhihu.com/?target=http%3A//shuju.wangdaizhijia.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&【p2p网贷平台排名】最新网贷平台排名_网络借贷平台排名_网络贷款平台排名-网贷之家&i class=&icon-external&&&/i&&/a&&/p&&p&3. &a href=&//link.zhihu.com/?target=http%3A//data.01caijing.com/p2p/report/index.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&平台报告-零壹数据&i class=&icon-external&&&/i&&/a&&/p&&p&4. &a href=&//link.zhihu.com/?target=http%3A//shanghai.rong360.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&上海贷款_小额贷款_贷款公司_银行贷款 - 融360&i class=&icon-external&&&/i&&/a&&/p&&p&5. &a href=&//link.zhihu.com/?target=http%3A//www.wd315.cn/p/index.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&平台指数_P2P网贷平台评级_网贷315&i class=&icon-external&&&/i&&/a&&/p&&p&6. &a href=&//link.zhihu.com/?target=http%3A//hlwjr.n.puji114.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&新金网 - 最专业的互联网金融导航网站&i class=&icon-external&&&/i&&/a&&/p&&p&7. &a href=&//link.zhihu.com/?target=http%3A//www.p2peye.com/platdata.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&P2P网贷平台数据排行对比_网贷平台数据_网贷天眼&i class=&icon-external&&&/i&&/a&&/p&&p&8. &a href=&//link.zhihu.com/?target=http%3A//www.76676.com/html/product/listhome/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&p2p排行榜,网络理财排行榜,第三方p2p平台排行榜 - 76676-最大的投资理财产品点评平台&i class=&icon-external&&&/i&&/a&&/p&&p&l 上市公司年报(竟然为了分析社媒趋势去看BAT的年报,表示看不懂呀)&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//www.cninfo.com.cn/cninfo-new/index& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&中国—巨潮资讯网&i class=&icon-external&&&/i&&/a&&/p&&p&2. &a href=&//link.zhihu.com/?target=http%3A//www.sec.gov/edgar/searchedgar/companysearch.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&美国—SEC.gov | Company Search Page&i class=&icon-external&&&/i&&/a&&/p&&p&3. &a href=&//link.zhihu.com/?target=http%3A//www.hkexnews.hk/listedco/listconews/advancedsearch/search_active_main_c.aspx& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&香港—:: HKEx :: HKExnews ::&i class=&icon-external&&&/i&&/a&&/p&&p&l 信托(信托切入互联网金融相对较慢,今年刚开始接触的几个客户)&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//www.xtxh.net/xtxh/reports/index.htm& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&研究报告 - 中国信托业协会&i class=&icon-external&&&/i&&/a&&/p&&p&2. &a href=&//link.zhihu.com/?target=http%3A//www.100ec.cn/zt/jr/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&中国互联网金融研究中心 中国互联网金融网 中国互联网金融联盟 中国电子商务研究中心&i class=&icon-external&&&/i&&/a&&/p&&p&l 其他&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//www.investide.cn/db/case/index.do& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&案例报告列表_融资案例_并购案例_行业案例_企业案例_数据_分析—投资潮&i class=&icon-external&&&/i&&/a&&/p&&p&2. &a href=&//link.zhihu.com/?target=https%3A//www.itjuzi.com/investevents& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&融资数据—融资事件列表页 | IT桔子&i class=&icon-external&&&/i&&/a&&/p&&p&3. &a href=&//link.zhihu.com/?target=http%3A//www.chinaventure.com.cn/cmsmodel/report/study/count/list.shtml& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&研究院_ChinaVenture投资中国网&i class=&icon-external&&&/i&&/a&&/p&&p&4. &a href=&//link.zhihu.com/?target=http%3A//caifu.baidu.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&百度财富-专业金融服务平台&i class=&icon-external&&&/i&&/a&&/p&&p&5. &a href=&//link.zhihu.com/?target=http%3A//data.worldbank.org/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&世界银行-Data | The World Bank&i class=&icon-external&&&/i&&/a&&/p&&p&6. &a href=&//link.zhihu.com/?target=http%3A//stockq.cn/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&全球股市指数&i class=&icon-external&&&/i&&/a&&/p&&p&7. &a href=&//link.zhihu.com/?target=http%3A//www.cffex.com.cn/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&股指期货数据&i class=&icon-external&&&/i&&/a&&/p&&p&四、汽车数据(有一个汽车配件的客户,讲真,汽车客户真的比金融客户前期好搞,不过后期服务就呵呵了)&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//www.caam.org.cn/data/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&数据中心 世界汽车统计 中国汽车工业协会&i class=&icon-external&&&/i&&/a&&/p&&p&五、建筑数据(我也不知道为什么有这个网站)&/p&&p&&a href=&//link.zhihu.com/?target=http%3A//mohurd.gov.cn/wbdt/dwzzcx/index.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&中华人民共和国住房和城乡建设部 - 单位资质查询&i class=&icon-external&&&/i&&/a&&/p&&p&六、医疗数据&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//www.who.int/entity/zh/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&世界卫生组织 | 规划和项目&i class=&icon-external&&&/i&&/a&&/p&&p&七、服装数据(才不会告诉你,我是学国际经济与贸易出身的,后来才做了互联网营销策划,其中有一万只羊驼在奔跑)&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//www.chinaleather.org/Channels/ZhiShuFaBu/1735/default.shtml& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&中国皮革原材料指数&i class=&icon-external&&&/i&&/a&&/p&&p&2. &a href=&//link.zhihu.com/?target=http%3A//www.chinaleather.org/Expand/Share/Page/NSCMoreList.aspx%3FNSCID%3D3925& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&海宁周价格指数&i class=&icon-external&&&/i&&/a&&/p&&p&3. &a href=&//link.zhihu.com/?target=http%3A//www.kqindex.gov.cn/zsfx.asp& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&中国柯桥纺织指数&i class=&icon-external&&&/i&&/a&&/p&&p&4. &a href=&//link.zhihu.com/?target=http%3A//index.dalang.gov.cn/home/index/index.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&大朗毛织价格指数&i class=&icon-external&&&/i&&/a&&/p&&p&八、工业指数&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//youjia.chemcp.com/YuanYouJiaGe.asp& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&今日国际原油价格,原油价格走势图,原油价格指数-油价网&i class=&icon-external&&&/i&&/a&&/p&&p&2. &a href=&//link.zhihu.com/?target=http%3A//www.ishupai.com/d/56& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&上海有色金属价格指数&i class=&icon-external&&&/i&&/a&&/p&&p&3. &a href=&//link.zhihu.com/?target=http%3A//index.ccement.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&水泥指数&i class=&icon-external&&&/i&&/a&&/p&&br&&p&其他数据&/p&&p&1. &a href=&//link.zhihu.com/?target=http%3A//www.researchina.cn/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&中国统计信息服务中心 口碑查询&i class=&icon-external&&&/i&&/a&&/p&&p&2. &a href=&//link.zhihu.com/?target=http%3A//cn.bing.com/yxl& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&最具公信力的名人影响力指标 - 必应 影响力&i class=&icon-external&&&/i&&/a&&/p&&p&3. &a href=&//link.zhihu.com/?target=http%3A//top.baidu.com/boards%3Ffr%3Dtopbuzz_b1192& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&全部榜单--百度搜索风云榜&i class=&icon-external&&&/i&&/a&&/p&&p&4. &a href=&//link.zhihu.com/?target=http%3A//trends.baidu.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&百度预测-大数据 知天下&i class=&icon-external&&&/i&&/a&&/p&&p&l &a href=&//link.zhihu.com/?target=http%3A//www.datataotao.com/search/list%3FpriceType%3D1%26count%3D10%26page%3D1& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&原始数据-数据淘&i class=&icon-external&&&/i&&/a&(这个网站听说可以买到原始数据,不过没有试过)&/p&&p&这些网站还不错,数据也算可以,其他的数据网站没有分享了。这只是网站,具体用法太多了,就没有分享单个教程。强调:网站用的好,真的能用出花来,比如百度指数+百度新闻=客户和竞品的传播节奏。具体网站的功能多试试,不要执着于网站,要多变通思路,希望能找到想要的数据(说服力)。&/p&
作为互联网营销策划,经常需要查询一些数据来完善方案逻辑,因此整理了一些数据网站,分享给大家。主要为互联网数据和一些传统数据的查询,主要包括:1. 互联网部分:移动端数据(微信、微博、APP),网站数据,综合数据,票房和电视收视率,视频指数,内容…
&figure&&img src=&https://pic1.zhimg.com/v2-b891c95dab091_b.jpg& data-rawwidth=&1280& data-rawheight=&960& class=&origin_image zh-lightbox-thumb& width=&1280& data-original=&https://pic1.zhimg.com/v2-b891c95dab091_r.jpg&&&/figure&&h3&作者 Takashi J. OZAKI, Ph. D. Date Science&/h3&&h3&译者 钱亦欣&/h3&&h3&有段时间(至少在人们大范围使用python或者theano,pylearn2或者其他框架来做深度学习后的几个月)我几乎要放弃使用R做深度学习了,这让我感到我已经被前沿科技抛弃。&/h3&&h3&但现在我们(我不是一个人在战斗!)已经拥有了一份杰作:h2o包,一个让你在R中使用h2o框架的工具。我坚信h2o是在R中应用深度学习技术来分析我们数据集的最佳选择。我们几乎不需要写任何额外的脚本,只需要设定相应的参数。使用h2o包我们不需要编写复杂的代码,这使得我们可以集中于数据与模型背后的逻辑。&/h3&&h3&在R中调用h2o后,理论上我们可以使用深度学习的原始版本-“Deep Belief Net”&a href=&https://link.zhihu.com/?target=http%3A//tjo-en.hatenablog.com/entry//f-3a114ed0& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&1&/a&。我知道这不是现在的深度学习领域的&a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/art%2520style& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&前沿技术&/a&,但它对于你理解深度学习如何在数据集上发挥作用会很有帮助。你应该还记得我之前的一篇博文讲解了各种分类器的决策边界可以一定程度上反应它们的过拟合情况和泛化能力把。当我们使用利用一个固定的二元正态分布生成的4个数据集来做测试后,通过决策边界判断分类器的过拟合情况和泛化能力就轻而易举了。我个人的观点是:1)如果决策边界看起来很光滑,模型的泛化能力就比较强。2)如果边界看起来很复杂,它们就很可能过拟合了。因为这个数据集的样本又二元正态分布生成,可以很容易地用两条互相垂直的线分成4部分。&/h3&&h3&好了,让我们利用h2o重复一次这个实验来看看深度学习的表现把。&/h3&&h2&数据集&/h2&&h3&你可以从我的&a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/GitHub& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&github&/a&下载数据集: &a href=&https://link.zhihu.com/?target=https%3A//github.com/ozt-ca/tjo.hatenablog.samples/blob/master/r_samples/public_lib/jp/xor_simple.txt& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&simple XOR pattern&/a&, &a href=&https://link.zhihu.com/?target=https%3A//github.com/ozt-ca/tjo.hatenablog.samples/blob/master/r_samples/public_lib/jp/xor_complex.txt& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&complex XOR pattern&/a&, and &a href=&https://link.zhihu.com/?target=https%3A//github.com/ozt-ca/tjo.hatenablog.samples/blob/master/r_samples/public_lib/jp/pgrid.txt& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&a grid dataset&/a&.&/h3&&h3&当然你可以随意clone它们,但是pull请求是不被允许的,毕竟这不是用来做软件开发的。&/h3&&h2&在R中调用h2o&/h2&&h3&首先,h2o本身需要&a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/Java%2520Virtual%2520Machine& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&JVM&/a&环境支持,在装h2o之前,请把最新版本的&a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/Java& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Java&/a& SE &a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/SDK& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&SDK&/a&&a href=&https://link.zhihu.com/?target=http%3A//tjo-en.hatenablog.com/entry//f-8c879d79& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&*2&/a&装好。&/h3&&h3&之后,install.packages(&h2o&)就可以了&/h3&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&& install.packages(&h2o&, repos=(c(&http://s3.amazonaws.com/h2o-release/h2o/master/1542/R&, getOption(&repos&))))
& library(&h2o&, lib.loc=&C:/Program Files/R/R-3.0.2/library&)
要求されたパッケージ RCurl をロード中です
要求されたパッケージ bitops をロード中です
要求されたパッケージ rjson をロード中です
要求されたパッケージ statmod をロード中です
要求されたパッケージ survival をロード中です
要求されたパッケージ splines をロード中です
要求されたパッケージ tools をロード中です
----------------------------------------------------------------------
Your next step is to start H2O and get a connection object (named
'localH2O', for example):
& localH2O = h2o.init()
For H2O package documentation, ask for help:
After starting H2O, you can use the Web UI at http://localhost:54321
For more information visit http://docs.0xdata.com
----------------------------------------------------------------------
次のパッケージを付け加えます: ‘h2o’
以下のオブジェクトはマスクされています (from ‘package:base’) :
ifelse, max, min, strsplit, sum, tolower, toupper
&/code&&/pre&&/div&&h3&请忽视代码中的日文,现在h2o可以在R中被调用了。&/h3&&h2&R中h2o的工作原理&/h2&&h3&h2o包一旦被加载,你首先要在&a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/Java& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Java&/a& &a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/VM& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&VM&/a&中启动一个h2o实例。在下方的例子中,“nthreads”参数被设置为-1,代表所有的CPU内核都会被这个实例使用。如果你想节约内核,可以把它设为其他数值。&/h3&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&& localH2O &- h2o.init(ip = &localhost&, port = 54321, startH2O = TRUE, nthreads=-1)
H2O is not running yet, starting it now...
In case of errors look at the following log files:
C:\Users\XXX\AppData\Local\Temp\RtmpghjvGo/h2o_XXX_win_started_from_r.out
C:\Users\XXX\AppData\Local\Temp\RtmpghjvGo/h2o_XXX_win_started_from_r.err
java version &1.7.0_67&
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
Successfully connected to http://localhost:54321
R is connected to H2O cluster:
H2O cluster uptime:
1 seconds 506 milliseconds
H2O cluster version:
2.7.0.1542
H2O cluster name:
H2O_started_from_R
H2O cluster total nodes:
H2O cluster total memory:
H2O cluster total cores:
H2O cluster allowed cores:
H2O cluster healthy:
&/code&&/pre&&/div&&h3&现在你可以尽情调用h2o中的所有函数了,之后把XOR和grid数据集加载上。&/h3&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&& cfData &- h2o.importFile(localH2O, path = &xor_simple.txt&)
& pgData&-h2o.importFile(localH2O,path=&pgrid.txt&)
&/code&&/pre&&/div&&p&We're ready to draw various decision boundaries using {h2o} package, in particular with Deep Learning. Let's go to the next step.&/p&&h3&我们已经可以用h2o包来绘制深度学习的决策边界了,但在跑深度学习之前,看看之前的结果&/h3&&h3&为了把深度学习的结果和其他分类器比较,请看看之前的结果。下方的图片中,我在相同的参数设定下尝试了决策树,&a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/SVM& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&SVM&/a&, 单隐层神经网络和随机森林。&/h3&&h3&&em&线性可分的简单XOR数据集&figure&&img src=&https://pic4.zhimg.com/v2-0a35d25df420f7bcf1e1e6cf4ec83b01_b.jpg& data-rawwidth=&800& data-rawheight=&737& class=&origin_image zh-lightbox-thumb& width=&800& data-original=&https://pic4.zhimg.com/v2-0a35d25df420f7bcf1e1e6cf4ec83b01_r.jpg&&&/figure&&/em&&/h3&&h3&如图,所有分类器的决策边界都清晰反应了真实分布。&/h3&&h3&&em&线性可分的复杂XOR数据集&figure&&img src=&https://pic3.zhimg.com/v2-213dcc6d152fe0031571dde7dedcead9_b.jpg& data-rawwidth=&595& data-rawheight=&800& class=&origin_image zh-lightbox-thumb& width=&595& data-original=&https://pic3.zhimg.com/v2-213dcc6d152fe0031571dde7dedcead9_r.jpg&&&/figure&&/em&&/h3&&h3&和上图不同,这种情况下的决策边界各不相同。决策树、神经网络和随机森林的决策边界比真实边界复杂得多。&a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/SVM& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&SVM&/a&在适宜的参数设定下,边界比较平滑,泛化能力比较强。&/h3&&h3&绘制h2o的决策边界&/h3&&h3&OK,让我们来试试h2o中的函数来绘制深度学习的决策边界。&/h3&&h3&我们的初心是什么样的参数决定了什么样的决策边界形状。在h2o.deeplearning函数中,我们可以调节的参数如下:&/h3&&ul&&li&&p&activation: &a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/Tanh& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Tanh&/a&, Rectifier and Maxout.我们可以添加“WIthDropout”来执行dropout过程&/p&&/li&&li&&p&hidden: 隐藏层的设定, by &a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/vector& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&vector&/a&. c(3,2) 意味着第一层有3个隐藏元,第二层有两个. rep(3,3) 就是3层有3个隐藏元的结构.&/p&&/li&&li&&p&epochs: 迭代次数. 当然迭代次数越多,结果也相对越好。&/p&&/li&&li&&p&autoencoder: autoencoder是否被使用的逻辑值。这里我们不适用因为样本量太少。&/p&&/li&&li&&p&hidden_dropout_ratio: 隐藏层的dropout ratio, &a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/vector& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&vector&/a&. 即使你想使用dropout,我们也建议把这个数值设定为0.5( 参照&a href=&https://link.zhihu.com/?target=http%3A//papers.nips.cc/paper/4878-understanding-dropout& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Baldi (NIPS, 2013)&/a&).&/p&&/li&&/ul&&h3&为了简便,我在本文仅调节 &activation& 和 &hidden& 两个参数。对于&hidden&参数,隐藏层被固定为2或3层,隐藏元被固定为5或10。我们可以用下列代码跑模型了。&/h3&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&& res.dl&-h2o.deeplearning(x=1:2,y=3,data=xorsData,classification=T,activation=&Tanh&,hidden=c(10,10),epochs=10)
& prd.dl&-h2o.predict(res.dl,newdata=pgData)
& prd.dl.df&-as.data.frame(prd.dl)
& xors &- read.table(&xor_simple.txt&, header=T)
& plot(xors[,-3],pch=19,col=c(rep('blue',50),rep('red',50)),cex=3,xlim=c(-4,4),ylim=c(-4,4), main=&Tanh, (10,10)&)
& par(new=T)
& contour(px,py,array(prd.dl.df[,1],dim=c(length(px),length(py))),xlim=c(-4,4),ylim=c(-4,4),col=&purple&,lwd=3,drawlabels=F)
&/code&&/pre&&/div&&h3&上述脚本只是个例子,请针对你的情况调整或重构。&/h3&&h3&&em&简单 XOR 数据集 - 双隐层&/em&&/h3&&a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/Tanh& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Tanh&/a&&figure&&img src=&https://pic1.zhimg.com/v2-fda05e195_b.jpg& data-rawwidth=&758& data-rawheight=&702& class=&origin_image zh-lightbox-thumb& width=&758& data-original=&https://pic1.zhimg.com/v2-fda05e195_r.jpg&&&/figure&&p&Rectifier&figure&&img src=&https://pic3.zhimg.com/v2-2f59accfa3c97bccf55046_b.jpg& data-rawwidth=&758& data-rawheight=&702& class=&origin_image zh-lightbox-thumb& width=&758& data-original=&https://pic3.zhimg.com/v2-2f59accfa3c97bccf55046_r.jpg&&&/figure&&/p&&p&Maxout&figure&&img src=&https://pic1.zhimg.com/v2-eff7dffa1e56a_b.jpg& data-rawwidth=&758& data-rawheight=&702& class=&origin_image zh-lightbox-thumb& width=&758& data-original=&https://pic1.zhimg.com/v2-eff7dffa1e56a_r.jpg&&&/figure&&/p&&h3&Maxout无法估计出正确的决策边界,很可能是数据量太少(100个样本)或者位数太低(只有2维)造成的。另一方面,&a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/Tanh& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Tanh&/a& 和 Rectifier的边界看起来都很不错。&/h3&&h3&&em&复杂 XOR 数据-双隐层&/em&&/h3&&a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/Tanh& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Tanh&/a&&figure&&img src=&https://pic2.zhimg.com/v2-57e76daeba0a7cd616b20ef_b.jpg& data-rawwidth=&758& data-rawheight=&702& class=&origin_image zh-lightbox-thumb& width=&758& data-original=&https://pic2.zhimg.com/v2-57e76daeba0a7cd616b20ef_r.jpg&&&/figure&&p&Rectifier&figure&&img src=&https://pic3.zhimg.com/v2-e50b9eb9a021c8d700e632_b.jpg& data-rawwidth=&758& data-rawheight=&702& class=&origin_image zh-lightbox-thumb& width=&758& data-original=&https://pic3.zhimg.com/v2-e50b9eb9a021c8d700e632_r.jpg&&&/figure&&/p&&p&与简单XOR数据集结果不同,Rectifier 比Tanh效果好,并且它的决策边界和SVM很接近(泛化能力很好)。Tanh看起来过拟合了。&/p&&h3&与简单XOR数据集结果不同,Rectifier 比Tanh效果好,并且它的决策边界和SVM很接近(泛化能力很好)。Tanh看起来过拟合了。&/h3&&h3&&em&简单 XOR 数据集-3隐层&/em&&/h3&&h3&我假设隐藏层数量会影响边界形状,所以我做了这个实验,让我们来看看结果&/h3&&a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/Tanh& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Tanh&/a&&figure&&img src=&https://pic1.zhimg.com/v2-3677deefd313c0f40b950_b.jpg& data-rawwidth=&758& data-rawheight=&702& class=&origin_image zh-lightbox-thumb& width=&758& data-original=&https://pic1.zhimg.com/v2-3677deefd313c0f40b950_r.jpg&&&/figure&&figure&&img src=&https://pic3.zhimg.com/v2-7edb32fb2bd_b.jpg& data-rawwidth=&758& data-rawheight=&702& class=&origin_image zh-lightbox-thumb& width=&758& data-original=&https://pic3.zhimg.com/v2-7edb32fb2bd_r.jpg&&&/figure&Rectifier&p&比起双隐层模型,两个决策边界看起来过拟合都更严重了,不过分类效果提升了。&br&&/p&&h3&&em&复杂 XOR 数据集-3隐层&/em&&/h3&&a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/Tanh& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Tanh&/a&&figure&&img src=&https://pic4.zhimg.com/v2-ebe3cebbea_b.jpg& data-rawwidth=&758& data-rawheight=&702& class=&origin_image zh-lightbox-thumb& width=&758& data-original=&https://pic4.zhimg.com/v2-ebe3cebbea_r.jpg&&&/figure&&p&Recitifier&br&&figure&&img src=&https://pic3.zhimg.com/v2-2bd4bced5f54f_b.jpg& data-rawwidth=&758& data-rawheight=&702& class=&origin_image zh-lightbox-thumb& width=&758& data-original=&https://pic3.zhimg.com/v2-2bd4bced5f54f_r.jpg&&&/figure&&/p&&h3&我感觉这是个玩笑。&a href=&https://link.zhihu.com/?target=http%3A//d.hatena.ne.jp/keyword/Tanh& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Tanh&/a&看起来几乎不工作了。Rectifier分类效果不错但尽管边界看起来没有明显过拟合,但泛化能力还是下降了。&/h3&&h2&结论&/h2&&h3&通过这系列实验,我学到的最重要的一点是深度学习的模型表现和参数相关性很大,包括选择合适的激活函数,隐藏层数量和隐藏元个数。&/h3&&h3&这个特性应被视作传统神经网络(但隐层)的一个重要特性。从本文结果来看,这个特性也被深度学习继承了,尽管比较前面的隐藏层只是数据预处理器或者特征生成器,而不是真正的分类器。&/h3&&h3&我的结论很简单:在深度学习中要更小心地调参。适宜的参数设定可以显著的提升模型结果,但同时也可能宠坏你的分类器。&/h3&&h2&参考文献&/h2&&p&&a href=&https://link.zhihu.com/?target=http%3A//tjo-en.hatenablog.com/entry//fn-3a114ed0& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&*1&/a&:Of course here I think the latest topic of Deep Learning is &ConvNet& or convolutional neural network with convolution and max pooling&/p&&p&&a href=&https://link.zhihu.com/?target=http%3A//tjo-en.hatenablog.com/entry//fn-8c879d79& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&*2&/a&:I believe almost all of readers of this blog already installed it...&/p&&h3&原文链接
[&a href=&https://link.zhihu.com/?target=http%3A//tjo-en.hatenablog.com/entry//194003& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&What kind of decision boundaries does Deep Learning (Deep Belief Net) draw? Practice with R and {h2o} package - Data Scientist TJO in Tokyo&/a&]&/h3&
作者 Takashi J. OZAKI, Ph. D. Date Science译者 钱亦欣有段时间(至少在人们大范围使用python或者theano,pylearn2或者其他框架来做深度学习后的几个月)我几乎要放弃使用R做深度学习了,这让我感到我已经被前沿科技抛弃。但现在我们(我不是一个人在战斗…
&figure&&img src=&https://pic4.zhimg.com/v2-c39aa2f1fccef_b.jpg& data-rawwidth=&386& data-rawheight=&400& class=&content_image& width=&386&&&/figure&&p&今天是一个图表高仿,对象是一财经典的半圆型线条比较图,信息主要是针对2016年天猫全球购物狂欢节的当日总销售额,为了使得比较效果更有针对性,作者使用了几个中小型体量的国家GDP总量来对比,总体来看比较生动形象,引人眼球。&br&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-769399ababb95da45093_b.jpg& data-rawwidth=&282& data-rawheight=&398& class=&content_image& width=&282&&&/figure&&p&但是该图制作比较复杂,之前看到过大神们用Excel来构造半圆的路径数据进行仿制,这里小编使用R来构造曲线数据,大体思路差不多,都是构造曲线的路径数据,链接各点形成整体上的半圆线条,但是R在处理这些数据过程中,具有先天优势,效率相对较高。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&library(&xlsx&)
library(&ggplot2&)
library(stringr)
library(showtext)
library(Cairo)
setwd(&F:/微信公众号/公众号——数据小魔方/2017年3月/&)
mydata&-read.xlsx(&barpoint.xlsx&,sheetName=&Sheet1&,header=T,encoding='UTF-8',stringsAsFactors=FALSE)
m&-max(nchar(mydata$Name))
mydata$Name&-str_pad(mydata$Name,44,side=&right&,pad=& &)
&/code&&/pre&&/div&&p&生成10个半圆线条的路径点(水平轴X上的点,使用seq可以生成任意区间的等间隔点)数据并按顺序合并。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&sdd&-c()
for(m in 1:nrow(mydata)){
x&-seq(from=0,to=mydata$Scale[m],length=1000)
sdd&-c(sdd,x)
&/code&&/pre&&/div&&p&生成对应的ID、半径和对应半圆的垂直轴的Y坐标点。&/p&&p&这是圆形曲线的方程式,高中学过的哦表忘了(我昨晚是问了我的室友才才确定是这么写的~_~)&br&&/p&&p&曲线方程式:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&x^2+Y^2=R^2
Y=sqrt((R/2)^2-(X-R/2)^2)
id&-rep(LETTERS[1:10],rep(1000,10))
rdd&-rep(mydata$Scale,rep(1000,10))
y&-sqrt((rdd/2)^2-(sdd-rdd/2)^2)
&/code&&/pre&&/div&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&mynewdata&-data.frame(id,sdd,y)
&/code&&/pre&&/div&&p&这里为了更加方便的,使用自动输出方式:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&font.add(&myfont&,&msyhl.ttc&)
CairoPNG(file=&C:/Users/Administrator/Desktop/barpoint.png&,width=1000,height=1050)
showtext.begin()
geom_path(data=mynewdata[mynewdata$id!=&F&,],aes(x=sdd,y=y,group=id),color=&white&)+
geom_path(data=mynewdata[mynewdata$id==&F&,],aes(x=sdd,y=y,group=id),color=&#D56A55&)+
geom_segment(data=NULL,aes(x=0,y=0,xend=1690,yend=0),color=&white&,size=1)+
geom_point(data=mydata,aes(x=Scale,y=0),color=&White&,size=3)+
geom_text(data=NULL,aes(x=mydata$Scale[c(-4,-6,-8)],y=-30,label=mydata$Scale[c(-4,-6,-8)]),size=4,col=&white&,family=&myfont&)+
geom_text(data=NULL,aes(x=mydata$Scale[c(4,6,8)],y=-60,label=mydata$Scale[c(4,6,8)]),size=4,col=&white&,family=&myfont&)+
ylim(-70,900)+
scale_x_continuous(breaks=mydata$Scale,labels=mydata$Name)+
labs(title=&1207亿元意味着什么?&,subtitle=&意味着什么,什么,什么,什么???&,caption=&注:图中数据已根据中国银行日发布的中间汇率美元兑换人民币汇率\n为1:6.7885进行换算&,x=&&,y=&&)+
panel.background=element_rect(fill=&black&),
plot.background=element_rect(fill=&black&),
axis.text.x=element_text(angle=-90,colour=&white&,hjust=0,size=12),
axis.text.y=element_blank(),
panel.grid=element_blank(),
axis.ticks=element_blank(),
plot.margin=unit(c(1,.5,1.6,.5),&lines&),
panel.spacing=unit(c(0,0,0,0),&lines&),
text=element_text(family=&myfont&),
plot.title=element_text(size=50,colour=&white&,lineheight=1.2),
plot.subtitle=element_text(size=35,colour=&white&,lineheight=1.2),
plot.caption=element_text(size=25,hjust=0,colour=&white&),
panel.border=element_blank()
showtext.end()
&/code&&/pre&&/div&&figure&&img src=&https://pic4.zhimg.com/v2-c39aa2f1fccef_b.jpg& data-rawwidth=&386& data-rawheight=&400& class=&content_image& width=&386&&&/figure&&br&&p&---------------------&/p&&blockquote&&p&作者:EasyCharts&/p&&p&博客专栏:&a href=&https://link.zhihu.com/?target=https%3A//ask.hellobi.com/blog/EasyCharts& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&EasyCharts 博客专栏&/a&&/p&&p&公众号:EasyCharts&/p&&/blockquote&&p&&b&大家也可以加小编微信:tswenqu(备注:知乎),进R语言中文社区 交流群,可以跟各位老师互相交流&/b&&/p&&p&&b&官方公众号:R语言中文社区 (ID:R_shequ) 欢迎关注,持续连载。&/b&&/p&
今天是一个图表高仿,对象是一财经典的半圆型线条比较图,信息主要是针对2016年天猫全球购物狂欢节的当日总销售额,为了使得比较效果更有针对性,作者使用了几个中小型体量的国家GDP总量来对比,总体来看比较生动形象,引人眼球。 但是该图制作比较复杂,之…
&figure&&img src=&https://pic1.zhimg.com/v2-96dbb38db683e9bea2b5_b.jpg& data-rawwidth=&416& data-rawheight=&343& class=&content_image& width=&416&&&/figure&&p&之前已经模仿了挺多网络上流行的高难度商务图表案例,自觉功力有所小成,就想着趁热打铁,把那些剩余的还没有被挖掘出来了的商务图表案例全部补全。&/p&&p&本篇给出不等宽柱形图案例以及MEKKO(也称市场细分矩阵)图案例全部四张图的R语言代码,作为ggplot商务图表进阶道路上的一个小小一步。&/p&&p&因素需要构造自定义标度,这里需要scale包的支持&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&library(ggplot2)
library(scales)
&/code&&/pre&&/div&&p&构造不等宽柱形图的案例数据(本案例模仿对象是刘万祥老师的《Excel图表之道》,感谢老师在业界的无私奉献精神,给我后备爱或者留下了如此丰富的图表案例资源,这里再次向老师致敬!)。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&mydata&-data.frame(Name=paste0(&项目&,1:5),Scale=c(35,30,20,10,5),ARPU=c(56,37,63,57,59))
&/code&&/pre&&/div&&p&因为本篇 所构造的不等宽柱形图、MEKKO矩阵图等都是建立在四边形(或者呈为矩阵)的基础图形之上的,即物理的二维空间中,四个点坐标可以定位出一个四边形,利用R语言的向量化操作,就可以同时操纵n组长度为4的向量,来批量生成矩形块,这里的核心技巧只是在数据源中准确的生成每一组向量(也即每一个矩形块的水平轴起点、终点、垂直轴的起点、终点)。&/p&&p&在ggplot系统中,生成矩形的图层函数是geom_rect()函数,内置四个参数:&/p&&p&xmin\xmax\ymin\ymax&/p&&p&不等宽柱形图:&/p&&p&#构造矩形X轴的起点(最小点)&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&mydata$xmin&-0
for (i in 2:5){
mydata$xmin[i]&-sum(mydata$Scale[1:i-1])
#构造矩形X轴的终点(最大点)
for (i in 1:5){
mydata$xmax[i]&-sum(mydata$Scale[1:i])
#构造数据标签的横坐标:
for (i in 1:5){
mydata$label[i]&-sum(mydata$Scale[1:i])-mydata$Scale[i]/2
&/code&&/pre&&/div&&p&定义字体:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&windowsFonts(myFont = windowsFont(&微软雅黑&))
&/code&&/pre&&/div&&p&运行ggplot函数:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&ggplot(mydata)+
geom_rect(aes(xmin=xmin,xmax=xmax,ymin=0,ymax=ARPU,fill=Name))+
scale_fill_manual(values=c(&#54576B&,&#BD1F12&,&#E8BA11&,&#62962A&,&#9B56AF&))+
geom_text(aes(x=label,y=ARPU-3,label=ARPU),size=6,col=&white&,family=&myFont&)+
geom_text(aes(x=label,y=-2.5,label=Scale),size=4,col=&black&,family=&myFont&)+
geom_text(aes(x=label,y=-5.5,label=Name),size=4,col=&black&,family=&myFont&)+
annotate(&text&,x=16,y=70,label=&不等宽柱形图&,size=8,family=&myFont&)+
annotate(&text&,x=14,y=64,label=&这是一幅很用心的图表&,size=4,family=&myFont&)+
annotate(&text&,x=11,y=-9.8,label=&Source:EasyCharts&,size=4,family=&myFont&)+
ylim(-10,80)+
theme_nothing()
&/code&&/pre&&/div&&figure&&img src=&https://pic3.zhimg.com/v2-02d051d50ae702fb5ee8e1_b.jpg& data-rawwidth=&415& data-rawheight=&337& class=&content_image& width=&415&&&/figure&&p&-----------------------------------------------------------------------------------------------------------&/p&&p&不等宽条形图:&/p&&p&该案例来自于本人小号数据小魔方,也曾在本平台转发过:&/p&&p&&a href=&https://link.zhihu.com/?target=http%3A//mp.weixin.qq.com/s%3F__biz%3DMzI5MzQzMjU4Mw%3D%3D%26mid%3D%26idx%3D1%26sn%3Dbfae0b4a7d907baff5017f%26chksm%3Dec737e50db04fffea1cde88e%26scene%3D21%23wechat_redirect& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&图表案例——全球创新国家1000强研发投入变动趋势&/a&&br&&/p&&p&设置目录并导入数据&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&setwd(&F:/微信公众号/公众号——数据小魔方/2017年3月/&)
mydata&-read.csv(&barchart.csv&,stringsAsFactors = FALSE)
names(mydata)[1:5]&-c(&State&,&RD&,&Betw&,&Cumcost&,&class&)
#构造矩形X轴的起点(最小点)
mydata$xmin&-0
for (i in 2:nrow(mydata)){
mydata$xmin[i]&-sum(mydata$RD[1:i-1])
#构造矩形X轴的终点(最大点)
for (i in 1:nrow(mydata)){
mydata$xmax[i]&-sum(mydata$RD[1:i])
#构造数据标签的横坐标:
for (i in 1:nrow(mydata)){
mydata$label[i]&-sum(mydata$RD[1:i])-mydata$RD[i]/2
mydata$class&-factor(mydata$class,levels=c(&亚洲&,&欧洲&,&北美&,&其他地区&))
&/code&&/pre&&/div&&p&运行作图函数:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&ggplot(mydata)+
geom_rect(aes(xmin=xmin,xmax=xmax,ymin=0,ymax=Betw,fill=class),col=&white&)+
coord_flip()+
scale_x_reverse()+
scale_y_continuous(limits=c(-.45,.7),breaks=seq(-.4,.7,.1),labels=percent_format(),position = &top&)+
scale_fill_manual(values=c(&#802428&,&#AB6661&,&#D1A6A1&,&#A89B94&))+
geom_text(aes(x=label,y=Betw/2,label=Betw),size=3,col=&white&,family=&myFont&)+
geom_text(aes(x=label,y=ifelse(Betw&0,Betw+.03,Betw-.033),label=mydata$RD),size=4,col=&black&,family=&myFont&)+
geom_text(aes(x=label,y=ifelse(Betw&0,-.07,.07),label=State),size=4,col=&black&,family=&myFont&)+
labs(title=&不等宽柱形图&,subtitle=&这是一幅很用心的图表&,caption=&Source:EasyCharts&,x=&&,y=&&)+
text=element_text(family=&myFont&),
plot.title=element_text(size=18),
plot.subtitle=element_text(size=14),
plot.caption=element_text(size=10,hjust=0),
plot.background=element_blank(),
panel.background=element_blank(),
panel.grid=element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank(),
legend.position=c(0.9,0.2),
axis.line.x=element_line()
&/code&&/pre&&/div&&figure&&img src=&https://pic1.zhimg.com/v2-ab6e5ccd311ad75c726bf0a5f0f42484_b.jpg& data-rawwidth=&411& data-rawheight=&297& class=&content_image& width=&411&&&/figure&&p&--------------------------------------------------------------------------------------------------------&/p&&p&MEKKO(也称市场细分矩阵)&/p&&p&该图表同样来源于刘老师的图表宝典——《Excel图表之道》&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&Mekko&-read.csv(&Mekko.csv&,stringsAsFactors = FALSE)
Mekko$Class&-factor(Mekko$Class,order=T)
#构造矩形(Obama)X轴的起点(最小点)
Mekko$xmin&-0
for (i in 2:nrow(Mekko)){
Mekko$xmin[i]&-sum(Mekko$percent[1:i-1])
#构造矩形(Obama)X轴的终点(最大点)
for (i in 1:nrow(Mekko)){
Mekko$xmax[i]&-sum(Mekko$percent[1:i])
#构造数据标签的横坐标:
for (i in 1:nrow(Mekko)){
Mekko$label[i]&-sum(Mekko$percent[1:i])-Mekko$percent[i]/2
&/code&&/pre&&/div&&p&这里我不想重复映射两次geom_rect()图层函数,所以从新整理了数据源,一定要记得ggplot的作图体系中使用因子变量进行分类作图的思想,这里完全可以用一个类别标量赋给fill属性,避免代码冗余。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&mynewdata1&-Mekko[,c(1,6,7)];mynewdata1$ymin&-0;mynewdata1$ymax&-Mekko$Omynewdata1$Type&-&Obama&
mynewdata2&-Mekko[,c(1,6,7)];mynewdata2$ymin&-Mekko$Obama+Mekko$m;mynewdata2$ymax&-Mekko$Obama+Mekko$m+Mekko$McCmynewdata2$Type&-&McCain&
mynewdata&-rbind(mynewdata1,mynewdata2)
mynewdata$Type&-factor(mynewdata$Type,levels=c(&Obama&,&McCain&),order=T)
&/code&&/pre&&/div&&p&运行作图函数:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&ggplot(mynewdata)+
geom_rect(aes(xmin=xmin,xmax=xmax,ymin=ymin,ymax=ymax,fill=Type),col=&white&)+
scale_fill_manual(values=c(&#004C7F&,&#B70023&))+
scale_x_continuous(breaks=Mekko$label,labels=Mekko$Class)+
geom_text(data=Mekko,aes(x=label,y=.25,label=percent(Obama)),size=3.5,col=&white&,family=&myFont&)+
geom_text(data=Mekko,aes(x=label,y=.8,label=percent(McCain)),size=3.5,col=&white&,family=&myFont&)+
labs(title=&MEKKO-市场细分矩阵图&,subtitle=&这是一幅用心良苦的图表&,caption=&Source:EasyCharts&,x=&&,y=&&)+
plot.margin=unit(c(2,0,0.5,0),&lines&),
panel.spacing=unit(c(0,0,0,0),&lines&),
axis.text.x=element_text(angle=90,size=10),
panel.background=element_blank(),
axis.ticks=element_blank(),
axis.text.y=element_blank(),
legend.position=c(.78,1),
legend.direction=&horizontal&,
text=element_text(family=&myFont&),
plot.title=element_text(size=18),
plot.subtitle=element_text(size=14),
plot.caption=element_text(size=10,hjust=0),
legend.title=element_blank()
&/code&&/pre&&/div&&figure&&img src=&https://pic2.zhimg.com/v2-6f5a7d943e3be289e6dea_b.jpg& data-rawwidth=&335& data-rawheight=&420& class=&content_image& width=&335&&&/figure&&p&---------------------------------------------------------------------------------------------------------&/p&&p&以下同样的数据源,只是通过坐标旋转,换成了条形图的风格。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&ggplot(mynewdata)+
geom_rect(aes(xmin=xmin,xmax=xmax,ymin=ymin,ymax=ymax,fill=Type),col=&white&)+
coord_flip()+
scale_fill_manual(values=c(&#004C7F&,&#B70023&))+
scale_x_continuous(breaks=Mekko$label,labels=Mekko$Class)+
geom_text(data=Mekko,aes(x=label,y=.25,label=percent(Obama)),size=3.5,col=&white&,family=&myFont&)+
geom_text(data=Mekko,aes(x=label,y=.8,label=percent(McCain)),size=3.5,col=&white&,family=&myFont&)+
labs(title=&MEKKO-市场细分矩阵图&,subtitle=&这是一幅用心良苦的图表&,caption=&Source:EasyCharts&,x=&&,y=&&)+
plot.margin=unit(c(0,0,0,0),&lines&),
panel.spacing=unit(c(0,0,0,0),&lines&),
axis.text.y=element_text(size=10),
panel.background=element_blank(),
axis.ticks=element_blank(),
axis.text.x=element_blank(),
legend.position=c(.78,1),
legend.direction=&horizontal&,
text=element_text(family=&myFont&),
plot.title=element_text(size=18),
plot.subtitle=element_text(size=14),
plot.caption=element_text(size=10,hjust=0),
legend.title=element_blank()
&/code&&/pre&&/div&&figure&&img src=&https://pic1.zhimg.com/v2-bf3b2d9c11f04f7ee15c_b.jpg& data-rawwidth=&442& data-rawheight=&385& class=&origin_image zh-lightbox-thumb& width=&442& data-original=&https://pic1.zhimg.com/v2-bf3b2d9c11f04f7ee15c_r.jpg&&&/figure&&p&因水平有限,代码写的比较糟糕,图表如有可改善的细节,还请的各位多多指点。&/p&&p&---------------------&/p&&blockquote&&p&作者:EasyCharts&/p&&p&博客专栏:&a href=&https://link.zhihu.com/?target=https%3A//ask.hellobi.com/blog/EasyCharts& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&EasyCharts 博客专栏&/a&&/p&&p&公众号:EasyCharts&/p&&/blockquote&&br&&p&&b&大家也可以加小编微信:tswenqu(备注:知乎),进R语言中文社区 交流群,可以跟各位老师互相交流&/b&&/p&&p&&b&官方公众号:R语言中文社区 (ID:R_shequ) 欢迎关注,持续连载。&/b&&/p&
之前已经模仿了挺多网络上流行的高难度商务图表案例,自觉功力有所小成,就想着趁热打铁,把那些剩余的还没有被挖掘出来了的商务图表案例全部补全。本篇给出不等宽柱形图案例以及MEKKO(也称市场细分矩阵)图案例全部四张图的R语言代码,作为ggplot商务图表…
&figure&&img src=&https://pic3.zhimg.com/v2-82ddd949e7c8ad1239ba3_b.jpg& data-rawwidth=&638& data-rawheight=&612& class=&origin_image zh-lightbox-thumb& width=&638& data-original=&https://pic3.zhimg.com/v2-82ddd949e7c8ad1239ba3_r.jpg&&&/figure&&p&(更正了算式重复显示两次的部分)&/p&&p&该篇内容是Joseph K. Blitzstein的《&a href=&http://link.zhihu.com/?target=http%3A//projects.iq.harvard.edu/stat110/about& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Introduction to Probability&/a&》中的第一章,该概率书非常适合入门。文章是加入自己理解后的总结。以服务于机器学习的理解视角切入。&/p&&br&&p&gitbook阅读地址:&a href=&http://link.zhihu.com/?target=https%3A//yjango.gitbooks.io/superorganism/content/gai_lv.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&概率 · 超智能体&/a&。gitbook上的一节,转移到知乎上。&/p&&br&&h2&&b&概率&/b&&/h2&&p&通过线性代数(线性代数&a href=&https://zhuanlan.zhihu.com/p/& class=&internal&&简单入门地址&/a&),我们知道了该如何描述事物状态及其变化。遗憾的是,对一个微小的生物而言,世界并非确定性(nondeterministic)的,由于信息量的限制,很多事物是无法确定其变化后会到达哪种状态。然而为了更好的生存,预测未来状态以决定下一刻的行为至关重要。而概率给我们的决策提供了依据。推荐读物《&a href=&http://link.zhihu.com/?target=http%3A//projects.iq.harvard.edu/stat110/about& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Introduction to Probability&/a&》&/p&&p&&b&一、什么是概率?&/b&&/p&&blockquote&&p&概率是用来衡量我们对事物在跨时间后不同状态的&b&确信度&/b&。&/p&&/blockquote&&ul&&li&&p&&b&设想:&/b&如果时间静止,其实并不需要概率。因为不确定的信息永远不知道,新的不确定性也永远不出产生。所以一定要以时间轴会变化的角度去理解概率。概率是观察者畅想一个状态从某个时间点变化到另个时间点后的确信度。跨时间可以是过去到未来,也可以是未来到过去。&/p&&/li&&li&&p&&b&情景:&/b&如何考虑转盘在未来停止后指针指向各个数字的可能性?为方便研究,需要总结出在任何情况都普遍适用的属性,并给予它们固定的名字。&/p&&p&1,2,3是可能被指到的三个结果(outcome)。在这里,这三个结果组成的集合也同时是样本空间(sample space),即无论事态如何发展,结果都不会出现在该集合之外(和向量空间一样)。样本空间的子集,如{1,2}叫做一个事件(event),表示指针指到1或2的情况。满足任何一个情况都算作该事件发生了(occurred)。所有事件发生的可能性都用值域为[0,1]间的实数表示,1表示必然发生,0表示不可能发生。{1}, {2,3}两个不相交的事件的概率和为1。[0,1]间的实数是概率得出的值,但并非概率的全部。概率是一个函数。&/p&&/li&&/ul&&figure&&img src=&https://pic3.zhimg.com/v2-746ff9fde965cb61f90d83e712ba4c67_b.jpg& data-rawwidth=&442& data-rawheight=&220& class=&origin_image zh-lightbox-thumb& width=&442& data-original=&https://pic3.zhimg.com/v2-746ff9fde965cb61f90d83e712ba4c67_r.jpg&&&/figure&&blockquote&&p&&b&概率:&/b&概率是将样本空间内的子集投向概率空间的函数。&/p&&p&概率&img src=&http://www.zhihu.com/equation?tex=P%28+%29& alt=&P( )& eeimg=&1&&将事件&img src=&http://www.zhihu.com/equation?tex=A%5Csubset+S& alt=&A\subset S& eeimg=&1&&作为输入,并输出&img src=&http://www.zhihu.com/equation?tex=%5B0%2C1%5D& alt=&[0,1]& eeimg=&1&&之间的实数表示其发生的可能性。该函数需要满足两个条件:&/p&&p&1.&img src=&http://www.zhihu.com/equation?tex=P%28+%5Cemptyset%29%3D0%2C+P%28S%29%3D1& alt=&P( \emptyset)=0, P(S)=1& eeimg=&1&&,空集的概率为0,全集的概率为1。&/p&&p&2.&img src=&http://www.zhihu.com/equation?tex=P%28%5Cbigcup%5Climits_%7Bj%3D1%7D%5E%7B%5Cinfty%7DA_%7Bj%7D%29%3D%5Csum%5Climits_%7Bj%3D1%7D%5E%7B%5Cinfty%7DP%28A_%7Bj%7D%29& alt=&P(\bigcup\limits_{j=1}^{\infty}A_{j})=\sum\limits_{j=1}^{\infty}P(A_{j})& eeimg=&1&&,不相交事件之间的并集事件的概率等于各个事件概率之和。&/p&&p&&b&结果:&/b&可能到达的状态&/p&&p&&b&样本空间:&/b&所有可能发生的结果所组成的集合。&/p&&p&&b&事件:&/b&样本空间的子集。&/p&&p&当实际发生的结果&img src=&http://www.zhihu.com/equation?tex=s_%7Boutcome%7D%5Cin+A& alt=&s_{outcome}\in A& eeimg=&1&&时,表示&img src=&http://www.zhihu.com/equation?tex=A& alt=&A& eeimg=&1&&事件发生。&/p&&/blockquote&&p&&b&二、朴素概率的计算以及和普遍概率的区别是什么?&/b&&/p&&p&人们在计算概率时常常犯的错误就是不假思索的假定所有结果所发生的可能性都相同。并用事件的结果个数比上样本空间的结果个数。&/p&&blockquote&&p&朴素概率:&img src=&http://www.zhihu.com/equation?tex=P_%7Bnaive%7D%28A%29%3D%7CA%7C%2F%7CS%7C& alt=&P_{naive}(A)=|A|/|S|& eeimg=&1&&,&img src=&http://www.zhihu.com/equation?tex=%7CA%7C& alt=&|A|& eeimg=&1&&和&img src=&http://www.zhihu.com/equation?tex=%7CS%7C& alt=&|S|& eeimg=&1&&表示集合中元素的个数。&/p&&/blockquote&&p&但是这种假设并不严谨。&/p&&ul&&li&实例:在上图原盘问题中,如果使用朴素概率来计算指针停止时指向2的概率,就会得到&img src=&http://www.zhihu.com/equation?tex=P_%7Bnaive%7D%3D%7CA%7C%2F%7CS%7C%3D1%2F3& alt=&P_{naive}=|A|/|S|=1/3& eeimg=&1&&的概率。但很明显,指向3的结果就占有原盘一半的空间,指向3的概率更大。使得各个结果发生的可能性并不相同。不可以使用朴素概率算法。从图中可以看出答案是&img src=&http://www.zhihu.com/equation?tex=1%2F4& alt=&1/4& eeimg=&1&&。&/li&&/ul&&p&&b&样本空间好比是总价为1的一筐苹果,一个事件就是一堆苹果,概率是将这堆苹果转换成实际价钱的函数。但苹果有大有小,只有当所有苹果都一模一样时,这堆苹果的价钱才是 苹果数/总个数。空集,即一个苹果都没有的话,价格为0。整框苹果的话,价格自然为1。把整框苹果分成几堆(事件之间不相交),价格的总和为1。&/b&&/p&&figure&&img src=&https://pic3.zhimg.com/v2-c61d2008f6fbdb7f298d1d3ad16c8bae_b.jpg& data-rawwidth=&389& data-rawheight=&359& class=&content_image& width=&389&&&/figure&&h1&&b&条件概率&/b&&/h1&&p&当我们获得更多信息后,新信息会对原始样本空间产生更新。&/p&&p&&b&三、条件概率又是什么?&/b&&/p&&p&条件概率是新信息对样本空间进行调整后的概率情况。&/p&&ul&&li&&p&&b&实例:&/b&从一副洗好的扑克里,不放回的依次抽两张

我要回帖

更多关于 echart 地图散点图 的文章

 

随机推荐