MapReduce编程:1.groupBy, 统计每月航班延迟到达的比例

【信息科学与工程学】【数据科学】第五十一篇 数据仓库00 基础设计01 数据仓库设计的系统性解决方案,涵盖架构模式、分层设计、百万级访问支撑、海量数据配置及与数据库/数据湖的对接策略: ​​ODS(操作数据层)​​:原始数据镜像,保留历史快照 ​​DWD(明细数据层)​​:清洗、标准化、维度退化 ​​DWS(汇总数据层)​​:主题宽表、轻度聚合 ​​ADS(应用数据层)​​:高度聚合,面向报表/API ​​二、百万用户访问架构设计​​ ​​1. 核心架构组件​​ ​​2. 关键配置参数(以Snowflake为例)​​ ​​3. 性能优化措 阅读详情

MapReduce编程:1.groupBy, 统计每月航班延迟到达的比例

题目要求

航空公司数据集,每一行包括如下数据
在这里插入图片描述
统计每月航班延迟到达的比例

分析
  1. 如果作为一个普通数学题,我们解题的步骤是先统计每个月的航班总数,然后统计每个月延时的航班的总数,然后做除法,所以放在计算机里面,我们可以在统计每个月航班总数的同时,也记录下延时的航班总数,然后做除法
  2. 那么利用MapReduce的思维,先进行map(任务分解),然后reduce(结果汇总)
  3. 对于map,要做的就是将任务分解,输入肯定是原始的文本,而输出的就是<月份,1>的键值对(因为MapReduce是一行一行读取数据,一行肯定只有一条数据,所以值为1),但是发现,值为1没办法区分是否延时,所以我们可以采用两个数进行区分,比如我使用的是1代表未延时,0表示延时(也可以使用别的数字),所以我的map就会出现两种结果,如果延时,结果为<月份,0>;如果未延时,结果为<月份,1>
  4. 对于reduce,要做的是将结果汇总(其实中间还有一步shuffle的过程,是将map的结果进行分类),输入是来自分类的map的处理结果,就是<月份,0和1的列表>,输出就是<月份,延时比例>
  5. 听懵了?没关系,下面用图和代码来解释
准备工作
  • ubuntu14环境
  • 已经启动的hadoop
  • 已经安装好hadoop插件的eclipse
  • 一个原始数据集

对于前三个东西,在上一篇博客已经介绍过了,对于最后一个,要自己准备

上一篇博客:https://blog.youkuaiyun.com/Dongroot/article/details/88562502

(下面的操作都是在ubuntu下进行)原始数据集怎么准备,在桌面新建一个txt文档,内容为。。。。难得写了,就是最上面那张图,然后以英文逗号隔开,一行一条记录,比如

在这里插入图片描述
我们需要关注的就是图中框起来的三列,分别是月份,飞机真实到达时间和原定到达时间,所以其他列的数据都是没用的,

mongo group by mapreduce操作 mongo group by mapreduce操作指导! 立即下载

相关推荐

YOLOv11 + TensorRT 在 Jetson 设备上的实时部署

YOLOv11 + TensorRT 在 Jetson 设备上的实时部署

p6666666668的博客 1588

突发环境事件怎么模拟?用Python+GIS实现高斯烟团模型(附完整代码)

本文详细介绍了如何利用Python与GIS技术实现高斯烟团模型,用于模拟化工泄漏等突发环境事件的动态扩散过程。通过核心原理讲解、参数快速获取方案、Python代码实现及GIS可视化集成,为环境应急人员提供了一套完整的解决方案。特别适合危险品运输事故等瞬态污染场景的应急决策支持。

weixin_33692284的博客 485

地心地固坐标系与北天东坐标系的转换

经过这一步旋转,x3轴和y3轴就处在过O3点的经度线所在的平面了,而且z3轴指向了东。将图3的坐标系旋转成图2的样子。这里需要多次旋转,每次以某个轴为对称轴进行旋转,对应的坐标变换参考。的原点在地心,Z轴指向北极点,X轴指向本初子午线与赤道的交点,Y轴指向符合右手定则,如下图所示。下面实现地心地固坐标系到北天东坐标系的转换,问题描述为:设一点。以y1轴为对称轴,顺时针旋转90°,得到图4的样子。,X轴指向北,Y轴指向天,Z轴指向东,如下图所示。因此,北天东坐标下的坐标为。点在图3坐标系下的坐标。

csdnqixiaoxin的博客 3555

用blender为模型贴图并在gazebo中显示

用blender为模型贴图并在gazebo中显示 首先我用的是最新的blender2.92版本,附上链接https://www.blender.org/download/。并设置好简体中文。语言可以在编辑->偏好设置->界面里面设置。 首先界面右上角的摄像头,方块,灯光三个场景全都删除。 接着导入stl格式的模型文件,下面以tianbot_mini上面的激光雷达的模型为例。 导入激光雷达模型后,点击进入上方的UV Editing按钮进入UV编辑界面 此时我面看见网格化的激光雷达模型

qq_48427527的博客 7999

华为od 面试八股文_C语言_01_含答案

华为od 面试八股文_C语言_01_含答案

MISAYAONE的博客 3223

读懂ARM汇编程序,你只差这篇!保姆级教程(附完整示例剖析)!

ARM汇编中的符号、标号、伪操作有哪些?C语言和汇编语言如何混合编程?GNU ARM汇编和ARM汇编的区别有哪些?

车载系统攻城狮 1万+

SAP 消息号T-CODE

SAP消息号修改汇总 确实有很多消息是可以修改的 FI: oBA5|oFMG|oFPM MM: oMRM|oKZZ|oMT4|oMCQ|o04C| SD: oVAH(V4)|oVM1(VL) CO:  oPR4_ACT|oPR4_CK|oPR4_CKML|oPR4_CKPF|oPR4_KKA|oPR4_KKP|oPR4_KKS| oPR4_KKS1|oPR4_P

heng0757的专栏 1万+

大语言模型原理与工程实践:行业大语言模型的评测:以金融行业大语言模型为例

大语言模型、金融行业、模型评测、自然语言处理、深度学习、Transformer、BERT、GPT 1. 背景介绍 近年来,大语言模型(Large Language Model,LLM)在自然语言处理(Natural Language Processing,NLP)领域取得了突破性的进

AI大模型应用之禅 136

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

深度学习工具包 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")

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

上一篇: 在ubuntu14下使用eclipse完成伪分布式的WordCound程序
下一篇: MapReduce编程: 2. 矩阵乘法
ye_xiao_dong
博客等级 码龄9年 28粉丝 16原创
评论 4
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值