You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
CodezPoet
changed the title
new FilesDataset returns empty
new FilesDataset('data/') returns empty
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.
The text was updated successfully, but these errors were encountered: