I have been trying to get PHPML library to work ,
steps that I followed :
<html> <head> <title>Test</title> </head> <body> <h1>Testing</h1> <table width = 100% > <tr> <?php use Phpml\\Classification\\NaiveBayes; require './vendor/autoload.php'; $samples = [[176, 70], [180, 80], [161, 45], [163, 47], [186, 86], [165, 49]]; $labels = ['a', 'b', 'a', 'b', 'a', 'b']; $classifier = new NaiveBayes(); $classifier->train($samples, $labels); print_r($classifier->predict([[172,40]])); ?> </tr> </table> </body> </html>
the issue that I face is the following when I try to browse the page :
Testing
Fatal error: Uncaught Error: Class 'Phpml\Classification\NaiveBayes' not found in /home4/ab12960/reviewsclassification.com/test.php:17 Stack trace: #0 {main} thrown in /home4/ab12960/reviewsclassification.com/test.php on line 17
I approciate the help
Regards,
Load vendor file before using namespaces like,
<?php
require './vendor/autoload.php';
use Phpml\Classification\NaiveBayes;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.