繁体   English   中英

PHPML 库问题

[英]PHPML library issue

我一直在努力让 PHPML 库工作,

我遵循的步骤:

  • 从 github 下载 PHPML 库: https : //github.com/php-ai/php-ml
  • Composer install [ using PHP 7.1 ] {output} 供应商文件夹大小约为 60MB
  • 我写了以下php页面:
 <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>

当我尝试浏览页面时,我面临的问题如下:

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

我感谢帮助

问候,

在使用命名空间之前加载供应商文件,例如,

    <?php
    require './vendor/autoload.php';

    use Phpml\Classification\NaiveBayes;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM