Linux. Hadoop Hbase & MapReduce

Hadoop、MapReduce、Spark 优缺点优点:1.易于编程 — 底层实现了接口2.良好的扩展性 — 可增加节点3.高容错性 — 保证任务的完成4.适合PB级别以上的海量数据的离线处理 — 可实现服务器内节点并发工作缺点:1.不擅长实时计算 — 无法做到毫秒或者秒级内返回结果2.不擅长流式计算 — MR 的输入数据集是静态的,流式计算的输入数据是动态的3.不擅长DAG(有向图)计算 — 不建议使用,会导致MR一直写入到磁盘造成大量磁盘IO,影响性能整体架构流程。 阅读详情
  • Using Map Reduce to read/write table in HBase

install Hadoop & Hbase

install hadoop

  • install hadoop tutorial -> link
  • some questions I met and solutions I found -> link

install hbase

  • suppose you already have ‘hbase-1.3.0-src.tar.gz’ -> link

  • unzip hbase-1.3.0-bin.tar.gz to /usr/local

sudo tar zxvf hbase-1.3.0-bin.tar.gz -C /usr/local
  • rename to ‘hbase’
sudo mv /usr/local/hbase-1.3.0/ /usr/local/hbase/
  • modify file permissions (specifically speaking, modify the owner of ‘hbase’, after that you don’s hava to ‘sudo’ or enter password or meet many other problems)
sudo chown -R your_user_name /usr/local/hbase/
  • Set the environment variable
sudo vim /etc/profile
//then append the following content
#set hbase path
export PATH=$PATH:/usr/local/hbase/bin
  • enable the environment variable (only works in the current shell if you modify /ect/profile and ‘source’ it)
source /etc/profile
  • configure hbase
vim /usr/local/hbase/conf/hbase-env.sh
//append content
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_101
export HBASE_MANAGES_ZK=true
vim /usr/local/hbase/conf/hbase-site.xml
//add this <property>s in <configuration>
<property>
        <name>hbase.rootdir</name>
        <value>hdfs://localhost:9000/hbase</value>
</property>
<property>
        <name>hbase.cluster.distributed</name>
        <value>true</value>
</property>
  • start hbase (make sure hadoop was started)

    • using shell command ‘jps’ to list all the java process running on this PC
    • after successfully starting hadoop, you will see ‘NameNode’ ‘DataNode’ ‘SecondaryNameNode’ ‘NodeManager’ ‘ResourceManager’ via ‘jps’ command
    • then hbase, ‘HMaster’ ‘HRegionServer’
  • enter hbase shell

