MapReduce考试代码总结

MapReduce求最大值最小值平均值案例 一、问题描述 学校的学生的是一个非常大的生成数据的集体,比如每次考试的成绩。现有一个班级的学生一个月的考试成绩数据。 科目 姓名 分数 求出每个学生的最高分,平均成绩(整数(不能使用强制类型转换)),最低分。 二、思路介绍 在map阶段将学生姓名作为key,成绩作为value输出; 在reduce阶段进行最大值最小值平均值得求值。 三、代码实现 1、Map阶段 package com.stude... 阅读详情

1. 利用数值概要完成comments数据集的中位数与标准差

package com.hdfsclient;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.util.GenericOptionsParser;
public class MedianStdDevTuple implements Writable{

    private float median = 0;
    private float stdDev=0;
    public float getMedian() {
        return median;
    }

    public void setMedian(float median) {
        this.median = median;
    }

    public float getStdDev() {
        return stdDev;
    }

    public void setStdDev(float stdDev) {
        this.stdDev = stdDev;
    }



    public void readFields(DataInput in) throws IOException{
        median=in.readFloat();
        stdDev=in.readFloat();
    }

    public void write(DataOutput out) throws IOException {
        out.writeFloat(median);
        out.writeFloat(stdDev);
    }

    public String toString(){///重载toString函数定义输出格式
        return median+"\t"+stdDev;
    }

    public static final String[] REDIS_INSTANCES = { "p0", "p1", "p2", "p3",
            "p4", "p6" };

    public static Map<String, String> transformXmlToMap(String xml) {
        Map<String, String> map = new HashMap<String, String>();
        try {
            String[] tokens = xml.trim().substring(5, xml.trim().length() - 3).split("\"");
            for (int i = 0; i < tokens.length - 1; i += 2) {
                String key = tokens[i].trim();
                String val = tokens[i + 1];
                map.put(key.substring(0, key.length() - 1), val);
            }
        } catch (StringIndexOutOfBoundsException e) {
            System.err.println(xml);
        }
        return map;
    }

    public static class MedianStdDevMapper extends Mapper <Object, Text, IntWritable, IntWritable> {
        private IntWritable outHour = new IntWritable();
        //private MedianStdDevTuple outCountAverage = new MedianStdDevTuple();
        private IntWritable outCommentLength = new IntWritable();
        private final static SimpleDateFormat frmt = new SimpleDateFormat ("yyyy-MM-dd'T'HH:mm:ss.SSS");

        public void map (Object key, Text value, Context context)
                throws IOException, InterruptedException {

            Map <String, String> parsed = transformXmlToMap (value.toString());

            String strDate = parsed.get("CreationDate");
            String text = parsed.get("Text");

            Date creationDate=null;
            try {
               creationDate = frmt.parse(strDate);
            } catch (ParseException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            outHour.set(creationDate.getHours());///时间戳

            outCommentLength.set(text.length());

            context.write(outHour, outCommentLength);
        }
    }

    public static class MedianStdDevReducer
            extends Reducer <IntWritable, IntWritable,IntWritable, MedianStdDevTuple> {
        private MedianStdDevTuple result = new MedianStdDevTuple();
        private ArrayList<Float> commentLengths = new ArrayList<Float>();
        public void reduce (IntWritable key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException {
            float sum = 0;
            float count = 0;
            commentLengths.clear();
            result.setStdDev(0);
            for (IntWritable val : values) {
                commentLengths.add((float)val.get());
                sum += val.get();
                count++;
            }
            Collections.sort(commentLengths);
            if(count%2==0){
                result.setMedian((commentLengths.get((int)count/2-1)+commentLengths.get((int)count/2))/2.0f);
            }else{
                result.setMedian(commentLengths.get((int)count/2));
            }
            float mean = sum/count;
            float sumOfSquares = 0.0f;
            for(Float f : commentLengths){
                sumOfSquares+=(f-mean)*(f-mean);
            }
            result.setStdDev((float)Math.sqrt(sumOfSquares/(count-1)));
            context.write(key,result);
        }
    }

    /*============================================================================================================*/
    public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
        Configuration conf = new Configuration();
        //FileUtil.fullyDelete(new File("output7"));
        String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();

        if (otherArgs.length != 2) {
            System.err.println("Usage: mergesort <in> <out>");
            System.exit(2);
        }

        Job job = Job.getInstance();
        job.setJarByClass(MedianStdDevTuple.class);
        job.setMapperClass(MedianStdDevMapper.class);
        job.setReducerClass(MedianStdDevReducer.class);
        job.setOutputKeyClass(IntWritable.class);
        job.setOutputValueClass(MedianStdDevTuple.class);
        FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
        FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));
        System.exit(job.waitForCompletion(true) ? 0 : 1);
    }
}

