The recommended way to install the C45 PHP library is through Composer :
composer require medansoftware/c45-algorithm-php
composer dump-autoload
$c45 = new Algorithm\C45('example.xlsx', 'PLAY');
$initialize = $c45->initialize(); // initialize
$buildTree = $initialize->buildTree();
$tree = $buildTree->getTree();
// nodes and edges can be implemented to VisJS directly
$nodes = $buildTree->getNodes($tree);
$edges = $buildTree->getEdges($tree);
echo "<pre>";
print_r ($tree);
echo "</pre>";
$c45 = new Algorithm\C45();
$c45->loadFile('example.xlsx')->setTargetAttribute('PLAY')->initialize();
echo "<pre>";
print_r ($c45->buildTree()->toString()); // print as string
echo "</pre>";
echo "<pre>";
print_r ($c45->buildTree()->toJson()); // print as JSON
echo "</pre>";
echo "<pre>";
print_r ($c45->buildTree()->toArray()); // print as array
echo "</pre>";
$new_data = array(
'OUTLOOK' => 'Sunny',
'TEMPERATURE' => 'Hot',
'HUMIDITY' => 'High',
'WINDY' => FALSE
);
echo $c45->initialize()->buildTree()->classify($new_data); // print "No"
ETH : 0x251b36840557cCe9A245f07E1b834bCfb7354FDb
DOGE : DFmES6KZLQXimXduXwKmooykMsjhWmT1tU
BITCOIN : 1MEqUeg7fXTkBMFWfJZE9yJREsKZ4SUxQM
BITCOIN CASH : qzrllcyrjwvpnuur5kpeyp03p246fzsgzvhleswr6f
Made with ❤️ + ☕ ~ Agung Dirgantara