rangga / lda-topic-model
基于潜在狄利克雷分配的主题模型
v1.1.1
2018-08-17 09:19 UTC
This package is not auto-updated.
Last update: 2024-09-22 13:20:27 UTC
README
PHP中的潜在狄利克雷分配主题模型。想知道什么是LDA和主题模型?请访问此处 https://medium.com/@ranggaantok/topic-modelling-mengguna-latent-dirchlect-allocation-3fdf979ffd05
安装
通过Composer安装
composer require rangga/lda-topic-model
使用方法
<?php
require_once __DIR__.'/vendor/autoload.php';
use TopicModel\Lda;
$lda = new Lda;
$documents[] =["id"=>1,"tokens"=>["kucing","ayam"]];
$documents[] =["id"=>2,"tokens"=> ["ayam","semangka","kucing"]];
$documents[] =["id"=>3,"tokens"=> ["ayam","kucing"]];
$documents[] =["id"=>4,"tokens"=> ["semangka","pisang"]];
$documents[] =["id"=>5,"tokens"=> ["pisang","pisang","semangka","pisang"]];
$documents[] =["id"=>6,"tokens"=> ["pisang","semangka"]];
$alpha = 0.1;
$beta = 0.1;
$n_topic = 2;
print_r($lda->modelling($documents,$n_topic,$alpha,$beta));
?>