生成SequenceFile(Generating a SequenceFile)
给定以下格式的数据(tag_uri image_uri image_uri image_uri ...),我需要将它们转换为Hadoop SequenceFile格式,以便Mahout进一步处理(例如聚类)
http://flickr.com/photos/tags/100commentgroup http://flickr.com/photos/34254318@N06/4019040356 http://flickr.com/photos/46857830@N03/5651576112 http://flickr.com/photos/tags/100faves http://flickr.com/photos/21207178@N07/5441742937 ...
在此之前,我将输入转换为csv(或arff),如下所示
http://flickr.com/photos/tags/100commentgroup,http://flickr.com/photos/tags/100faves,... 0,1,... 1,1,... ...
每行描述一个标签。 然后将arff文件转换为mahout使用的矢量文件以供进一步处理。 我试图跳过arff生成部分,然后生成一个sequenceFile。 如果我没有弄错,要将我的数据表示为sequenceFile,我需要将$ tag_uri作为键存储每行数据,然后将$ image_vector作为值存储。 这样做的正确方法是什么(如果可能的话,我可以将每行的tag_url包含在某个地方的序列文件中)吗?
我找到的一些参考文献,但不确定它们是否相关:
- 编写SequenceFile
- 格式化svd矩阵分解的输入矩阵 (我可以将矩阵存储在这种形式中吗?)
- RandomAccessSparseVector (考虑到我只列出分配给定标签的图像而不是一行中的所有图像,是否可以使用此向量表示它?)
- SequenceFile写
- SequenceFile解释
Given data in the following format (tag_uri image_uri image_uri image_uri ...), I need to turn them into Hadoop SequenceFile format for further processing by Mahout (e.g. clustering)
http://flickr.com/photos/tags/100commentgroup http://flickr.com/photos/34254318@N06/4019040356 http://flickr.com/photos/46857830@N03/5651576112 http://flickr.com/photos/tags/100faves http://flickr.com/photos/21207178@N07/5441742937 ...
Before this I would turn the input into csv (or arff) as follows
http://flickr.com/photos/tags/100commentgroup,http://flickr.com/photos/tags/100faves,... 0,1,... 1,1,... ...
with each row describes one tag. Then the arff file is converted into a vector file used by mahout for further processing. I am trying to skip the arff generation part, and generate a sequenceFile instead. If I am not mistaken, to represent my data as a sequenceFile, I would need to store each row of the data with $tag_uri as key, then $image_vector as value. What is the proper way of doing this (if possible, can I have the tag_url for each row to be included in the sequencefile somewhere)?
Some references that I found, but not sure if they are relevant:
- Writing a SequenceFile
- Formatting input matrix for svd matrix factorization (can I store my matrix in this form?)
- RandomAccessSparseVector (considering I only list images that are assigned with a given tag instead of all the images in a line, is it possible to represent it using this vector?)
- SequenceFile write
- SequenceFile explanation
原文:https://stackoverflow.com/questions/7062327
最满意答案
是的,这是HTML5和XHTML之间的主要区别之一。 您应该能够使用HTML5解析器解析任何HTML页面。
Yes, that's one of the main differences between HTML5 and XHTML. You should be able to parse any HTML page with a HTML5 parser.
相关问答
更多-
自我插件:我刚刚发布了一个新的Java HTML解析器: jsoup 。 我在这里提到,因为我认为这会做你以后的事情。 它的派对技巧是一种CSS选择器语法来查找元素,例如: String html = "
First parse " + "Parsed HTML into a doc.
"; Document doc = Jsoup.parse(html); Elements links ... -
也许这会有所帮助: if (navigator.userAgent.match(/MSIE 8/) == null) { // do something !IE8 } 从: 如何仅为IE 8运行脚本 JavaScript中的浏览器检测? Maybe this will help: if (navigator.userAgent.match(/MSIE 8/) == null) { // do something !IE8 } from: how do I run a script only fo ...
-
领先的Java HTML解析器的优点和缺点是什么?(What are the pros and cons of the leading Java HTML parsers? [closed])[2023-02-28]
一般 几乎所有已知的HTML解析器都实现了W3C DOM API (JAXP API的一部分,用于XML处理的Java API),并为您提供了一个可以直接使用JAXP API的org.w3c.dom.Document 。 主要的区别通常在解析器的特征中找到。 大多数解析器在一定程度上宽松和宽松的非格式HTML(“tagsoup”),如JTidy , NekoHTML , TagSoup和HtmlCleaner 。 您通常使用这种HTML解析器来“整理”HTML源代码(例如
通过XML有效的
... -
秒差距: unexpected fail empty 连击: unexpected fail empty 唯一的区别是它们产生的错误信息。 在意外的令牌上使用意外。 unexpected "token"将导致像"unexpected: 'token'"的错误消息。 使用它们表示的高级构造对注解解析器进行注释(>) 。 这通常用在我们想要返回一个更高级别的构造方面的错误消息而不是返回所有可能的字符的set方案的末尾。 parseExpr = ... > "expression" parseId = . ...
-
任何好的Java HTML解析器?(Any good Java HTML parsers?)[2022-02-25]
Mozilla HTML Parser看起来很有趣。 根据定义,它应该与Gecko引擎本身一样好,这可能会满足您的需求。 Mozilla HTML Parser looks rather interesting. By definition, it's supposed to be as good as Gecko engine itself, which is likely to cover your needs. -
只需使用html5shim使html5标签与旧版IE兼容 Just use the html5shim to make html5 tags compatible with old version of IE
-
正如评论所提到的,“HTML5”HTML页面和“旧”HTML页面之间没有太大的区别。 这都是HTML。 HTML5作为标准的重点在于记录浏览器如何处理HTML,而不是指定新内容(除了具有不同名称的标记和JavaScript API)。 如果页面使用HTML5 doctype( ),那么这是一个非常好的迹象,表明作者希望它是HTML5。 但正如评论所提到的,你只需要一个像样的HTML解析器 - 它会吸收旧的HTML和HTML5,因为就解析而言它们实际上是相同的。 我对HTML解 ...
-
符合html5的解析器是否正确处理html 4及更早版本?(Do html5-compliant parsers process html 4 and older correctly?)[2023-06-28]
是的,这是HTML5和XHTML之间的主要区别之一。 您应该能够使用HTML5解析器解析任何HTML页面。 Yes, that's one of the main differences between HTML5 and XHTML. You should be able to parse any HTML page with a HTML5 parser. -
错误:Android 2.3及更早版本上不受信任的服务器证书(Error: Not trusted server certificate on Android 2.3 and older)[2022-01-27]
很难确切地说你为什么会遇到这个问题,但听起来你没有私钥,你从GlobalSign收到的证书,我认为你生成了CSR? 如果是这样,您需要以相同的方法导入从GlobalSign收到的.pem文件,如果您没有从BKS keystone中的私钥生成CSR,那么它将不是可信证书。 无论如何,这就是我的想法 Problem was solved. I have asked technical support of GlobalSign about certificates. They made some tests a ... -
事实上的标准HTML5解析测试在这里: https://github.com/w3c/web-platform-tests/tree/master/html/syntax/parsing 所以你可以得到它们: git clone https://github.com/w3c/web-platform-tests.git \ && cd web-platform-tests/html/syntax/parsing 这些测试与HTML规范中的HTML解析算法的任何更改保持同步,因此在克隆它们之后,您可 ...