Nutch 快速入门(Nutch 1.7)

Nutch搜索引擎入门与实战教程 本文还有配套的精品资源,点击获取 简介:Nutch是一个基于Apache Hadoop构建的开源搜索引擎项目,用于网络爬虫和网页抓取,在大数据信息检索与分析中占据重要地位。本资料详细介绍了Nutch的基础知识、工作流程、配置使用方法,并通过实践流程展示了如何从配置、生成种子、网页抓取到数据存储与搜索的全过程。同时,本资料也提供了与其他大数据工具如Apache Solr和HB... 阅读详情
转载地址:http://www.yanjiuyanjiu.com/blog/20140121/
1 下载已编译好的二进制包,解压
$ wget http://psg.mtu.edu/pub/apache/nutch/1.7/apache-nutch-1.7-bin.tar.gz
$ tar zxf apache-nutch-1.7-bin.tar.gz

2 验证一下

$ cd apache-nutch-1.7
$ bin/nutch

如果出现”Permission denied”请运行下面的命令:

$ chmod +x bin/nutch

如果有Warning说 JAVA_HOME没有设置,请设置一下JAVA_HOME.

3 添加种子URL

mkdir ~/urls
vim ~/urls/seed.txt
http://movie.douban.com/subject/5323968/

4 设置URL过滤规则

如果只想抓取某种类型的URL,可以在 conf/regex-urlfilter.txt设置正则表达式,于是,只有匹配这些正则表达式的URL才会被抓取。

例如,我只想抓取豆瓣电影的数据,可以这样设置:

#注释掉这一行
# skip URLs containing certain characters as probable queries, etc.
#-[?*!@=]
# accept anything else
#注释掉这行
#+.
+^http:\/\/movie\.douban\.com\/subject\/[0-9]+\/(\?.+)?$

5 设置agent名字

conf/nutch-site.xml:

<property>
  <name>http.agent.name</name>
  <value>My Nutch Spider</value>
</property>

这一步是从这本书上看到的,Web Crawling and Data Mining with Apache Nutch,第14页。

6 安装Solr

由于建索引的时候需要使用Solr,因此我们需要安装并启动一个Solr服务器。

参考Nutch Tutorial 第4、5、6步,以及Solr Tutorial。

6.1 下载,解压

wget http://mirrors.cnnic.cn/apache/lucene/solr/4.6.1/solr-4.6.1.tgztar -zxf solr-4.6.1.tgz

6.2 运行Solr

cd example
java -jar start.jar

验证是否启动成功

用浏览器打开 http://localhost:8983/solr/admin/,如果能看到页面,说明启动成功。

6.3 将Nutch与Solr集成在一起

将NUTCH_DIR/conf/schema-solr4.xml拷贝到SOLR_DIR/solr/collection1/conf/,重命名为schema.xml,并在<fields>...</fields>最后添加一行(具体解释见Solr 4.2 - what is _version_field?),

<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>

重启Solr,

# Ctrl+C to stop Solr
java -jar start.jar

7 使用crawl脚本一键抓取

Nutch自带了一个脚本,./bin/crawl,把抓取的各个步骤合并成一个命令,看一下它的用法

$ bin/crawl 
Missing seedDir : crawl <seedDir> <crawlDir> <solrURL> <numberOfRounds>

注意,是使用bin/crawl,不是bin/nutch crawl,后者已经是deprecated的了。

7.1 抓取网页

$ ./bin/crawl ~/urls/ ./TestCrawl http://localhost:8983/solr/ 2
  • ~/urls 是存放了种子url的目录
  • TestCrawl(这是原作者的文件,我的是crawl)是存放数据的根目录(在Nutch 2.x中,则表示crawlId,这会在HBase中创建一张以crawlId为前缀的表,例如TestCrawl_Webpage)
  • http://localhost:8983/solr/ , 这是Solr服务器
  • 2,numberOfRounds,迭代的次数
  • 注意:我切换到./nutch目录后,使用的命令是:$ bin/crawl urls/ crawl http://localhost:8983/solr/ 2

过了一会儿,屏幕上出现了一大堆url,可以看到爬虫正在抓取!

fetching http://music.douban.com/subject/25811077/ (queue crawl delay=5000ms)
fetching http://read.douban.com/ebook/1919781 (queue crawl delay=5000ms)
fetching http://www.douban.com/online/11670861/ (queue crawl delay=5000ms)
fetching http://book.douban.com/tag/绘本 (queue crawl delay=5000ms)
fetching http://movie.douban.com/tag/科幻 (queue crawl delay=5000ms)
49/50 spinwaiting/active, 56 pages, 0 errors, 0.9 1 pages/s, 332 245 kb/s, 131 URLs in 5 queues
fetching http://music.douban.com/subject/25762454/ (queue crawl delay=5000ms)
fetching http://read.douban.com/reader/ebook/1951242/ (queue crawl delay=5000ms)
fetching http://www.douban.com/mobile/read-notes (queue crawl delay=5000ms)
fetching http://book.douban.com/tag/诗歌 (queue crawl delay=5000ms)
50/50 spinwaiting/active, 61 pages, 0 errors, 0.9 1 pages/s, 334 366 kb/s, 127 URLs in 5 queues

7.2 查看结果

$ bin/nutch readdb TestCrawl/crawldb/ -stats
14/02/14 16:35:47 INFO crawl.CrawlDbReader: Statistics for CrawlDb: TestCrawl/crawldb/
14/02/14 16:35:47 INFO crawl.CrawlDbReader: TOTAL urls:	70
14/02/14 16:35:47 INFO crawl.CrawlDbReader: retry 0:	70
14/02/14 16:35:47 INFO crawl.CrawlDbReader: min score:	0.005
14/02/14 16:35:47 INFO crawl.CrawlDbReader: avg score:	0.03877143
14/02/14 16:35:47 INFO crawl.CrawlDbReader: max score:	1.23
14/02/14 16:35:47 INFO crawl.CrawlDbReader: status 1 (db_unfetched):	59
14/02/14 16:35:47 INFO crawl.CrawlDbReader: status 2 (db_fetched):	11
14/02/14 16:35:47 INFO crawl.CrawlDbReader: CrawlDb statistics: done

8 一步一步使用单个命令抓取网页

上一节为了简单性,一个命令搞定。本节我将严格按照抓取的步骤,一步一步来,揭开爬虫的神秘面纱。感兴趣的读者也可以看看 bin/crawl 脚本里的内容,可以很清楚的看到各个步骤。

先删除第7节产生的数据,

$ rm -rf TestCrawl/

8.1 基本概念

Nutch data is composed of:

  • The crawl database, or crawldb. This contains information about every URL known to Nutch, including whether it was fetched, and, if so, when.
  • The link database, or linkdb. This contains the list of known links to each URL, including both the source URL and anchor text of the link.
  • A set of segments. Each segment is a set of URLs that are fetched as a unit. Segments are directories with the following subdirectories:
    • a crawl_generate names a set of URLs to be fetched
    • a crawl_fetch contains the status of fetching each URL
    • a content contains the raw content retrieved from each URL
    • a parse_text contains the parsed text of each URL
    • a parse_data contains outlinks and metadata parsed from each URL
    • a crawl_parse contains the outlink URLs, used to update the crawldb

8.2 inject:使用种子URL列表,生成crawldb

$ bin/nutch inject TestCrawl/crawldb ~/urls

将根据~/urls下的种子URL,生成一个URL数据库,放在crawdb目录下。

8.3 generate

$ bin/nutch generate TestCrawl/crawldb TestCrawl/segments

这会生成一个 fetch list,存放在一个segments/日期目录下。我们将这个目录的名字保存在shell变量s1里:

$ s1=`ls -d TestCrawl/segments/2* | tail -1`
$ echo $s1

8.4 fetch

$ bin/nutch fetch $s1

将会在 $1 目录下,生成两个子目录, crawl_fetch 和 content。

8.5 parse

$ bin/nutch parse $s1

将会在 $1 目录下,生成3个子目录, crawl_parse, parse_data 和parse_text 。

8.6 updatedb

$ bin/nutch updatedb TestCrawl/crawldb $s1

这将把crawldb/current重命名为crawldb/old,并生成新的 crawldb/current 。

8.7 查看结果

$ bin/nutch readdb TestCrawl/crawldb/ -stats

在建立索引之前,我们首先要反转所有的链接,这样我们就可以获得一个页面所有的锚文本,并给这些锚文本建立索引。

$ bin/nutch invertlinks TestCrawl/linkdb -dir TestCrawl/segments

8.9 solrindex, 提交数据给solr,建立索引

