mahout lucene: как кластеризовать документы?
-
12-09-2019 - |
Вопрос
Я читаю, что могу создавать векторы махаутов из индекса люсена, которые можно использовать для применения алгоритмов кластеризации махутов.http://cwiki.apache.org/confluence/display/MAHOUT/Creating+Vectors+from+Text
Я хотел бы применить алгоритм кластеризации K-средних к документам в моем индексе Lucene, но неясно, как я могу применить этот алгоритм (или иерархическую кластеризацию) для извлечения значимых кластеров из этих документов.
На этой странице http://cwiki.apache.org/confluence/display/MAHOUT/k-Meansговорит, что алгоритм принимает два входных каталога:один для точек данных и один для начальных кластеров.Мои данные являются документами?Как я могу «заявить», что это мои документы (или их векторы), просто взять их и выполнить кластеризацию?
заранее извините за мою плохую грамматику
Спасибо
Решение
Если у вас есть векторы, вы можете запустить KMeansDriver.Вот помощь для того же.
Usage:
[--input <input> --clusters <clusters> --output <output> --distance <distance>
--convergence <convergence> --max <max> --numReduce <numReduce> --k <k>
--vectorClass <vectorClass> --overwrite --help]
Options
--input (-i) input The Path for input Vectors. Must be a
SequenceFile of Writable, Vector
--clusters (-c) clusters The input centroids, as Vectors. Must be a
SequenceFile of Writable, Cluster/Canopy.
If k is also specified, then a random set
of vectors will be selected and written out
to this path first
--output (-o) output The Path to put the output in
--distance (-m) distance The Distance Measure to use. Default is
SquaredEuclidean
--convergence (-d) convergence The threshold below which the clusters are
considered to be converged. Default is 0.5
--max (-x) max The maximum number of iterations to
perform. Default is 20
--numReduce (-r) numReduce The number of reduce tasks
--k (-k) k The k in k-Means. If specified, then a
random selection of k Vectors will be
chosen as the Centroid and written to the
clusters output path.
--vectorClass (-v) vectorClass The Vector implementation class name.
Default is SparseVector.class
--overwrite (-w) If set, overwrite the output directory
--help (-h) Print out help
Обновлять:Получите каталог результатов из HDFS в локальную файловую систему.Затем используйте утилиту ClusterDumper, чтобы получить кластер и список документов в этом кластере.
Другие советы
Очень хорошее руководство здесь:интеграция Apache Mahout с Apache Lucene
@ Maiky Вы можете прочитать больше о чтении вывода и использовании утилиты ClusterDump на этой странице -> https://cwiki.apache.org/confluence/display/MAHOUT/Cluster+Dumper