Druid 大数据分析之快速应用(单机模式)

Druid 基本介绍 1.概述 随着互联网快速发展,数据量增长快,达到TB、PB,以交通车流量为例,如湖南省每月的车辆流量至少达到4亿,这个数据量远不止如此。数据量如此大,如何满足后期分析,传统面向OLTP型数据库(ORACLE、MYSQL等)无法要求,渐渐开始转向OLAP,如GreenPlum等,虽然很多OLAP数据库吸收分布式计算思想,数据达到20亿以上后,进行Count、聚合等操作性能仍然达不到客户实时... 阅读详情

Druid 大数据分析之快速应用(单机模式)

druid

1、概述

   本节快速安装基于单机服务器,很多配置可以默认不需要修改,数据存储在操作系统级别的磁盘。推出快速安装的目的,便于了解并指导基于Druid进行大数据分析的开发流程。本节主要讲Druid的安装、实例数据加载、查询及使用问题解决。

 

2、安装要求

   1. Java 7 及以上
   2. Linux, Mac OS X, or other Unix-like OS (Windows不支持)
   3. VMware
   4. 2CPU ++; 内存2G ++

 

3、Zookeeper 安装

   本次采单机版安装,如果采用分布式安装,则需要修改Druid相应配置,反之不需要。 Zookeeper默认启用2181端口监听。

 

Linux代码 

 收藏代码

  1. curl http://www.gtlib.gatech.edu/pub/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz -o zookeeper-3.4.6.tar.gz  
  2. tar -xzf zookeeper-3.4.6.tar.gz  
  3. cd zookeeper-3.4.6  
  4. cp conf/zoo_sample.cfg conf/zoo.cfg  
  5. ./bin/zkServer.sh start  

 

     zookeeper 安装验证

Linux和zookeeper命令代码 

 收藏代码

  1. cd zookeeper-3.4.6 // 切换至Zookeeper根目录  
  2. bin/zkCli.sh       // 启动Zookeeper客户端  
  3. ls /               // 查看根节点  

 

4、Druid 安装

Java代码 

 收藏代码

  1. curl -O http://static.druid.io/artifacts/releases/druid-0.9.1.1-bin.tar.gz  
  2. tar -xzf druid-0.9.1.1-bin.tar.gz  
  3. cd druid-0.9.1.1  

 

解压后 Druid 相关目录说明

 

  • LICENSE - 许可证文件。
  • bin/ - 快速启动脚本。
  • conf/* - 集群安装配置(包括Hadoop)。
  • conf-quickstart/* - 快速启动相关配置。
  • extensions/* - Druid扩展。
  • hadoop-dependencies/* - Druid hadoop依赖。
  • lib/* - Druid核心软件包。
  • quickstart/* - 快速启动示例文件及数据。

 

5、启动 Druid 准备

   启动Druid相关服务之前,我们需要做两件事:
   1. 启动Zookeeper
   2. 切换到Druid根目录,执行 bin/init

 

6、启动 Druid 相关服务

   启动5个Druid进程在不同远程终端窗口,因为是单机模式,所有进程在同一服务器上;在大的分布式集群中,很多Druid进程可以在同一服务器,我们需要启动的5个Druid进程:Historical、Broker、coordinator、overlord、middleManager。overlord与middleManager对应Indexer节点,节点相关介绍请查看《http://yangyangmyself.iteye.com/blog/2320502》,后续将会详细介绍节点工作机制。

    

    切换至Druid安装目录,在不同远程终端窗口依次执行以命令

Java代码 

 收藏代码

  1. java `cat conf-quickstart/druid/historical/jvm.config | xargs` -cp "conf-quickstart/druid/_common:conf-quickstart/druid/historical:lib/*" io.druid.cli.Main server historical  
  2. java `cat conf-quickstart/druid/broker/jvm.config | xargs` -cp "conf-quickstart/druid/_common:conf-quickstart/druid/broker:lib/*" io.druid.cli.Main server broker  
  3. java `cat conf-quickstart/druid/coordinator/jvm.config | xargs` -cp "conf-quickstart/druid/_common:conf-quickstart/druid/coordinator:lib/*" io.druid.cli.Main server coordinator  
  4. java `cat conf-quickstart/druid/overlord/jvm.config | xargs` -cp "conf-quickstart/druid/_common:conf-quickstart/druid/overlord:lib/*" io.druid.cli.Main server overlord  
  5. java `cat conf-quickstart/druid/middleManager/jvm.config | xargs` -cp "conf-quickstart/druid/_common:conf-quickstart/druid/middleManager:lib/*" io.druid.cli.Main server middleManager  

 

Druid 控制台 

   如果上述服务启动成功,则可以访问如下控制台
   1. 访问http://localhost:8090/console.html 可以查看数据批量导入Druid的任务执情况,间隔一段时间刷新一下控制台,如果看到SUCCESS任务状态,说明任务执行成功,如下图所示:


 
    2. 访问http://localhost:8081/ 查看任完成进度、数据分片情况、索引创建等

 

 

7、Druid 加文件数据

   以上Druid相关服务启动后,我们需要加载相关业务数据到Druid,Druid根据数据加载的配置文件,将我们的原始业务数据做相应的预处理后进行存储,以便后续查询统计。数据加载有两种方式:一是实时加载;二、加载批文件,本节讲如何加载Json批数据文件。
   Linux环境下加载数据文件,执行方式如下:

 

Pass.json代码 

 收藏代码

  1. {"gcxh":"430000002745468976","license":"测AZ6LUL","licenseType":"02","hpys":"5","csys":null,"cllx":"0","clpp":null,"gateId":"430186000347","fxlx":"8","cdbh":"1","passTime":"2016-07-03T20:23:17.000Z","carPassDate":"2016-07-04","carPassTime":"04:23:17","carLoc":"测A","province":"43","city":"4301","region":"430186"}  

Pass-index.json代码 

 收藏代码

  1. {  
  2.   "type" : "index_hadoop",  
  3.   "spec" : {  
  4.     "ioConfig" : {  
  5.       "type" : "hadoop",  
  6.       "inputSpec" : {  
  7.         "type" : "static",  
  8.         "paths" : "/opt/data/pass.json" /**指定数据*/  
  9.       }  
  10.     },  
  11.     "dataSchema" : {  
  12.       "dataSource" : "kakou",  /**数据源名,类似表名*/  
  13.       "granularitySpec" : {  
  14.         "type" : "uniform",  
  15.         "segmentGranularity" : "day", /**数据分片粒度,按天*/  
  16.         "queryGranularity" : "none",  
  17.         "intervals" : ["2016-07-04/2016-07-05"] /**时间跨度*/  
  18.       },  
  19.       "parser" : {  
  20.         "type" : "string",  
  21.         "parseSpec" : {  
  22.           "format" : "json",  /**数据文件类型*/  
  23.           "dimensionsSpec" : {  
  24.             "dimensions" : [  /**数据列*/  
  25.               "license",  
  26.               "carLoc",  
  27.               "licenseType",  
  28.               "hpys",  
  29.               "cllx",  
  30.               "clpp",  
  31.               "gateId",  
  32.               "fxlx",  
  33.               "passTime",  
  34.               "carPassDate",  
  35.               "carPassTime",  
  36.               "province",  
  37.               "city",  
  38.               "region"  
  39.             ]  
  40.           },  
  41.           "timestampSpec" : {   
  42.             "format" : "auto",  
  43.             "column" : "passTime"  /**指定时间分段*/  
  44.           }  
  45.         }  
  46.       },  
  47.       "metricsSpec" : [     
  48.         {  
  49.           "name" : "count",  
  50.           "type" : "count"  /**按count聚合*/  
  51.         }  
  52.       ]  
  53.     },  
  54.     "tuningConfig" : {  
  55.       "type" : "hadoop",  
  56.       "partitionsSpec" : {  
  57.         "type" : "hashed",  
  58.         "targetPartitionSize" : 5000000  
  59.       },  
  60.       "maxRowsInMemory":500000,  
  61.       "jobProperties" : {}  
  62.     }  
  63.   }  
  64. }  

 

