Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
CodezPoet opened this issue Dec 11, 2023 · 0 comments
Open

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

CodezPoet opened this issue Dec 11, 2023 · 0 comments

Comments

@CodezPoet
Copy link

CodezPoet commented Dec 11, 2023

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.

@CodezPoet CodezPoet changed the title new FilesDataset returns empty new FilesDataset('data/') returns empty Dec 11, 2023
@CodezPoet CodezPoet reopened this Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant