Algorithm-Kmeanspp
view release on metacpan or search on metacpan
lib/Algorithm/Kmeanspp.pm view on Meta::CPAN
=head2 new
Create a new instance.
=head2 add_document($id, $vector)
Add an input document to the instance of Algorithm::Kmeanspp. $id parameter is the identifier of a document, and $vector parameter is the feature vector of a document. $vector parameter must be a hash reference, each key of $vector parameter is the i...
=head2 do_clustering($num_cluster, $num_iter)
Do clustering input documents. $num_cluster parameter specifies the number of output clusters, and $num_iter parameter specifies the number of clustering iterations.
=head2 clusters
This method is the accessor of clustering result. The output of the method is a array reference, and each item in the array reference includes the list of the identifiers of input documents in each cluster.
# format of output clusters
[
[ document_id1, document_id2, ... ], # cluster-1
[ document_id3, document_id4, ... ], # cluster-2
...
( run in 0.684 second using v1.01-cache-2.11-cpan-96521ef73a4 )