将上述Json示例数据保存为pass.json的文件,接下来定义一个数据配置文件pass-index.json,在pass-index.json中引用数据pass.json、指定数据源名(类似表名)、数据维度列、聚合粒度、时间间隔等。

 

Java代码 

 收藏代码

  1. /**执行如下命令进行导入操作*/  
  2. curl -X 'POST' -H 'Content-Type:application/json' -d @/opt/data/pass-index.json 192.168.121.200:8090/druid/indexer/v1/task  

 

8、Druid 数据导入问题及解决办法

1. 中文乱码:Json规范这里不再阐述,讲一下生成Json数据文件注意的情况,目前发现Json中含有中文情况下,将Json数据加载到Druid时出现乱码。生成Json指文件编码为UTF-8。
2. 时间序列值:Druid按时间进序列值进行数据分片,按时间字段进行数据分片的字段值需要标准化(UTC)处理。
3. 任务挂起或等待:Druid将任务提交给Hadoop中的Map-Reduce执行,导入时任务可会因为某种原因导致任务挂起或停止。

 

   中文乱码解决办法:

 

编码代码 

 收藏代码

  1. try{  
  2.     OutputStream out = new FileOutputStream(new File("E:\\study\\druid\\rpass_20150801.json"),true);  
  3.     Writer write = new OutputStreamWriter(out,"utf-8");  
  4.     write.write(json.toString()+"\n");  
  5.     write.flush();  
  6.     write.close();  
  7.     out.close();  
  8. }catch(){  
  9.     e.printStackTrace();  
  10. }  

   

    时间序列值UTC标准化:

 

Java代码 

 收藏代码

  1. /**引用Joda类库*/  
  2. DateTimeFormatter dtFormatter=DateTimeFormat.forPattern("yyyy-MM-dd hh:mm:ss");    
  3. /**输出结果 2016-08-29T22:58:20.000Z*/  
  4. String result = dtFormatter.parseDateTime('2016-08-29 22:58:20').withZone(DateTimeZone.UTC).toString();  

 

 

    任务挂起或停止解决办法:可以通过下述命将挂起任务删除,重新执行导入。

 

Java代码 

 收藏代码

  1. /**taskId可以从控制台获取或在执行Curl导入命令时返回值*/  
  2. http://<OVERLORD_IP>:<port>/druid/indexer/v1/task/{taskId}/shutdown  

 

9、Druid 请求接口

1. 查询请求接口对应Broker,默认8082端口 http://<queryable_host>:<port>/druid/v2/?pretty
2. 数据导入接口对应Indexing,默认8090端口 http://<OVERLORD_IP>:<port>/druid/indexer/v1/task

Hive与Druid集成:实时OLAP大数据分析 在大数据时代,企业和组织需要处理海量的数据,并从中提取有价值的信息。实时OLAP(在线分析处理)大数据分析能够帮助我们快速地对数据进行分析和查询,从而做出及时的决策。Hive是一个基于Hadoop的数据仓库工具,它提供了类似于SQL的查询语言,方便用户对大规模数据进行分析。Druid是一个实时分析数据存储系统,具有高性能、可扩展性和实时性等特点。本文章的目的就是介绍如何将Hive与Druid集成,以实现高效的实时OLAP大数据分析。 阅读详情

相关推荐

【算力网络】算力知识

尽管算力这个词在近年来很“火”,但其背后的含义,却很少有人真正了解

qq_42809645的博客 1万+

Druid部署与使用:一、Druid集群部署

一、准备 四台服务器: 192.168.1.1  druid01  coordinator  overlord 192.168.1.2  druid02  historical  middleManager 192.168.1.3  druid03  historical middleManager 192.168.1.4  druid04  broker 安装包 jdk1.8 、h...

weixin_38441544的博客 8295

Python之美——Python2与Python3多版本共存

Python多版本共存的方法Python2、Python3共存的方法python2下载及环境变量配置第一步、打开Python官网,下载Python2第二步、python2环境变量配置测试结果 Python2、Python3共存的方法 方法如下: 1.先确保不同版本解释器的python.exe所在的路径在环境变量中 2.拷贝各自的python.exe并重命名即可 步骤(理解不了下面有图示): 1、首先你需要将不同的python版本安装,且都已经将跟版本的环境变量配置好了,python3和2的下载方式

chenchen5152的博客 3946

spring+druid多数据源配置

博客引用处(以下内容在原有博客基础上进行补充或更改,谢谢这些大牛的博客指导): spring+druid多数据源配置 druid多数据源配置 一、druid简介 Druid首先是一个数据库连接池,但它不仅仅是一个数据库连接池,它还包含一个ProxyDriver,一系列内置的JDBC组件库,一个SQL Parser。 Druid是目前最好的数据库连接池,在功能、性能、扩展性方面,都超过其他数据库连接...

Willian的博客屋 6818

别再只跑memtester了!嵌入式Linux内存压力测试,这5个参数和场景你试过吗?

本文深入探讨了嵌入式Linux内存压力测试的高级技巧,重点解析了memtester工具的5个关键参数和实战场景。通过物理地址测试、迭代控制、内存分配策略等调优方法,帮助开发者有效检测内存稳定性问题,适用于长期运行设备、特定故障重现等复杂场景,提升嵌入式系统可靠性。

weixin_30838873的博客 425

NDVI空间分布变化Slope趋势分析与F检验(自用)

1.NDVI数据预处理2.一元线性回归分析3.Slope趋势分析与F检验

什么都学亿点点的博客 9020

SpringBoot项目技术集成

package com.yk.code.aspect; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.yk.code.util.PageBean; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint.

m0_60413225的博客 630

二、声明式 Pipeline 语法

选择型参数,一般用于给定几个可选的值,然后选择其中一个进行赋值,例如:parameters { choice(name: ‘CHOICES’, choices: [‘one’, ‘two’, ‘three’], description: ‘’) },表示定义一个名为 CHOICES 的变量,可选的值为 one、two、three;默认情况下,如果定义了某个 stage 的 agent,在进入该 stage 的 agent 后,该 stage 的 when条件才会被评估,但是可以通过一些选项更改此选项。

Cyan_Jiang的博客 1220

SpringCloud(三):Eureka基础知识,单机配置、集群配置、自我保护

前情回顾 SpringCloud(一):SpringBoot、SpringCloud版本选择,微服务架构编码构建 在(一)和(二)中,我们搭建了两个模块,Order和Payment通过RestTempate实现了RestFul风格的地址调用,但还未用到微服务相关的知识。 接下来,我们将要把这些技术,一块块的往上加,让他越来越庞大和复杂,也越来越强大。 我们先加第一个组件,服务注册中心,虽然我们(一)和(二)没有通过服务注册中心就能互相调用,但是如果服务很多,那么将会出现问题。 我们来学习服务注册中

Clawww的学习笔记 807

R语言广义加型模型(GAM)的运用例子及实现教程

一旦拟合了广义加型模型,我们可以查看模型摘要和诊断,以评估模型的质量和拟合情况。# 查看模型摘要响应变量:mpg(汽车的燃油效率)拟合函数:mpg ~ s(hp) + s(wt)

Mrrunsen的博客 3447

实战案例—encrypt靶场(AES固定key篇)

AES是一种对称密钥加密方法,意味着加密和解密时使用相同的密钥。AES加密存在三种形式:AES-128、AES-192和AES-256,它们分别对应于三种不同的密钥长度——128位(即16字节)、192位(即24字节)和256位(即32字节)。通常情况下,密钥的长度越长,提供的安全性就越高,但相应地,加解密过程所需的时间也会增加。默认情况下,采用的是AES-128,其提供的安全性对于大多数应用来说已经足够充分。

zhouzhou_98的博客 498

Druid 大数据分析之概况

