Algorithm-LDA

 view release on metacpan or  search on metacpan

lib/Algorithm/LDA.pm  view on Meta::CPAN

    
    #Initialize @alpha to default value
    $alpha[$_] = $alpha for(0..$k);

    #Randomly initialize beta distribution
    beta();
    
    #Start Main loop
    for my $iter (1..$maxIterations) 
    {   
        #Calculate and print percentage completed
        my $a = $iter * 100 / $maxIterations;
        print "Iteration: $iter   |   $a% Completed...\n";
        
        #Shuffle Documents
        @{$self->documents} = shuffle(@{$self->documents});
        
        #Loop through each word in each document and sample its topic
        for my $document (@{$self->documents}) 
        {
	    print STDERR "Processing Document $document\n";



( run in 0.397 second using v1.01-cache-2.11-cpan-709fd43a63f )