/usr/local/hbase/bin/hbase shell
2017-03-26 23:29:47,401 WARN  [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hbase/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.3.0, re359c76e8d9fd0d67396456f92bcbad9ecd7a710, Tue Jan  3 05:31:38 MSK 2017

hbase(main):001:0>  list
TABLE                                                                                 
Course                                                                                
SC                                                                                    
Student                                                                               
person                                                                                
test1                                                                                 
test2                                                                                 
6 row(s) in 0.2590 seconds

=> ["Course", "SC", "Student", "person", "test1", "test2"]
hbase(main):002:0> scan 'test1'
ROW                    COLUMN+CELL                                                    
 s01                   column=name:, timestamp=1490498667244, value=book1             
 s01                   column=price:, timestamp=1490498677562, value=20               
 s02                   column=name:, timestamp=1490498687903, value=book2             
 s02                   column=price:, timestamp=1490498695027, value=30               
 s03                   column=name:, timestamp=1490498707093, value=book3             
 s03                   column=price:, timestamp=1490498702665, value=25               
3 row(s) in 0.1630 seconds

hbase(main):003:0> 
  • using hbase shell -> link

install Eclipse and Hadoop-plugins

这里写图片描述


Using Hadoop and Its Java API

  • hadoop shell command ( FileSystem Shell )-> link

  • java API docs for hadoop -> link

  • examples

/*
 * using javaAPI to implement command line : ls
 */
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import java.io.*;
import java.text.SimpleDateFormat;

 public static void main(String[] args) {
     try {
         Configuration conf = new Configuration();
         conf.set("fs.default.name","hdfs://localhost:9000");
         String remoteFilePath = "/user/username/asd.txt";    // HDFS path
         FileSystem fs = FileSystem.get(conf);
         Path remotePath = new Path(remoteFilePath);
         FileStatus[] fileStatuses = fs.listStatus(remotePath); //ls
         for (FileStatus s : fileStatuses) {
             System.out.println("Path: " + s.getPath().toString());
             System.out.println("Auth: " + s.getPermission().toString());
             System.out.println("Size: " + s.getLen());
             /* convert timrstramp to normal data time */
             long timeStamp = s.getModificationTime();
             SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             String date = format.format(timeStamp);  
             System.out.println("Time: " + date);
         }
         fs.close();
     } catch (Exception e) {
         e.printStackTrace();
     }
 }
/*
 * cat
 */
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import java.io.*;


Configuration conf = new Configuration();
conf.set("fs.default.name","hdfs://localhost:9000");
String remoteFilePath = "/user/username/asd.txt";    // HDFS path

FileSystem fs = FileSystem.get(conf);
Path remotePath = new Path(remoteFilePath);
FSDataInputStream in = fs.open(remotePath);
BufferedReader d = new BufferedReader(new InputStreamReader(in));
String line = null;
while ( (line = d.readLine()) != null ) {
    System.out.println(line);
}
d.close();
in.close();
fs.close();

Using Hbase and Its Java API

  • using hbase shell -> link

  • java API docs for hbas -> link

  • examples

/*
 * implement hbase shell command : scan
 * print content of a table
 */
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.client.*;
import org.apache.hadoop.hbase.*;

//publi static attribute
Configuration configuration;    //public static
Connection connection;          //public static
Admin admin;                    //public static

//init
configuration = HBaseConfiguration.create();
configuration.set("hbase.rootdir", "hdfs://localhost:9000/hbase");
connection = ConnectionFactory.createConnection(configuration);
admin = connection.getAdmin();

//scan
Table table = connection.getTable(TableName.valueOf(tableName));
Scan scan = new Scan();
ResultScanner scanner = table.getScanner(scan);
for (Result result : scanner) {
     for(Cell cell : result.rawCells() ){
         System.out.print("row : "+new String(CellUtil.cloneRow(cell)));
         System.out.print("col family: "+new String(CellUtil.cloneFamily(cell)));
         System.out.print("col qualifier: "+new String(CellUtil.cloneQualifier(cell)));
         System.out.print("value: "+new String(CellUtil.cloneValue(cell)));
         System.out.println("timestamp : "+cell.getTimestamp());
     }
}

//close
admin.close();
connection.close();

MapReduce with file stored in your PC’s fs

  • official tutorial -> link

  • classical example ‘wordcount’

import java.io.IOException;
import java.util.StringTokenizer;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
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.output.FileOutputFormat;

public class WordCount {

  public static class TokenizerMapper
       extends Mapper<Object, Text, Text, IntWritable>{
    /*
     * extends Mapper<Type_Key_In, Type_Value_In, Type_Key_Out, Type_Value_Out>
     * @Type_Key_In      type of input key from source data
     * @Type_Value_In    type of input value from source data
     * @Type_Key_Out     type of output key to intermediate data
     * @Type_Value_Out   type of output value to intermediate data
     */

    private final static IntWritable one = new IntWritable(1);
    private Text word = new Text();

    /* 
     * this is an override function works as callback function
     * for each key-value pair
     * this function will be called to processing it
     * using @context to write intermediate data which is also formated as key-value 
     * the intermediate data will be the reducer's input
     * so, it is IMPROTENT to make sure that
     * map's Type_Key_Out == reduce's Type_Key_In
     * map's Type_Value_Out == reduce's Type_Value_In
     */
    public void map(Object key, Text value, Context context
                    ) throws IOException, InterruptedException {
      StringTokenizer itr = new StringTokenizer(value.toString());
      while (itr.hasMoreTokens()) {
        word.set(itr.nextToken());
        context.write(word, one);    //key = "word" value = 1
      }
    }
  }

  public static class IntSumReducer
       extends Reducer<Text,IntWritable,Text,IntWritable> {
    /*
     * extends Reducer<Type_Key_In, Type_Value_In, Type_Key_Out, Type_Value_Out>
     * @Type_Key_In      type of input key from intermediate data
     * @Type_Value_In    type of input value from intermediate data
     * @Type_Key_Out     type of output key to desitination data
     * @Type_Value_Out   type of output value to desitination data
     */

    private IntWritable result = new IntWritable();

    /* 
     * this is an override function works as callback function too
     * for each value which has the same key
     * they will be Organized into key-values
     * which means that one key was associated with many values
     * for each key-values, this function will be called to process
     * so the source data was divided by different key
     * and processed by many recude() function
     * using @context to write result
     * /
    public void reduce(Text key, Iterable<IntWritable> values,
                       Context context
                       ) throws IOException, InterruptedException {
      int sum = 0;
      for (IntWritable val : values) {
        sum += val.get();
      }
      result.set(sum);
      context.write(key, result);
    }
  }

  public static void main(String[] args) throws Exception {
    Configuration conf = new Configuration();
    Job job = Job.getInstance(conf, "word count");
    job.setJarByClass(WordCount.class);

    job.setMapperClass(TokenizerMapper.class);
    //job.setCombinerClass(IntSumReducer.class);
    job.setReducerClass(IntSumReducer.class);

    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(IntWritable.class);

    FileInputFormat.addInputPath(job, new Path(args[0]));
    FileOutputFormat.setOutputPath(job, new Path(args[1]));

    System.exit(job.waitForCompletion(true) ? 0 : 1);
  }
}

MapReduce with Hbase

  • for Hbase, there are specialized ‘mapper’ and ‘reducer’ to inherit
  • TableMapper -> link
  • TableReducer -> link
  • official example -> link

  • suppose there is a table named ‘bookstore’ in hbase and it has two column ‘name’ and ‘price’

hbase shell > create 'bookstore','name','price'
hbase shell > put 'bookstore','s01','name','book1'
hbase shell > put 'bookstore','s01','price','20'

TableMapper

class HBaseSortMapper extends TableMapper<Text, Text>{
/*
 * extends TableMapper<Type_Key_Out, Type_Value_Out>
 * input from table, so we don't need Type_Key_In and Type_Value_In
 * /
    public void map(ImmutableBytesWritable row, Result value, Context context)
            throws IOException, InterruptedException {
        /*
         * @row : byte[] row_name
         * @value: Result value_of_this_row
         *         using getValue() to get each column value
         * @context: to write intermediate data
         * /

        // getValue(byte[] family, byte[] qualifier)
        // @family : colunm name
        // http://hbase.apache.org/0.94/book/columnfamily.html
        byte[] name_bytes = value.getValue("name".getBytes(), null );
        if(name_bytes == null){
            System.out.println("MAP cannot find_name");
        }
        String name = new String ( name_bytes );
        System.out.println("MAP_get_name : " + name);

        byte[] price_bytes = value.getValue("price".getBytes(), null);
        if(price_bytes == null){
            System.out.println("MAP cannot find_price");
        }
        String price = new String ( price_bytes );
        System.out.println("MAP_get_price : " + price);

        context.write(new Text("sort"), new Text(name + "-" + price) );
    }
}

TableReducer

class HBaseSotrReducer extends TableReducer<Text, Text, ImmutableBytesWritable>{
/*
 * extends TableReducer<Type_Key_In, Type_Value_In, Type_Output>
 * TableReducer's Type_Key_In == TableMapper's Type_Key_Out
 * TableReducer's Type_Value_In == TableMapper's Type_Value_Out
 * /
    public void reduce(Text key, Iterable<Text> values, Context context)
        throws IOException, InterruptedException {
        /*
         * @key: key word, in this example, key = "sort"
         * @values: set of value writed by context in TableMapper
         * @context: used to output
         * /

        HashMap<Integer,String> map_name = new HashMap<Integer,String>();  //store
        LinkedList<Integer> list_price = new LinkedList<Integer>();

        for (Text val : values) {
            String[] val_str_words = val.toString().split("-");  
            //value format : name-price

            String name = val_str_words[0];
            String price_str = val_str_words[1];
            int price = Integer.parseInt( price_str );

            System.out.println("reduce_value : " + name + " " + price );

            list_price.add(price);
            map_name.put(price, name);
        }

        Collections.sort(list_price);  //cannot sort correctly
                                       //when there are books
                                       //which have different name & same price
                                       //if using HashMap<price, name>
        int i = 0;
        for(; i < list_price.size(); ++i){
            int p = list_price.get(i);
            String n = map_name.get(p);
            System.out.println("put " + n + " " + p);
            Put put = genPut(n,p);      //using 'Put' to write data into Hbase
            // https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Put.html
            context.write(null, put);
        }

    }

    private static int count = 0;

    public Put genPut(String name,int price){  //get Put
        String key = "S" + Integer.toString( count++ );
        Put put = new Put( Bytes.toBytes( key.toString() ) );
        put.addColumn("name".getBytes(), null, name.getBytes());
        put.addColumn("price".getBytes(), null, Integer.toString(price).getBytes());
        return put;
    }

}

Driver

class HBaseSortDriver{
    public HBaseSortDriver(){ }

    public int run(String[] args)
        throws IllegalArgumentException, IOException, 
        ClassNotFoundException, InterruptedException{

        System.out.println("MapReduce started.");

        Configuration conf = new Configuration();

        Job job = Job.getInstance( conf , "HBaseSortDriver");

        job.setJarByClass(MyDriver.class);
        job.setMapperClass(HBaseSortMapper.class);  //mapper
        job.setReducerClass(MyReducer.class);       //recuder
        //job.setCombinerClass(MyCombiner.class);   //combiner
                                                    //which is not needed
                                                    //because there is only one reducer

        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(Text.class);

        //input from file
        //FileInputFormat.addInputPath(job, new Path(args[0]));         
        //output to file
        //FileOutputFormat.setOutputPath(job, new Path(args[1]));       

        Scan scan = new Scan();
        scan.setCaching(500);        // 1 is the default in Scan, which will be bad for MapReduce jobs
        scan.setCacheBlocks(false);  // don't set to true for MR jobs
        TableMapReduceUtil.initTableMapperJob(
            "test1",                      // input HBase table name
            scan,                         // Scan instance
            HBaseSortMapper.class,        // mapper
            Text.class,                   // mapper output key
            Text.class,                   // mapper output value
            job);

        TableMapReduceUtil.initTableReducerJob(
                "test2",                  // output HBase table name
                HBaseSotrReducer.class,   //reducer
                job);

        return job.waitForCompletion(true)?0:1;
    }
}
透过Hadoop,Spark,mapreduce,Linux简单操作介绍来了解沉鱼落雁闭月羞花倾国倾城的我 一、介绍Hadoop基础知识一、介绍Hadoop基础知识1.Hadoop是什么Hadoop是一个由Apache基金会所开发的开源分布式系统基础架构,hadoop完全分布式集群用来对数据存储和分析计算。(1)高可靠性:(2)高扩展性:在集群间分配任务数据,可方便的扩展数以千计的节点。(3)高效性:在MapReduce的思想下,Hadoop是并行工作的,以加快任务处理速度。(4)高容错性:能够自动将失败的任23务重新分配。 阅读详情

相关推荐

hadoop基础知识hbase的协同服务 应用程序协调hbase怎么存储的

目录 考试来源看看课件 hadoop核心 hadoop 从hdfs中集群节点两类 分布式原语操作 spark用什么语言实现 Scala特点 spark和mapreduce 区别 安装java 环境变量 集群之间实现无密码登录安装 linux 用户分为两类 mapredece 将map结果给reduce过程叫什么:多对多的分发 mapreduce 继承什么函数 mapreduce 的combiner作用 linux主目录是什么 linux 补全代码 hbase的协同服务 应用.

ZhangJiqun&191cm&85kg 3064

NoClassDefFoundError: org/apache/hadoop

报错如下: Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil 原因: hadoop环境缺少hbase支持的包。 解决: (1)在hadoop的配置文件hadoop-env.sh中添加: export HADOOP_CLASSPATH=/home/hadoop/apps/hbase-1.2.4/lib/* (2)重启hadoop ...

weixin_45879334的博客 1414

创建动态代理对象bean,并动态注入到spring容器中

使用过Mybatis的同学,应该都知道,我们只需要编写mybatis对应的接口和mapper XML文件即可,并不需要手动编写mapper接口的实现。这里mybatis就用到了JDK动态代理,并且将生成的接口代理对象动态注入到Spring容器中。 这里涉及到几个问题。也许有同学会有疑问,我们直接编写好类,加入@Component等注解不是可以注入了吗?或者在配置类(@Configuration)...

lichuangcsdn的博客 3万+

最近写mapreduce程序从hbase中抽取程序遇到的一些问题

1,报错信息 Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/protobuf/generated/ClientProtos     at org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil.addHBaseDependen

Searcher_Recommeder的博客 2818

聊一聊固态电池和钠离子电池新技术

总之,固态电池是一种“安全又高效的未来电池”,它的好处非常明显,但目前还处于研发阶段,离普及还有一段距离。未来,这两种技术可能会与锂离子电池并存,分别满足不同的市场需求。我尝试用最通俗易懂的语言将复杂的技术讲给大家听。钠离子电池和锂离子电池的工作原理很相似,但它用的是。固态电池和钠离子电池是两种正在研发和推广的。,它们有潜力解决现有锂离子电池的部分缺点。,而不是锂(Li)。

weixin_33324696的博客 3332

JDK8升级JDK17过程中遇到的那些坑

JDK8虽然非常好,但是JDK版本已经发布到JDK20了,且JDK8后的版本升级了很多新的特性,如模块化、ZGC以及虚拟线程、结构性并发等,也是非常有吸引力的,所以决定将基于JDK8的项目升级到最近的LTS版本JDK17。

BASK2312的博客 6684

使用hbase版本异常

Failing Oozie Launcher, Main class [org.apache.oozie.action.hadoop.JavaMain], main() threw exception, java.lang.NoSuchMethodError: org.apache.hadoop.hbase.protobuf.generated.ClientProtos$Result$Builde

dub_lys的博客 2151

stm32f103c8t6的中文字库

stm32的成熟中文字库,上手即用,操作简单

nbbskk的博客 3653

HBase学习之四: mapreduce处理数据后存储到hbase及错误java.lang.NoClassDefFoundError的解决办法

mapreduce处理数据后存储到hbase源代码(参考网上资料测试OK): map类: package hbase; import java.io.IOException; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapredu

A coder of life 9600

让openclaw接入web端的deepseek或着qwen,使用无限token

🪟 Windows: 提供原生的 PowerShell 一键安装支持!配置过程和官方版本是相同的,唯一的区别就是再选则model时要选择带Browser字样的deepseek或者qwen。安装之前需要先清理官方版本的安装痕迹,否则openclaw版本跳转不到这个中文版本。因为此版本与官方版本存在代差,在配置飞书时可能会出现无法安装飞书的情况。剩下的配置保持和官方版本一致操作即可。选中之后需要进行一次网页端的登录。登录后会出现可选择的model。安装完成后会跳到这个中文界面。涉及到接入飞书机器人的操作。

z1872385的博客 302

Android 12.0 SystemUI下拉状态栏定制化之隐藏下拉通知栏布局功能实现(二)

在12.0的系统定制化开发中,由于从12.0开始SystemUI下拉状态栏和11.0的变化比较大,所以可以说需要从新分析相关的SystemUI的 布局,然后做分析来实现不同的功能,今天就开始实现关于隐藏SystemUI下拉状态栏中的通知栏布局系列二,去掉下拉状态栏中 通知栏部分 白色的圆角背景

安卓兼职framework和app工程师的博客 1634

MapReduce操作Hbase 进行单词数量统计Demo

1.window环境准备:eclipse中建项目,导入hbase安装环境下的lib中的jar包,或者用maven工具加载jar 2.linux环境准备:前提安装Hadoop,hbase,zookeeper并能正常运行。若想在Hadoop上运行hbase相关文件,得把hbase环境下的lib里的依赖jar导入到hadoop环境下,下面给一个简单方法:进入到 Hadoop的hadoop-env.sh

zhangyunfeixyz的博客 1418

基于YOLOv8的野生菌菇检测、识别与分类系统

YOLOv8是YOLO系列模型的最新版本,继承了YOLO系列高效、精确的特点。YOLOv8采用了新的网络架构,并优化了推理速度和检测精度。与传统的目标检测算法(如Faster R-CNN)不同,YOLO模型通过一次前向传播同时完成目标定位与分类,因而具有非常高的计算效率。

YOLO 1284

基于Hadoop HA集群部署HBase HA集群(详细版)

本文介绍Hadoop高可用(HA)集群的部署方法,重点阐述ZooKeeper在Hadoop及HBase高可用架构中的核心作用。文章首先说明ZooKeeper通过临时节点机制实现主从选举,为Hadoop NameNode和HBase Master提供故障转移支持。随后详细讲解ZooKeeper集群的配置步骤,包括myid文件设置和环境变量配置。在Hadoop HA配置部分,文章展示了core-site.xml和hdfs-site.xml的关键参数,特别是ZooKeeper服务地址和nameservice的配置

pysense的博客 5385

<PLC><socket><汇川>汇川PLC使用socket与其他控制器(如上位机)通讯模板程序示例

以上介绍了汇川PLC通用socket通讯的示例,事实上,汇川的官方手册也有使用示例,可以直接仿照使用,也可以加以修改。

用沸腾的热血,支付我们的人生吧! 3248

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

<大数据平台与架构>学习笔记(Hdfs、Hbase、Hive、MapReduce、Eclipse、Spark)

1 cd2 ls3 mkdir4 rmkdir5 cp6 mv7 rm8 cat9 touchvimgedit10 tar配置环境变量,使得每次输入shell命令可以省略(./bin/ 和 ./sbin)geditweb文件管理页面1进入hadoop安装目录jps连续两次开启hdfs后报错:没有数据节点,不能上传含内容的本地文本文件解决:关闭两次hdfs(删除tmp临时文件,格式化namenode)命令:./sbin/stop-dfs.sh # 关闭。

小朱不是小猪的博客 725

深度学习工具包 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&#39;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 = &quot;R. B. Palm&quot;, title = &quot;Prediction as a candidate for learning deep hierarchical models of data&quot;, year = &quot;2012&quot;,}```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(&#39;DeepLearnToolbox&#39;));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(&#39;state&#39;,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&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,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 = &#39;sigm&#39;;%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 &lt; 0.10, &#39;Too big error&#39;);```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(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;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)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;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 &lt; 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% 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&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 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&lt;0.12, &#39;Too big error&#39;);```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(&#39;state&#39;,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 &lt; 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,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 &lt; 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,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 &lt; 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % 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 &lt; 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % 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 &lt; 0.1, &#39;Too big error&#39;);%% 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(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % 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 &lt; 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free &quot;Bitdeli Badge&quot;)

虚拟机安装hadoop+hbase+spark+kafka

** 一、虚拟机的安装 1.1安装虚拟机-Linux 1.创建新的虚拟机,选择自定义–&gt;下一步 2.默认选项,直接单击下一步 3.选择稍后安装操作系统–&gt;下一步 4.操作系统选择Linux,版本这里选了Red Hat Enterprise Linux 6 64位,单击下一步 5.更改虚拟机的名称为hadoop01,先在G盘创建hadoop_linux文件,再在其下新建一个文件夹hadoop01,更改安装路径,点击浏览(选择刚刚创建的文件夹)–&gt;下一步 6.每个处理器的内核数量选择2

weixin_50529973的博客 2378

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

Hadoop HBase Hive | 二、Hadoop 集群搭建

目录 1.上一篇 Hadoop HBase Hive | 一、Linux集群环境安装采坑介绍 2.检查hostname 3.上传hadoop 4.修改配置文件 4.1修改core-site.xml 4.2修改hdfs-site.xml 4.3修改yarn-site.xml 4.4修改mapred-site.xml 4.5修改slaves、master 4.6检查...

qq_41497111的博客 807

郑轻软工大数据实验(手把手教你入门Hadoop、hbase、spark)

轻大软工21大数据实验 编程实现以下指定功能,并利用Hadoop提供的Shell命令完成相同任务 利用MapReduce编程实现以下功能 编程实现以下功能,并用Hadoop提供的HBase Shell命令完成相同任务。

weixin_62543985的博客 3541

【大数据】Hadoop实验报告

实验一 熟悉常用的Linux操作和Hadoop操作 实验二 熟悉常用的HDFS操作 实验三 熟悉常用的HBase操作 实验四 MapReduce/Spark编程初级实践

CoutCodes的博客 3万+

linux中Hadoop与HBase数据库搭建介绍与应用场景分析

一、 Hadoop Hadoop是Apache组织的一个分布式计算框架(java语言),其最核心的设计就是:HDFS和MapReduce,HDFS实现存储,MapReduce实现原理分析处理。 1.Hadoop架构 Hadoop框架核心模块: Hadoop YARN:这是作业调度和集群资源管理的框架。 Hadoop分布式文件系统(HDFS):提供对应用程序数据的高吞...

时间虚掷的孤岛 849

MapReduce基础编程,Hadoop实现WordCount实例(打包上传到Linux服务器运行)

MapReduce基础编程,实现WordCount实例,并导入到Linux中1、在Windows下下载Hadoop2、使用idea新建Java工程3、编写代码4、将编写的Java项目导出成jar包5、将jar包导入到Linux总结 1、在Windows下下载Hadoop Hadoop下载地址 bfsu这个镜像最快,清华的经常断 下载完成后解压 2、使用idea新建Java工程 新建一个普通的java项目就行,jdk最好用1.8,不然有可能会报错 首先在新建的项目文件夹里新建一个文件夹,存放要导入的jar包

泡泡的博客 1965

HBase:一个官方HBase MapReduce Read/Write Example出现的各种错误

1.声明 当前内容主要用于本人学习和复习,当前的内容为运行一个官方的demo,出现的各种问题错误 2.问题1,无法从mirror中加载hadoop-mapreduce-client-common-2.8.5.jar 在使用maven并添加这个pom依赖的时候: &lt;dependency&gt; &lt;groupId&gt;org.apache.hadoop&lt;/groupId&gt; &lt;artifactId&gt;hadoop-mapreduce-client-common&lt;/ar

编程学习者的博客 678

Hadoop教程(一) Hadoop入门教程

Hadoop是Apache开源组织的一个分布式计算开源框架(http://hadoop.apache.org/),用java语言实现开源软件框架,实现在大量计算机组成的集群中对海量数据进行分布式计算。Hadoop框架中最核心设计就是:HDFS和MapReduce,HDFS实现存储,而MapReduce实现原理分析处理,这两部分是hadoop的 核心。数据在Hadoop中处理的流程可以简单的按照下图来理解:数据通过Haddop的集群处理后得到结果,它是一个高性能处理海量数据集的工具 。

yuan_xw的专栏 9万+

HBase Java API使用IDEA开发----mapreduce读取hdfs文件写入hbase

在hadoop-env.sh 添加export HADOOP_CLASSPATH=$HBASE_HOME/lib/*没有配置HBASE_HOME的去/etc/profile配置环境变量,路径根据你自己的自行修改。在hadoop的bin目录下执行 hadoop jar jar包名字 类名。二、把需要读取的文件上传到hdfs的/user目录下。四、使用maven打包项目,上传到linux,执行程序。一、配置hadoop读取hbase的支持包。把jar包文件复制出来传到linu目录下。

799
上一篇: Linux.实现一个简单的shell
下一篇: 计算机网络.五层协议栈模型简介
木艮氵
博客等级 码龄11年 136粉丝 51原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值