Skip to content

new FilesDataset('data/') returns empty #8

Open
@CodezPoet

Description

@CodezPoet

Hi,

I cannot get a result for $dataset. It keeps returning an empty array. Banging my head against the wall trying different solutions. The data is there in plain text, put there by file_put_contents. The data is in data/001.txt. I have tried different subfolder and filename.

Trying to follow the instructions for FilesDataset, and the BBC Text data classification.
Links:
https://php-ml.readthedocs.io/en/latest/machine-learning/datasets/files-dataset/
https://arkadiuszkondas.com/text-data-classification-with-bbc-news-article-dataset/

PHP code is as follows:

`

use Phpml\CrossValidation\StratifiedRandomSplit;
use Phpml\Dataset\FilesDataset;

$dataset = new FilesDataset('data/');

$split = new StratifiedRandomSplit($dataset, 0.2);
$samples = $split->getTrainSamples();

echo $samples[0]; // Mutant book wins Guardian prize ...
`
Any assistance would be great, I can't find any solution for this, and even looking at files and Classes in the app, just cannot figure out what is going wrong. Not getting any errors from PHP.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions