Skip to content
/ bayes Public
forked from fieg/bayes

Implementation of Naive Bayes Classifier algorithm in PHP.

Notifications You must be signed in to change notification settings

ezp127/bayes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Naive Bayes Classifier

Implementation of Naive Bayes Classifier algorithm in PHP.

Based on Machine Learning: Naive Bayes Document Classification Algorithm in Javascript by Burak Kanber.

Build Status

Getting started

use Fieg\Bayes\Classifier;
use Fieg\Bayes\Tokenizer\WhitespaceAndPunctuationTokenizer;

$tokenizer = new WhitespaceAndPunctuationTokenizer();
$classifier = new Classifier($tokenizer);

$classifier->train('en', 'This is english');
$classifier->train('fr', 'Je suis Hollandais');

$result = $classifier->classify('This is a naive bayes classifier');

Which would result in:

array(2) {
  'en' =>
  double(0.9)
  'fr' =>
  double(0.1)
}

About

Implementation of Naive Bayes Classifier algorithm in PHP.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%