2. Reduce和分层

Map实现
package four;


import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Partitioner;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;


public class JoinMapper extends Mapper<LongWritable, Text, IntWritable, Text>{
	 
	//定义文件名称标识
	private static final String LEFT_FILENAME = "product_info.txt";
	private static final String RIGHT_FILENAME = "product_quantity.txt";
	
	@Override
	protected void map(LongWritable key, Text value, Context context)
			throws IOException, InterruptedException {
		
		//从输入分片信息中取得文件路径
		//FileSplit 是 抽象类InputSplit 的实现类,记录了文件的具体切片信息。
		String filePath = ((FileSplit)context.getInputSplit()).getPath().toString();
		//文件标识
		String fileFlag = null;
		//输出键(学号)
		String outKey = null;
		//输出值(姓名 或 课程)
		String outValue = null;
		//行记录的信息
		String[] infos = value.toString().split(",");
		
		//判断行记录所来自的文件
		if (filePath.contains(LEFT_FILENAME)) {
			if(infos.length == 22){
				String temp = null;
				fileFlag = LEFT_FILENAME;
				outKey = infos[0];
				temp = infos[1]+"  "+infos[2]+"   "+infos[3];
				outValue = temp;
			}
		} 
		else if (filePath.contains(RIGHT_FILENAME)) {
			if(infos.length == 9 ){
				String temp = null;
				temp = infos[1]+"  "+infos[2]+"   "+infos[3];
				fileFlag = RIGHT_FILENAME;
				outKey = infos[0];
				outValue = temp;
			}
		}
		
		//输出键值对,并在值上标记文件名
		context.write(new IntWritable(Integer.parseInt(outKey)), new Text(outValue + "\t" + fileFlag));
	}
	

	
}

Reduce实现
package four;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;
import org.apache.hadoop.mapreduce.Reducer;


public class JoinReducer extends Reducer<IntWritable, Text, Text, Text>{
	
	
	
	//定义文件名称标识
	private static final String LEFT_FILENAME = "product_info.txt";
	private static final String RIGHT_FILENAME = "product_quantity.txt";
	
        private static int num = 0;
 
	@Override
	protected void reduce(IntWritable key, Iterable<Text> values, Context context)
			throws IOException, InterruptedException {
		
                //计数reduce调用次数,输出key
		{
			num++;
			System.out.println(num + " " +key);
		}
 
		//学生姓名
		String studentName = null;
		//学生课程名数组
		List<String> studentClassNames = new ArrayList<String>();
		
		//根据文件名标识信息,将姓名、课程归类
		for (Text value : values) {
			String[] infos = value.toString().split("\t"); 
			if(LEFT_FILENAME.equals(infos[1])) {
				studentName = infos[0];
			}
			else if (RIGHT_FILENAME.equals(infos[1])){
				studentClassNames.add(infos[0]);
			}
		}
                //去除无法建立内连接的信息
		if (studentName == null || studentClassNames.size() == 0) {
			return;
		}
		
		//将姓名-课程 键值对遍历输出
		for (int i = 0; i < studentClassNames.size(); i++) {
			context.write(new Text(studentName), new Text(studentClassNames.get(i)));
		}
		
	}
 
}