$ bin/nutch solrindex http://localhost:8983/solr TestCrawl/crawldb/ -linkdb TestCrawl/linkdb/ TestCrawl/segments/20140203004348/ -filter -normalize

8.10 solrdedup, 给索引去重

有时重复添加了数据,导致索引里有重复数据,我们需要去重,

$bin/nutch solrdedup http://localhost:8983/solr

8.11 solrclean, 删除索引

如果数据过时了,需要在索引里删除,也是可以的。

$ bin/nutch solrclean TestCrawl/crawldb/ http://localhost:8983/solr

相关文章

Nutch 快速入门(Nutch 2.2.1)

Jan 21st, 2014Search-Engine


Apache Nutch 1.6:开源网络爬虫框架快速启动指南 欢迎阅读我们的IT专业指南,这里将开始对Apache Nutch进行深入探讨。作为现代搜索引擎的基石之一,Apache Nutch在大数据与信息检索领域内扮演着重要角色。它是基于Lucene构建的开源网络爬虫,拥有灵活的架构,能够通过插件化方式扩展其功能,适应不断变化的爬虫需求。网络爬虫的目的是自动地浏览互联网,并对网页内容进行下载、存储和分析。它的核心功能包括但不限于:页面下载:获取网页内容。链接提取:从当前页面中抽取新的链接以供后续抓取。内容处理:对下载的内容进行存储和处理。 阅读详情

相关推荐

Nutch网络爬虫全面入门教程

Nutch的爬虫部分包含多个关键组件,它们协同工作以实现网页数据的有效抓取:种子(Seeds):初始的URL集合,用于启动爬虫的抓取过程。抓取器(Fetcher):负责发送HTTP请求,获取网页内容。生成器(Generator):从获取的网页中提取新的URL,更新种子列表。更新调度器(Scheduler):决定何时抓取哪些网页,避免重复抓取,优化资源利用。数据库(Database):存储了URL的元数据,如抓取时间、状态码等,还有页面内容、链接等。

weixin_35749440的博客 894

学习ApacheNutch:一个高性能的网络爬虫框架

1.背景介绍 在本文中,我们将深入探讨Apache Nutch,一个高性能的网络爬虫框架。我们将涵盖以下主题: 背景介绍 核心概念与联系 核心算法原理和具体操作步骤以及数学模型公式详细讲解 具体最佳实践:代码实例和详细解释说明 实际应用场景 工具和资源推荐 总结:未来发展趋势与挑战 附录:常见问题与解答 1. 背景介绍 Apache Nutch是一个开源的网络爬虫框架,由Apache ...

AI天才研究院 3701

微信小程序使用TCP通信

最终目的:在微信小程序内实现对局域网发起TCP通信实现步骤:建立TCP服务 + 小程序发起通信。

Big_YiFeng的博客 5615

Nutch爬虫配置及简单使用

北京大学软件与微电子学院 曹路 2018/03/20 https://github.com/andrewcao95/nutch-crawler 1 引言 1.1 爬虫的基本分类 爬虫基本可以分3类: 分布式爬虫:Nutch JAVA单机爬虫:Crawler4j、WebMagic、WebCollector 非JAVA单机爬虫:Scrapy 1.2 Nutch简介 Nutch是apache旗下...

weixin_30566111的博客 748

如何在Ubuntu 22.04上为AlphaFold3配置NVIDIA A100 GPU(含驱动安装避坑指南)

本文提供了在Ubuntu 22.04系统上为AlphaFold3部署NVIDIA A100 GPU的完整安装教程。内容涵盖从系统环境准备、NVIDIA驱动安装与避坑指南,到Docker容器化部署、数据库获取以及最终构建运行AlphaFold3的详细步骤,旨在帮助研究者和开发者高效配置高性能计算环境,充分发挥A100的硬件潜力。

nft7creator的博客 470

【win11 cuda12.0安装tensorflow-gpu】

win11 cuda 12.0 安装 tensorflow-gpu

weixin_36299320的博客 3012

Nutch 深入浅出

首先了解一下什么是Nutch。     Nutch是一个开源Java实现的搜索引擎。它提供了我们运行自己的搜索引擎所需的全部工具。包括全文搜索和Web爬虫。 Nutch的组成:     爬虫crawler和查询searcher。Crawler主要用于从网络上抓取网页并为这些网页建立索引。Searcher主要利用这些索引检索用户的查找关键词来产生查找结果。两者之间的接口是索引,所以除

