Algoritma Naive Bayes Dengan PHP

Install

composer require php-ai/php-ml

use Phpml\Classification\NaiveBayes ;

public function naivebayes() {
        
        $samples = [[5, 1, 1], [1, 5, 1], [1, 1, 5]];
        $labels = ['a', 'b', 'c'];
        
        $classifier = new NaiveBayes();
        $classifier->train($samples, $labels);

       echo  $classifier->predict([3, 1, 1]);
            



    }

 1,204 total views

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *