PHP - Help with class

Hi i need to use this library from github.
When i try to execute the code.php i get the error what should i do ?
The code.php is on ai folder.


Error

PHP Fatal error: Class ‘MCordingley\Regression\Algorithm\GradientDescent\Batch’ not found


Code

<?php

use MCordingley\Regression\Algorithm\GradientDescent\Batch;
use MCordingley\Regression\Algorithm\GradientDescent\Schedule\Adam;
use MCordingley\Regression\Algorithm\GradientDescent\Gradient\Logistic as LogisticGradient;
use MCordingley\Regression\Algorithm\GradientDescent\StoppingCriteria\GradientNorm;
use MCordingley\Regression\Observations;
use MCordingley\Regression\Predictor\Logistic as LogisticPredictor;

$algorithm = new Batch(new LogisticGradient, new Adam, new GradientNorm);
$coefficients = $algorithm->regress(Observations::fromArray($features, $outcomes));

$predictor = new LogisticPredictor($coefficients);
$predictedOutcomeProbability = $predictor->predict($novelFeatures);

The directory

require/include/autoload the class. looks like you did not use composer.

You’re missing an “src/” out of the path you specify for the use statements, surely?

@droopsnoot i tried your response and i still get this error

PHP Fatal error: Class ‘MCordingley\Regression\src\Algorithm\GradientDescent\Batch’ not found


@chorn i included the autoload require_once __DIR__ . '/vendor/autoload.php'; and i get the error

Fatal error: Class ‘MCordingley\Regression\Algorithm\GradientDescent\Batch’ not found

the autoload has :

<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer' . '/autoload_real.php';

return ComposerAutoloaderInit1a034942ca2289aab6ff65a36d3b2c52::getLoader();

:banghead::interrobang:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.