Alan Zhuang的博客 1万+

深入SVT SPI VIP配置:如何灵活控制CS间隔、数据帧大小与时钟频率(含代码片段)

本文深入探讨了SVT SPI VIP的高级配置技巧,包括精确控制CS信号间隔、突破数据帧大小限制以及动态时钟频率切换。通过实战代码片段和详细配置步骤,帮助验证工程师灵活应对复杂SPI协议验证场景,提升验证效率和覆盖率。特别适合需要处理非标准SPI时序和特殊数据帧的芯片验证项目。

weixin_27014595的博客 289

Nutch1.2搜索引擎使用详解

Nutch作为一款刚刚诞生的开源Web搜索引擎,提供了除商业搜索引擎外的一种新的选择。个人、企业都可通过Nutch来构建适合于自身需要的搜索引擎平台,提供适合于自身的搜索服务,而不必完全被动接收商业搜索引擎的各种约束。 Nutch 是基于Lucene的。Lucene为 Nutch 提供了文本索引和搜索的API。如果你不需要抓取数据的话,应该使用Lucene。常见的应用场合是:你有数据源,需要...

ljl_xyf的专栏 402

Linux云服务器上搭建《僵尸毁灭工程》私服全流程指南(避坑版)

本文详细介绍了在Linux云服务器上搭建《僵尸毁灭工程》私服的全流程指南,包括环境准备、SteamCMD安装、游戏服务器部署、内存优化配置及高级调优技巧。特别针对常见问题提供解决方案,帮助玩家快速搭建稳定的私服环境。

solidity8miner的博客 618

从实验室到生活:构建一份全面的手机相机主观画质评测指南

本文详细介绍了如何从实验室数据转向实际体验,构建全面的手机相机主观画质评测指南。通过基础装备清单、室内外场景实战评测及数据之外的感知艺术,帮助用户发现手机相机在色彩还原、动态范围和夜景模式等方面的真实表现。特别关注主观体验与客观参数的差异,提供实用的评测技巧和报告撰写心法。

weixin_30940783的博客 309

Nutch 快速入门(Nutch 2.2.1)

原文:http://cn.soulmachine.me/blog/20140201/ Nutch 2.x 与 Nutch 1.x 相比,剥离出了存储层,放到了gora中,可以使用多种数据库,例如HBase, Cassandra, MySql来存储数据了。Nutch 1.7 则是把数据直接存储在HDFS上。 1. 安装并运行HBase 为了简单起见,使用Standalo

追求卓越的攻城狮 1452

LMI线性矩阵不等式之非线性变量处理

​ 如果一个LMI线性矩阵不等式中的某项存在两个矩阵变量相乘,那么称该类情形为非线性矩阵不等式,而要直接求解时很困难的,而且LMI工具箱也无法求解非线性矩阵,所以需要通过变量替换法进行处理。 ​...

Mr.邹的博客 4552

爬虫技术python nutch_把Nutch爬虫部署到Hadoop集群上

软件版本:Nutch 1.7, Hadoop 1.2.1, CentOS 6.5, JDK 1.7前面的3篇文章中, Nutch 快速入门(Nutch 1.7) , Nutch 快速入门(Nutch 2.2.1) ,在Eclipse里运行Nutch,Nutch都是跑在单机上,本文把Nutch部署到Hadoop集群上,在真正的分布式Hadoop集群上跑。前提1 启动Hadoo...

weixin_39846289的博客 281

YOLOv7独家原创改进:多种新颖的改进方式 | 保持原始信息-深度可分离卷积(MDSConv) | 全局感受野的空间金字塔 (Improve-SPPF)算法 | CA注意力改进版

多种新颖的改进方式 | 保持原始信息-深度可分离卷积(MDSConv) | 全局感受野的空间金字塔 (Improve-SPPF)算法 | CA注意力改进版

①答疑群聊服务;②YOLO大模型知识问答系统;③计算机视觉论文生成智能体; 1672

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

Nutch 笔记(一):Nutch 快速上手指南(收藏)

原著未明,仅做收藏,谅解.QUOTE:这个笔记还是以前做项目时,用到nutch,写了两篇笔记,这个只是简单的不能再简单的使用说明而已,没什么太大的用处,就算给希望使用而不知道怎么使用的朋友一点建议吧 screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=hand

clong1112的专栏 995

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

