Skip to content

FoldedDataSet sizes #123

@lucasalencar

Description

@lucasalencar

I was working with CrossValidationKFold when found a problem while making some tests with the structure FoldedDataSet.

My scenario:
I have a dataset with 50 examples. I made a FoldedDataSet with 5 parts, resulting in each part have 10 examples. When I'm iterating on all the folds, everything looks fine, except on the final fold. This is the code that I am running:

final MLDataPair pair = BasicMLDataPair.createPair(data.getInputSize(), data.getIdealSize());

for (int i = 0; i < data.getRecordCount(); i++) {
            data.getRecord(i, pair);
            network.compute(pair.getInputArray(), actual);
            ...
        }

data is a FoldedDataSet.

When calling for the getRecordCount() on the last fold, it returns 0, but the actual answer is 10.

Looking on the code, I found out that when the division is exact, the variable lastFoldSize is zero. And on the method setCurrentFold(), when the fold indicated is the last one, the lastFoldSize is assigned to the currentFoldSize variable, utilized to return the record count.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions