Skip to content

syavash/ai-class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ai-class sourcecodes

Unit 5

Here is how to use Aiclass_NaiveBayes class:

require_once "library/Aiclass/NaiveBayes.php";
require_once "library/Aiclass/Exception.php";

$nb = new Aiclass_NaiveBayes();
$nb->addClass("ham", array("BEAUTIFUL SUMMER", "SECRET FRIEND"))
	->addClass("spam", array("A SECRET LINK", "SECRET MONEY"))
	->setSmoothingParameter(1)
	->setPrecision(4);

// This gives you the exact probability for each class
$probabilities = $nb->getProbabilities();
echo $probabilities['spam'];

// This gives you the calculation's details for each class
$outputs = $nb->getOutputs();
echo '<pre>' . $outputs['spam'] . '</pre>';

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published