分区实现:
package four;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

public class MyPartitioneryy extends Partitioner<IntWritable, Text> {  
    @Override  
    public int getPartition(IntWritable key, Text value, int numPartitions) {  
        int result = 0;  
        /*********************************************************************/  
        /***key.toString().equals("long")  must use toString()!!!!  ***/  
        /***开始的时候我没有用 ,导致都在一个区里,结果也在一个reduce输出文件中。  ***/  
        /********************************************************************/  
       if (key.get() <= 1000) {
		result = 0;
	   }
       else if (key.get() <= 2000) {
		result = 1;
	}
       else if (key.get() <= 3000) {
		result = 2;
	} else {
result = 3;
	}
       
        return result;  
    }  
} 
驱动
package four;



import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.GenericOptionsParser;


import two.MyPartitioner;
import two.MyPartitioner.MyPartitionerMap;
import two.MyPartitioner.MyPartitionerPar;
import two.MyPartitioner.MyPartitionerReduce;
 
/*
 * join的驱动类
 */
public class MR_Join {
 
	public static void main(String[] args) throws Exception {  
        Configuration conf = new Configuration();  
        String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();  
        if (otherArgs.length != 2) {  
            System.err.println("Usage: MyPartitioner <in> <out>");  
            System.exit(2);  
        }
        conf.set("mapred.jar","mp1.jar");
        Job job = new Job(conf, "MyPartitioner");  
        job.setNumReduceTasks(4); 

        job.setJarByClass(MR_Join.class); 
        job.setMapperClass(JoinMapper.class); 
        job.setMapOutputKeyClass(IntWritable.class);  
        job.setMapOutputValueClass(Text.class);  
          
        job.setPartitionerClass(MyPartitioneryy.class);  //
        job.setReducerClass(JoinReducer.class);  
          
        job.setOutputKeyClass(Text.class);  
        job.setOutputValueClass(Text.class);  
          
        FileInputFormat.addInputPath(job, new Path(otherArgs[0]));  
        FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));  
        System.exit(job.waitForCompletion(true) ? 0 : 1);  
    }  
}


3分箱

package binning;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.StringEscapeUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.output.MultipleOutputs;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;

public class shijian5 {
public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {

Configuration conf = new Configuration();
Job job = new Job(conf, "binningByTag");

job.setJarByClass(BinningByTags.class);
job.setMapperClass(BinningByTagsMapper.class);
FileInputFormat.setInputPaths(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
MultipleOutputs.addNamedOutput(job, "bins", TextOutputFormat.class, Text.class, NullWritable.class);
MultipleOutputs.setCountersEnabled(job, true);
job.setNumReduceTasks(0);
job.waitForCompletion(true);

}

public static class BinningByTagsMapper extends Mapper<Object, Text, Text, NullWritable> {

private MultipleOutputs<Text, NullWritable> mos = null;

protected void setup(Context context) {
// Create a new MultipleOutputs using the context object
mos = new MultipleOutputs<Text, NullWritable>(context);
}

public void map(Object text, Text value, Context context) throws IOException, InterruptedException {

String datas[] = value.toString().split("\t");

String tag = datas[2];
if (tag.equalsIgnoreCase("hadoop")) {
mos.write("bins", value, NullWritable.get(), "hadoop-tag");
}
else if (tag.equalsIgnoreCase("hive")) {
mos.write("bins", value, NullWritable.get(), "hive-tag");
}
else if (tag.equalsIgnoreCase("pig")) {
mos.write("bins", value, NullWritable.get(), "pig-tag");
}
else if (tag.equalsIgnoreCase("hbase")) {
mos.write("bins", value, NullWritable.get(), "hbase-tag");
}
else{
mos.write("bins", value, NullWritable.get(), "other");
}
}

protected void cleanup(Context context) throws IOException, InterruptedException {
// Close multiple outputs otherwise you will not get any values
mos.close();
}

}

}

4倒排索引

import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
public class InvertedIndexMapper extends Mapper<Text, Text, Text, Text> 
{	@Override
	protected void map(Text key, Text value, Context context)  
			throws IOException, InterruptedException 
// default RecordReader: LineRecordReader;     key: line offset;     value: line string
	{	FileSplit fileSplit = (FileSplit)context.getInputSplit();
		String fileName = fileSplit.getPath().getName();
		Text word = new Text();
		Text fileName_lineOffset = new Text(fileName+”@”+key.toString());
		StringTokenizer itr = new StringTokenizer(value.toString());
		for(; itr.hasMoreTokens(); ) 
		{      word.set(itr.nextToken());
		        context.write(word, fileName_lineOffset);
		}
	}
}

import java.io.IOException;
import java.util.Collections;
import java.util.Iterator;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
public class InvertedIndexReducer extends Reducer<Text, Text, Text, Text> 
{	@Override
	protected void reduce(Text key, Iterable<Text> values, Context context)
			throws IOException, InterruptedException 
 	{	Iterator<Text> it = values.iterator();
		StringBuilder all = new StringBuilder();
		if(it.hasNext()) 
          all.append(it.next().toString());
		for(; it.hasNext(); ) 
		{	all.append(“;");
			all.append(it.next().toString());					}
		context.write(key, new Text(all.toString()));
	} 
}

5.笛卡尔积Reduce实现

package com.hadoop.reducejoin.test;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.GenericOptionsParser;

/*
 * 两个大表
 * 通过笛卡尔积实现 reduce join
 * 适用场景:两个表的连接字段key都不唯一(包含一对多,多对多的关系)
 */
public class ReduceJoinByCartesianProduct {
    /**
    为来自不同表(文件)的key/value对打标签以区别不同来源的记录。
    然后用连接字段作为key,其余部分和新加的标志作为value,最后进行输出。
    */
    public static class ReduceJoinByCartesianProductMapper extends Mapper<Object,Text,Text,Text>{
        private Text joinKey=new Text();
        private Text combineValue=new Text();
        
        @Override
        protected void map(Object key, Text value, Context context) throws IOException, InterruptedException {
            String pathName=((FileSplit)context.getInputSplit()).getPath().toString();
            //如果数据来自于records,加一个records的标记
            if(pathName.endsWith("records.txt")){
                String line = value.toString();
                String[] valueItems = line.split("\\s+");
                //过滤掉脏数据
                if(valueItems.length!=3){
                    return;
                }
                joinKey.set(valueItems[0]);
                combineValue.set("records.txt" + valueItems[1] + "\t" + valueItems[2]);
            }else if(pathName.endsWith("station.txt")){
                //如果数据来自于station,加一个station的标记
                String line = value.toString();
                String[] valueItems = line.split("\\s+");
                //过滤掉脏数据
                if(valueItems.length!=2){
                    return;
                }
                joinKey.set(valueItems[0]);
                combineValue.set("station.txt" + valueItems[1]);
            }
            context.write(joinKey,combineValue);
        }
    }
    /*
     * reduce 端做笛卡尔积
     */
     public static class ReduceJoinByCartesianProductReducer extends Reducer<Text,Text,Text,Text>{
            private List<String> leftTable=new ArrayList<String>();
            private List<String> rightTable=new ArrayList<String>();
            private Text result=new Text();
            @Override
            protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {
                //一定要清空数据
                leftTable.clear();
                rightTable.clear();
                //相同key的记录会分组到一起,我们需要把相同key下来自于不同表的数据分开,然后做笛卡尔积
                for(Text value : values){
                    String val=value.toString();
                    if(val.startsWith("station.txt")){
                        leftTable.add(val.replaceFirst("station.txt",""));
                    }else if(val.startsWith("records.txt")){
                        rightTable.add(val.replaceFirst("records.txt",""));
                    }
                }
                //笛卡尔积
                for(String leftPart:leftTable){
                    for(String rightPart:rightTable){
                        result.set(leftPart+"\t"+rightPart);
                        context.write(key, result);
                    }
                }
            }
        }
     
     public static void main(String[] arg0) throws Exception{
            Configuration conf = new Configuration();
            String[] args = {"hdfs://sparks:9000/middle/reduceJoin/records.txt"
                    ,"hdfs://sparks:9000/middle/reduceJoin/station.txt"
                    ,"hdfs://sparks:9000/middle/reduceJoin/JoinByCartesian-out"
            };
            String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
            if (otherArgs.length < 2) {
                System.err.println("Usage: reducejoin <in> [<in>...] <out>");
                System.exit(2);
            }
            
            //输出路径
            Path mypath = new Path(otherArgs[otherArgs.length - 1]);
            FileSystem hdfs = mypath.getFileSystem(conf);// 创建输出路径
            if (hdfs.isDirectory(mypath)) {
                hdfs.delete(mypath, true);
            }
            Job job = Job.getInstance(conf, "ReduceJoinByCartesianProduct");
            job.setJarByClass(ReduceJoinByCartesianProduct.class);
            job.setMapperClass(ReduceJoinByCartesianProductMapper.class);
            job.setReducerClass(ReduceJoinByCartesianProductReducer.class);
            job.setOutputKeyClass(Text.class);
            job.setOutputValueClass(Text.class);
            //添加输入路径
            for (int i = 0; i < otherArgs.length - 1; ++i) {
                FileInputFormat.addInputPath(job, new Path(otherArgs[i]));
            }
            //添加输出路径
            FileOutputFormat.setOutputPath(job,
                    new Path(otherArgs[otherArgs.length - 1]));
            System.exit(job.waitForCompletion(true) ? 0 : 1);
        }
}

ReduceJoinByCartesianProduct
MapReduce学生成绩分类案例 一、问题描述 学校的学生的是一个非常大的生成数据的集体,比如每次考试的成绩,现有一个班级的学生一个月的考试成绩数据。 科目 姓名 分数 求出每门成绩中属于甲级的学生人数和总人数,乙级的学生人数和总人数,丙级的学生人数和总人数。 甲级(90及以上) 乙级(80到89) 丙级(0到79) 处理数据结果:课程\t甲级\t学生1,学生2,…\t总人数 二、思路介绍 map阶段将课程名和等级拼接为key,... 阅读详情

相关推荐

Hadoop期末考试题

1 目前,Hadoop的最高版本是哪个? (2.0分)2.0 分 A、 Hadoop3.x B、 Hadoop2.x C、 Hadoop4.x D、 Hadoop1.x 正确答案: A 2大数据的4V特征是指?(2.0分) A、 数据量大(Volume)、类型繁多(Variety)、价值密度低(Value)、技术发展速度快(Velocity) B、 数据量大(Volume)、类型繁多(Variety)、价值密度低(Value)、处理速度快(Velocity) C、 数据量大(Volume)、类型繁多(Var

weixin_44033192的博客 2万+

MapReduce案例(五)

/分区规则,根据订单ID实现分区/**** @param text v2(一行的文本数据)* @param i ReduceTask个数* @return 分区编号*/@Override//根据订单id进行分区。

weixin_37901366的博客 2394

Hadoop:一文详解MapReduce的工作机制

Hadoop MapReduce是一个软件框架,基于该框架能够容易地编写应用程序,这些应用程序能够运行在由上千个商用机器组成的大集群上,并以一种可靠的,具有容错能力的方式并行地处理上TB级别的海量数据集。这个定义里面有着这些关键词,一是软件框架,二是并行处理,三是可靠且容错,四是大规模集群,五是海量数据集。因此,对于MapReduce,可以简洁地认为,它是一个软件框架,海量数据是它的“菜”,它在大规模集群上以一种可靠且容错的方式并行地“烹饪这道菜”。

Machine Learning with Tutors 7379

大数据面试之MapReduce常见题目

大数据面试之MapReduce常见题目 MapReduce中Shuffle过程及优化 1.1 Shuffle的详细图解 1.2 Shuffle的详细文字过程 1.3 Shuffle优化

luoyepiaoxue2014的博客 1030

防火墙旁挂组网

分析拓扑结构,涉及路由器、交换机、防火墙。步骤包括基础 IP 配置、OSPF、防火墙双机热备、安全策略等。第一步,路由器配置。R5、R6 连接 ISP 和核心交换机,配置接口 IP,然后 OSPF。然后防火墙,双机热备的 HRP、VRRP,还有安全策略。接着交换机,划分 VLAN,配置 TRUNK,加入 OSPF。

weixin_73298423的博客 901

解决UNITE数据库注释高unassigned率:手把手教你训练专属真菌分类器(含预训练模型分享)

本文针对使用UNITE数据库进行真菌ITS序列注释时出现的高未分配率问题,提供了详细的实战解决方案。通过对比vsearch直接注释与Naive Bayes分类器的原理差异,文章手把手指导读者在QIIME 2环境中训练专属分类器,包括数据准备、模型训练、参数优化及效果验证,并分享了预训练模型,旨在显著提升真菌群落分析的注释准确性和数据利用率。

weixin_29214199的博客 338

大数据技术原理——期末复习mapreduce

复习

m0_46493223的博客 1782

【图形学】后处理下的HDR、颜色分级、颜色映射与颜色空间

目录 一、Color Grading 1.1概念 1.2 内置在Unity/UE4 二、HDR、LDR与VDR 2.1 LDR 2.2 HDR 2.3 VDR 三、Tone Mapping 3.1 概念 3.2 算法发展史 3.3 ACES算法 四、常见的颜色空间标准 参考 一、Color Grading 1.1概念 Color Grading(颜色分级、颜色校正)俗称调色,是游戏后期处理中最常见也是必要的一个环节。它能够改变或矫正最终图像的颜色和亮度,你可以把它想象...

ColorGalaxy 8417

MapReduce理论测试题

C MapReduce过程中Map阶段每个Map任务的输出结果默认不是按照key排序的,需进一步编程进行排序。B MapReduce计算过程中,相同的key默认会被发送到同一个reduce task处理。C Value类必须实现WritableComparable。A MapReduce适于PB级别以上的海量数据在线处理。D MapReduce隐藏了并行计算的细节,方便使用。B 文件切分的数据块个数C 计算机计算能力。C 将申请的资源分配给内部任务。C 将申请的资源分配给内部任务。

m0_63307477的博客 2019

基于航天宏图PIE-SAR软件的高分三号(GF-3)SAR影像的预处理

软件官网 航天宏图—国内领先的卫星运营与应用服务提供商(官网) 一、数据导入 数据导入-GF-3-根据模式选择 参数文件导入解压后GF-3数据的XML文件 通道自动填充 设置输出目录 确定 等待,加载图像、自动构建金字塔 二、复数数据转换 强度/幅度特征是SAR影像最主要的特征之一,基于SAR强度/幅度影像可以提取地物目标信息,因此需要将SAR复数数据转换为SAR强度/幅度数据。导入输入影像,设置参数类型,输出目录、命名、类型; 漫长的等待 三、多视 为提...

weixin_52127098的博客 9002

机械臂的运动学分析-工业机器人

机械臂的运动学是研究机械臂各连杆坐标系之间的运动关系,是对机械臂进行运动控制的基础。本章分析了所设计的六自由度机械臂的运动学。理论上六自由度机械臂的工作空间是一个近似球形区域,能够覆盖机械臂所在的位置,但由于机械臂关节的运动范围受到限制,机械臂末端会存在一些不能到达的工作死区,使得机械臂的工作范围和灵活性受到限制。理论上六自由度机械臂的工作空间是一个近似球形区域,能够覆盖机械臂所在的位置,但由于机械臂关节的运动范围受到限制,机械臂末端会存在一些不能到达的工作死区,使得机械臂的工作范围和灵活性受到限制。

qq_59137727的博客 6647

mapreduce编程初探

1.map和reduce 1.1 mapReduce处理逻辑 在本系列文章的第一篇中,曾对MapReduce原理做过简单的描述,在这里再重述一遍。  首先我们有两个文件word1.txt和word2.txt  其中word1.txt的内容如下: aaaa bbbb cccc dddd aaaa word2.txt的内容如下: aaaa cccc dddd eeee aaaa 这...

牛逸凡的博客 8156

2025最新!视频动作识别算法的前沿研究与论文解读

2025最新!视频动作识别算法的前沿研究与论文解读 ,人工智能,计算机视觉,大模型,AI,本文聚焦2025年视频动作识别算法前沿,先介绍其定义、意义及核心挑战,再阐述传统与深度学习方法。还解读了基于Transformer、轻量化、跨模态融合和半监督学习的前沿研究,解释关键概念,列举常用数据集、评价指标,分析当前问题与未来趋势,为该领域研究提供全面参考。

不踩坑,不知道坑有多深;不总结,踩过的坑白踩。 7万+

(超详细)MapReduce工作原理及基础编程

MapReduce编程基础 JunLeon——go big or go home 前言: Google于2003年在SOSP上发表了《The Google File System》,于2004年在OSDI上发表了《MapReduce: Simplified Data Processing on Large Clusters》,于2006年在OSDI上发表了《Bigtable: A Distributed Storage System for Structured Data》。这三篇论文...

JunLeon的博客 8万+

【RT-DETR涨点改进】独家小目标涨点改进篇 | TGRS 2025 | RT-DETR引入ABRNet小目标检测顶刊中的:ARF自适应性感受野和MCA双向交叉轴注意力,适合小目标检测有效涨点

本文提出了一种改进的RT-DETR小目标检测方法,通过集成自适应感受野模块(ARF)和多尺度交叉轴注意力模块(BC)来提升检测性能。ARF模块采用多种卷积核动态调整感受野,有效捕获多尺度目标特征并减少背景干扰;BC模块通过多尺度交叉轴注意力机制增强全局信息提取和特征融合能力。实验表明,该方法在复杂背景下显著提升了红外小目标检测的精度和效率,同时降低了计算开销。文章详细介绍了模块结构、原理及实现代码,并提供了多种改进配置方案,为小目标检测任务提供了有效的解决方案。

Ai缝合怪、助力小伙伴高效发论文 570

第 5 篇:责任链模式 (Chain of Responsibility) —— 协议栈的流水线

本文介绍了责任链模式在嵌入式通信协议解析中的应用。针对传统"面条式"代码维护困难的问题,提出将各协议解析器解耦为独立处理单元,通过链表形式串联。文章详细展示了模式实现:定义抽象处理者接口、实现具体协议处理器、构建链表管理器。该方案具有内存占用低(O(1)栈空间)、可动态扩展、支持优先级调整等优势,并探讨了性能优化策略及动态插件系统等扩展应用,为嵌入式通信协议处理提供了清晰的架构方案。

一路往蓝-Anbo 的博客 176

MapReduce--13--学生成绩(增强版)--需求2

题目描述 关于对于学生成绩相关的练习题,之前是一个入门级别的需求,现在对这些需求进行增强,首先看数据的改变: computer,huangxiaoming,85,86,41,75,93,42,85 computer,xuzheng,54,52,86,91,42 computer,huangbo,85,42,96,38 english,zhaobenshan,54,52,86,91,42,85...

好学若饥,谦卑若愚 1万+

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

MapReduce--12--学生成绩(增强版)--需求1

题目描述 关于对于学生成绩相关的练习题,之前是一个入门级别的需求,现在对这些需求进行增强,首先看数据的改变: computer,huangxiaoming,85,86,41,75,93,42,85 computer,xuzheng,54,52,86,91,42 computer,huangbo,85,42,96,38 english,zhaobenshan,54,52,86,91,42,85...

好学若饥,谦卑若愚 1万+

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

MapReduce--14--学生成绩(增强版)--需求3

题目描述 关于对于学生成绩相关的练习题,之前是一个入门级别的需求,现在对这些需求进行增强,首先看数据的改变: computer,huangxiaoming,85,86,41,75,93,42,85 computer,xuzheng,54,52,86,91,42 computer,huangbo,85,42,96,38 english,zhaobenshan,54,52,86,91,42,85...

好学若饥,谦卑若愚 1万+

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

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

mapreduce------学生成绩(六)

知识准备 reducer类的操作对象是分区,一个分区初始化一次reducer类。reduce()函数的操作对象是组,一个分区中有几个分组就调用几次reduce()函数。 分组默认采用通过比较键的方式来实现。当自定义组合键时,往往需要根据组合键中的某一个属性进行分组统计,此时就用到自定义分组类。通过重写其中的compare()方法定义分组规则。 分组前先对合并后的分区文件中的记录进行排序,排序后再...

weixin_42871236的博客 566

自定义InputFormat格式统计学生的平均成绩和总成绩

一、详情介绍 有时候 Hadoop 自带的输入格式,并不能完全满足业务的需求,所以需要根据实际情况自定义 InputFormat 类。而数据源一般都是文件数据,因此自定义 InputFormat时继承 FileInputFormat 类会更为方便,不必考虑如何分片等复杂操作。 自定义输入格式一般分为以下几步: 1、继承 FileInputFormat 基类。 2、重写 FileInpu

ZoeYen_ 828

mapreduce复制连接的代码_MapReduce练习

源代码在我的github上:https://github.com/Anonymoushhh/mapreduce_test有需要的可以自取,记得帮我点个星星 问题描述 在关系代数中,自然连接(Natural join)是一种特殊的等值连接,它要求两个关系中进行比较的分量必须是相同的属性组,并且在结果中把重复的属性列去掉。 根据给定的数据《student.xlsx》和《stud...

weixin_39718521的博客 167

Hadoop MapReduce原理及实例

MapReduce是用于数据处理的一种编程模型,简单但足够强大,专门为并行处理大数据而设计。1. 通俗理解MapReduceMapReduce的处理过程分为两个步骤:map和reduce。每个阶段的输入输出都是key-value的形式,key和value的类型可以自行指定。map阶段对切分好的数据进行并行处理,处理结果传输给reduce,由reduce函数完成最后的汇总。例如从大量历史数据中找出往年

Spring , Hadoop, Spark , BI , ML 4万+

MapReduce自定义序列化对象

任务 1原始数据中一行内容为一个学生的考试成绩信息,主要包括学号和成绩(第一个字段为学号,其余的都是这个同学的分数,可能有多个分数,用空格隔开)。 1001 85 87 91 93 85 77 1002 88 85 87 1003 78 73 83 88 1004 76 65 1005 73 91 86 88 根据上面的数据发现,每个学生的考试次数不一样,譬如学号1001的同学有6次成绩,而学号1...

weixin_45066966的博客 474

基于MapReduce的手机流量统计

以上为MapReduce的代码,之后的执行结果在集群中查看,查看位置为 hadoop调用jar包将数据源文件处理后的文件存放位置。

Zxmmy_77的博客 523

Spark考试题总结

一.选择判断 1.单选 下面哪个不是 RDD 的特点 ( ) A.可分区 B.可序列化 C.可修改 D.可持久化 关于累加器,下面哪个是错误的 ( ) A.支持加法 B.支持数值类型 C.可并行D.不支持自定义类型 Scala语言中,以下说法正确的是() A.常量和变量都可以不用赋初始值 B.常量需要赋初始值,变量可以不用赋初始值C.常量和变量都需要赋初始值 D.常量不需要赋初始值,变量必须赋初始值 下面对MapReduce描述错误的是( ) A. 适合离线批处理 B. 具有很好的容...

XIAOMO__的博客 2万+
上一篇: Hbase安装(使用自带的ZooKeeper)
下一篇: 技术人员必会英语单词
Re:fused
博客等级 码龄9年 474粉丝 162原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值