linux环境nutch的配置,Nutch 1.3 在Ubuntu上的简单配置

因为Nutch 1.3跟以前比改了不少东西,所以1.2中的有些配置已经不在适用了首先我的机器用的是Ubuntu 10.04,挺老的版本了,因为有它的光盘,一直没有升级当然是先下载nutch的包了,用的人人的镜像http://labs.renren.com/apache-mirror//nutch/只有先会用了才能进行下一步的工作嘛,所以介绍一下最简单的配置方法:1. 修改nutch解压目录中的r...

weixin_30536391的博客 159

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

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

Nutch2.2.1 笔记二 : Nutch2.2.1 + Mysql 配置,调试

Nutch2.x 使用gora做数据抽象层,底层的数据存储可以支持Mysql,HBase,Cassandra等,而1.x是基于HDFS的。Nutch2.x官方推荐的是和HBase结合,不过这里我们先配置Nutch2.2.1和Mysql运行,因为Mysql查询起来更加直观,难...

余老师的语文博客 247

Nutch2.1 in eclipse

Nutch2.1 in eclipse 主要目的: 1. 将nutch2.1放入eclipse中,便于调试源代码,查看nutch2.1是如何实现的。 2. 方便学习编写nutch2.1的plugin 准备: Linux环境 Nutch2.1 Mysql Java1.6 Eclipse 开始: 首先需要安装好jdk1.6,mysql,eclipse 开启eclip...

闪烁的星空 287

Nutch教程——准备篇 by 逼格DATA

实在是看不下去Nutch官方的坑爹教程了,总结一套看完能懂的Nutch教程,持续更新中。 开发环境和基础: 学习Nutch,必须满足以下几个条件,缺一不可: 1)Linux环境,实在是没办法就在Windows上装linux虚拟机。 2)熟悉Java。 3)有Hadoop基础,能够编写hadoop下map reduce程序。 4)能够看懂Linux Shell。 下

gywtzh0889的专栏 886

myeclipse8.5搭建nutch1.2

十一期间打算学些nutch+lucene+solr方面的知识,现将这两天主要学的myeclipse8.5+nutch1.2总结如下,当然也可以选择nutch1.3,这个是最新的,但是网上关于1.3版本的可参考资料太少了,最后也没成功,所以只能退而求其次,幸好搭建成功了。言归正传 1、资源要备齐:cygwin,myeclipse8.5,nutch发布版本文件nutch的源文件,即nutch1.2-

erliang20088的博客 716

在Eclipse中调试运行Nutch

昨天花了一天时间都没有搞定Nutch(nutch 0.8版本)。今天终于在同学提示下搞定了。总结一下这个恶心的东西,免得其他同志们再浪费宝贵的生命。注意你遇到问题肯定都是配置问题,不可能是源程序的问题,要不然nutch就肯定运行不了了。通常在控制台运行nutch是没有问题的。至于具体的运行Crawl参考:nutch 0.8 tutorial。关键的配置有conf下面的nutch-site.xml,

秋风吹渭水,落叶满长安 1295

在eclipse下编译运行nutch

<br />1.       下载Nutch 并解压到某个目录下,建议在根目录下。<br /><br /><br />2.       修改Nutch/conf目录下的nutch-site.xml和crawl-urlfilter.txt 两个文件,具体的修改方法如下:<br />(1) nutch-site.xml:  <br />在<configuration></configuration>中间插入以下内容:<br /><property> <br /> <name>http.agent.name

noOnlyAndroid的专栏 992

nutch install

nutch install on ubuntuhttp://wiki.apache.org/nutch/NutchTutorial#A1_Setup_Nutch_from_binary_distribution还是要看官方的文档,之前google了一个早期1.0版本...

88

nutch1.8+solr 4 配置过程

Nutch 2.2.1目前性能没有Nutch 1.7好,参考这里,NUTCH FIGHT! 1.7 vs 2.2.1. 所以我目前还是使用的Nutch 1.8。 1 下载已编译好的二进制包,解压 $ wget http://psg.mtu.edu/pub/apache/nutch/1.8/apache-nutch-1.8-bin.tar.gz $ tar zxf apache-nutc

tbdp6411的专栏 999
上一篇: ubuntu 安装 jdk1.7.0
下一篇: 用net start mysql , 提示发生系统错误 5;拒绝访问!
lixwcqs
博客等级 码龄16年 23粉丝 72原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址