A. Covert text file to sequeces file
Class: SequenceFilesFromDirectory
Functions: Converts a directory of text documents into SequenceFiles of Specified chunkSize. This class takes in a parent directory containing sub folders of text documents and recursively reads the files and creates the {@link org.apache.hadoop.io.SequenceFile}s of docid => content. The docid is set as the relative path of the document from the parent directory prepended with a specified prefix. You can also specify the input encoding of the text files. The content of the output SequenceFiles are encoded as UTF-8 text.
B.Covert sequences file to Document Vectors
Class: SparseVectorsFromSequenceFiles
Functions: Converts a given set of sequence files into SparseVectors
1. tokenize the documents in sequence file
DocumentProcessor.tokenizeDocuments(inputDir, analyzerClass, tokenizedPath, conf);
Key: /2435: Value: 为什么很多看起来不是很复杂的网站,比如 Facebook 需要大量顶尖高手来开发?
Key: /2436: Value: iNOKNOK敲门网络是怎样的一个网站?
Key: /2437: Value: 北京上海生活成本为何超过了巴黎和纽约?
======>
Key: /2435: Value: [为什么, 很多, 看起来, 不是, 很复杂, 网站, 比如, facebook, 需要, 大量, 顶尖, 高手, 开发]
Key: /2436: Value: [inoknok, 敲门, 网络, 怎样, 一个, 网站]
Key: /2437: Value: [北京, 上海, 生活, 成本, 为何, 超过, 巴黎, 纽约]
2.Create Term Frequency (Tf) Vectors from the input set of documents
DictionaryVectorizer.createTermFrequencyVectors
2-1 startWordCounting(input, dictionaryJobPath, baseConf, minSupport);
Count the frequencies of words in parallel using Map/Reduce. If term frequency in the corpus is smaller than
minSupport, then the term will be stripped, which means that the word or term will not be included in the dictionary.
tokenzied-documents:
Key: /2435: Value: [为什么, 很多, 看起来, 不是, 很复杂, 网站, 比如, facebook, 需要, 大量, 顶尖, 高手, 开发]
Key: /2436: Value: [inoknok, 敲门, 网络, 怎样, 一个, 网站]
Key: /2437: Value: [北京, 上海, 生活, 成本, 为何, 超过, 巴黎, 纽约]
.......
=============>
wordcount:
Key: 专用: Value: 1
Key: 世外桃源: Value: 1
Key: 世界: Value: 13
Key: 世界上: Value: 6
Key: 世界杯: Value: 20
Key: 世界观: Value: 1
2-2 Read the feature frequency List which is built at the end of the Word Count Job and assign ids to them
createDictionaryChunks(dictionaryJobPath, output, baseConf, chunkSizeInMegabytes, maxTermDimension);
wordcount:
Key: 80、90后最大疑惑: Value: 1
Key: -727379968: Value: 1
Key: 0.25%: Value: 1
Key: 0.9秒: Value: 1
Key: 00: Value: 1
Key: 001: Value: 1
Key: 0day: Value: 1
Key: 1.8: Value: 1
Key: 1/100: Value: 1
Key: 10: Value: 4
......
===========>
dictionary:
Key: 80、90后最大疑惑: Value: 0
Key: -727379968: Value: 1
Key: 0.25%: Value: 2
Key: 0.9秒: Value: 3
Key: 00: Value: 4
Key: 001: Value: 5
Key: 0day: Value: 6
Key: 1.8: Value: 7
Key: 1/100: Value: 8
Key: 10: Value: 9
Key: 100: Value: 10
.........
2-3 Create a partial vector using a chunk of features from the input documents. And merge partial vector to complete document vector
makePartialVectors
PartialVectorMerger.mergePartialVectors
dictionary
Key: 80、90后最大疑惑: Value: 0Key: -727379968: Value: 1
Key: 0.25%: Value: 2
Key: 0.9秒: Value: 3
tokenized-documents
Key: /2435: Value: [为什么, 很多, 看起来, 不是, 很复杂, 网站, 比如, facebook, 需要, 大量, 顶尖, 高手, 开发]
Key: /2436: Value: [inoknok, 敲门, 网络, 怎样, 一个, 网站]
Key: /2437: Value: [北京, 上海, 生活, 成本, 为何, 超过, 巴黎, 纽约]
......
======>
Key: /2435: Value: {181:1.0,512:1.0,618:1.0,1738:1.0,2142:1.0,2221:1.0,2222:1.0,3072:1.0,3517:1.0,3776:1.0,4518:1.0,4545:1.0,4631:1.0}
Key: /2436: Value: {210:1.0,329:1.0,2296:1.0,2666:1.0,3776:1.0,3777:1.0}
Key: /2437: Value: {441:1.0,619:1.0,1208:1.0,2066:1.0,2390:1.0,3375:1.0,3714:1.0,4173:1.0}
.......
3. Calculates the document frequencies of all terms from the input set of vectors
相关推荐
Unsupervised Learning: Principle Component Analysis Dimension Reduction Clustering Distributed Representation PCA PCA – Another Point of View
基于K-means算法的光伏曲线聚类研究 关键词:k-means 光伏聚类 聚类 参考文档:《基于改进 K-means 聚类的风光发电场景划分》仅部分参考 仿真平台:MATLAB平台 主要内容:代码主要做的是一个光伏曲线聚类的模型,...
毕业设计:基于C++的AP聚类算法设计与实现 毕业设计:基于C++的AP聚类算法设计与实现 毕业设计:基于C++的AP聚类算法设计与实现 毕业设计:基于C++的AP聚类算法设计与实现 毕业设计:基于C++的AP聚类算法设计与实现 ...
kmeans数据集:20 支亚洲球队的聚类问题
DENCLUE:基于密度分布函数的聚类.pdf 学习资料 复习资料 教学资源
数学建模扩展:4几种常用的聚类分析方法.zip
DNS恶意域名分析数据集:是否隐蔽信道、域名聚类分析,内含数据集说明
数学建模扩展:4几种常用的聚类分析方法 (含教学视频).zip
数据挖掘课件:第11章 聚类(Clustering)分析简介.pdf
人工智能+数据分析的kmeans算法实践数据源:20 支亚洲球队的聚类问题 具体分析原理+案例+代码可参考文章: 《K-Means(上):数据分析 | 数据挖掘 | 十大算法之一 ...
深度学习神经网络在人脸识别中的运用,网络采用欧氏距离来衡量两张人脸图片之间的相似度。
聚类验证是聚类分析中一个重要且必要的步骤。 这种基于GUI的可视化聚类验证工具CVAP为聚类解的有效性评估、聚类数的估计以及候选聚类算法之间的性能比较提供了重要的工具和便利的分析环境。 CVAP包括4个外部有效性...
自适应模糊神经网络做预测,最小二乘和反向传播算法实现自适应率,预测精度非常高。 另有三种不同的模糊算法:网格划分法,减法聚类法,FCM模糊C均值法,可做对比。
MYDBSCAN:基于密度的聚类DBSCAN(Density-Based Spatial Clustering of Applications with Noise)算法的底层实现 MYAP:基于划分的聚类AP(Affinity Propagation Clustering Algorithm )算法的底层实现--近邻传播...
解决大规模聚类问题需要一种也可以并行实现的高效算法。K 均值是合适的,但它可能导致聚类结果不准确。为了克服这个问题,我们提出了随机交换聚类算法的并行版本。它结合了k均值的可扩展性和随机交换的高聚类精度。...
这是模式识别的课程作业,有k均值聚类算法和ISODATA聚类算法,正对遥感影像或者图片进行聚类。写的算法较为粗糙,还请大家多多指教!
DBSCAN 是一种经典的基于密度聚类算法,能够自动确定簇的数量,对任意形状的簇都能有效处理。SA2DBSCAN 聚类算法,通过分析数据集统计特性来自动确定Eps 和minPts 参数
凝聚层次聚类算法
针对BFSN算法需要人工输入参数r和[λ]的缺陷,提出了一种自适应确定r和[λ]的SA-BFSN聚类方法。该方法通过Inverse Gaussian拟合判断r参数,通过分析噪声点数量的分布特征选择合适的[λ]值。算法测试表明,使用SA-...
针对基于密度的DBSCAN算法对于输入参数敏感、无法聚类多密度数据集等问题,提出了一种贪心的DBSCAN改进算法(greedy DBSCAN)。算法仅需输入一个参数MinPts,采用贪心策略自适应地寻找Eps半径参数进行簇发现,利用...