簡體   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