一、概述     随着互联网快速发展,数据量增长快,达到TB、PB,以交通车流量为例,如湖南省每月的车辆流量至少达到4亿,这个数据量远不止如此。数 据量如此大,如何满足后期分析,传统面向OLTP型数据库(ORACLE、MYSQL等)无法要求,渐渐开始转向OLAP,如GreenPlum等,虽然很多 OLAP数据库吸收分布式计算思想,数据达到20亿以上后,进行Count、聚合等操作性

yangyangmyself的专栏 3819

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

快速了解Druid——实时大数据分析软件

引言:Druid作为一款开源的实时大数据分析软件,最近几年快速风靡全球互联网公司,特别是对于海量数据和实时性要求高的场景。如果你对Druid还很陌生,那赶紧跟着本文快速了解一下吧。 相关图书《Druid实时大数据分析原理与实践》。 Druid 是什么  Druid 单词来源于西方古罗马的神话人物,中文常常翻译成德鲁伊。   本问介绍的Druid 是一个分布式的支持实时分析的数据存储系...

博文视点(北京)官方博客 1968

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

大数据分析软件——Druid

Druid 单词来源于西方古罗马的神话人物,中文翻译成德鲁伊。 Druid 是一个分布式的支持实时分析的数据存储系统(Data Store)。 于2011 年创建了Druid 项目,并且于2012 年晚期开源了Druid 项目。 Druid 设计之初的想法就是为分析而生,它在处理数据的规模、数据处理的实时性方面,比传统的OLAP 系统有了显著的性能改进,而且拥抱主流的开源生态,包...

lixujie2527的博客 418

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

快速了解Druid

Druid 是什么   Druid 单词来源于西方古罗马的神话人物,中文常常翻译成德鲁伊。   本问介绍的Druid 是一个分布式的支持实时分析的数据存储系统(Data Store)。美国广告技术公司MetaMarkets 于2011 年创建了Druid 项目,并且于2012 年晚期开源了Druid 项目。Druid 设计之初的想法就是为分析而生,它在处理数据的规模、数据处理的实时性方面,比传统...

climbs的专栏 709

书籍-Druid实时大数据分析原理与实践

内容简介 Druid 作为一款开源的实时大数据分析软件,最近几年快速风靡全球互联网公司,特别是对于海量数据和实时性要求高的场景,包括广告数据分析、用户行为分析、数据统计分析、运维监控分析等,在腾讯、阿里、优酷、小米等公司都有大量成功应用的案例。《Druid实时大数据分析原理与实践》的目的就是帮助技术人员更好地深入理解Druid 技术、大数据分析技术选型、Druid 的安装和使用、高级特性的使用,也

风流三月1 2295

druid简介

Druid的由来 随着大数据分析需求的爆炸性增长,很多公司都经历过将以关系型商用数据库为基础的数据平台,转移到一些开源生态的大数据平台,例如Hadoop 或Spark 平台,以可控的软硬件成本处理更大的数据量。Hadoop 设计之初就是为了批量处理大数据,但数据处理实时性经常是它的弱点。例如,很多时候一个MapReduce 脚本的执行,很难估计需要多长时间才能完成,无法满足很多数据分析师所期望的...

asfjgvajfghaklsbf的博客 2093

druid 很久不访问_Druid实时大数据分析应用(二)

Druid 回顾Apache Druid 具有以下特点:亚秒级 OLAP 查询,包括多维过滤、Ad-hoc 的属性分组、快速聚合数据等等。实时的数据消费,真正做到数据摄入实时、查询结果实时。高效的多租户能力,最高可以做到几千用户同时在线查询。扩展性强,支持 PB 级数据、千亿级事件快速处理,支持每秒数千查询并发。极高的高可用保障,支持滚动升级。Druid的应用场景门店 App 业务大致情况如下:数...

weixin_42507981的博客 315
上一篇: Storm Druid Bolt实现
下一篇: Druid 大数据分析之查询
王树民
博客等级 码龄10年 912粉丝 560原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值