{"id":14966123,"url":"https://github.com/titsuki/raku-algorithm-lda","last_synced_at":"2026-01-23T10:15:53.216Z","repository":{"id":52209720,"uuid":"159108272","full_name":"titsuki/raku-Algorithm-LDA","owner":"titsuki","description":"A Raku Latent Dirichlet Allocation implementation","archived":false,"fork":false,"pushed_at":"2021-05-05T03:58:50.000Z","size":41,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-15T09:35:25.438Z","etag":null,"topics":["lda","perl6","raku","rakulang"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"artistic-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/titsuki.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-26T04:01:28.000Z","updated_at":"2022-08-05T10:20:08.000Z","dependencies_parsed_at":"2022-08-24T14:50:16.137Z","dependency_job_id":null,"html_url":"https://github.com/titsuki/raku-Algorithm-LDA","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/titsuki%2Fraku-Algorithm-LDA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/titsuki%2Fraku-Algorithm-LDA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/titsuki%2Fraku-Algorithm-LDA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/titsuki%2Fraku-Algorithm-LDA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/titsuki","download_url":"https://codeload.github.com/titsuki/raku-Algorithm-LDA/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248060708,"owners_count":21041214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lda","perl6","raku","rakulang"],"created_at":"2024-09-24T13:35:51.344Z","updated_at":"2026-01-23T10:15:53.166Z","avatar_url":"https://github.com/titsuki.png","language":"C","readme":"[![Build Status](https://travis-ci.org/titsuki/raku-Algorithm-LDA.svg?branch=master)](https://travis-ci.org/titsuki/raku-Algorithm-LDA)\n\nNAME\n====\n\nAlgorithm::LDA - A Raku Latent Dirichlet Allocation implementation.\n\nSYNOPSIS\n========\n\nEXAMPLE 1\n---------\n\n    use Algorithm::LDA;\n    use Algorithm::LDA::Formatter;\n    use Algorithm::LDA::LDAModel;\n\n    my @documents = (\n        \"a b c\",\n        \"d e f\",\n    );\n    my ($documents, $vocabs) = Algorithm::LDA::Formatter.from-plain(@documents);\n    my Algorithm::LDA $lda .= new(:$documents, :$vocabs);\n    my Algorithm::LDA::LDAModel $model = $lda.fit(:num-topics(3), :num-iterations(500));\n\n    $model.topic-word-matrix.say; # show topic-word matrix\n    $model.document-topic-matrix; # show document-topic matrix\n    $model.log-likelihood.say; # show likelihood \n    $model.nbest-words-per-topic.say # show nbest words per topic\n\nEXAMPLE 2\n---------\n\n    use Algorithm::LDA;\n    use Algorithm::LDA::Formatter;\n    use Algorithm::LDA::LDAModel;\n\n    # Note: You can get AP corpus as follows:\n    # $ wget \"https://github.com/Blei-Lab/lda-c/blob/master/example/ap.tgz?raw=true\" -O ap.tgz\n    # $ tar xvzf ap.tgz\n\n    my @vocabs = \"./ap/vocab.txt\".IO.lines;\n    my @documents = \"./ap/ap.dat\".IO.lines;\n    my $documents  = Algorithm::LDA::Formatter.from-libsvm(@documents);\n\n    my Algorithm::LDA $lda .= new(:$documents, :@vocabs);\n    my Algorithm::LDA::LDAModel $model = $lda.fit(:num-topics(20), :num-iterations(500));\n\n    $model.topic-word-matrix.say; # show topic-word matrix\n    $model.document-topic-matrix; # show document-topic matrix\n    $model.log-likelihood.say; # show likelihood \n    $model.nbest-words-per-topic.say # show nbest words per topic\n\nDESCRIPTION\n===========\n\nAlgorithm::LDA is a Raku Latent Dirichlet Allocation implementation.\n\nCONSTRUCTOR\n-----------\n\n### new\n\nDefined as:\n\n    submethod BUILD(:$!documents!, :$!vocabs! is raw) { }\n\nConstructs a new Algorithm::LDA instance.\n\nMETHODS\n-------\n\n### fit\n\nDefined as:\n\n    method fit(Int :$num-iterations = 500, Int :$num-topics!, Num :$alpha = 0.1e0, Num :$beta = 0.1e0, Int :$seed --\u003e Algorithm::LDA::LDAModel)\n\nReturns an Algorithm::LDA::LDAModel instance.\n\n  * `:$num-ierations` is the number of iterations for gibbs sampler\n\n  * `:$num-topics!` is the number of topics\n\n  * `alpha` is the prior for theta distribution (i.e., document-topic distribution)\n\n  * `beta` is the prior for phi distribution (i.e., topic-word distribution)\n\n  * `seed` is the seed for srand\n\nAUTHOR\n======\n\ntitsuki \u003ctitsuki@cpan.org\u003e\n\nCOPYRIGHT AND LICENSE\n=====================\n\nCopyright 2018 titsuki\n\nThis library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.\n\nThe algorithm is from:\n\n  * Blei, David M., Andrew Y. Ng, and Michael I. Jordan. \"Latent dirichlet allocation.\" Journal of machine Learning research 3.Jan (2003): 993-1022.\n\n  * Li, Wei, and Andrew McCallum. \"Pachinko allocation: DAG-structured mixture models of topic correlations.\" Proceedings of the 23rd international conference on Machine learning. ACM, 2006.\n\n  * Wallach, Hanna M., et al. \"Evaluation methods for topic models.\" Proceedings of the 26th annual international conference on machine learning. ACM, 2009.\n\n  * Minka, Thomas. \"Estimating a Dirichlet distribution.\" (2000): 4.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftitsuki%2Fraku-algorithm-lda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftitsuki%2Fraku-algorithm-lda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftitsuki%2Fraku-algorithm-lda/lists"}