keras-team / keras-preprocessing

Utilities for working with image data, text data, and sequence data.
Other
1.02k stars 444 forks source link

"classes" not working on flow_from_dataframe? #267

Closed qinst64 closed 4 years ago

qinst64 commented 4 years ago

image The parameter classes of flow_from_dataframe is working as above documentation
as the code dismisses order

        if classes:
            classes = set(classes)  # sort and prepare for membership lookup
            df[y_col] = df[y_col].apply(lambda x: remove_classes(x, classes))
        else:
            classes = set()
            for v in df[y_col]:
                if isinstance(v, (list, tuple)):
                    classes.update(v)
                else:
                    classes.add(v)
        return df.dropna(subset=[y_col]), sorted(classes)

Reproducible example: https://github.com/keras-team/keras/issues/13637

rragundez commented 4 years ago

The classes parameter is for the user to set which classes to use. If given in different order they still define the same classes to use, therefore the result should be the same. Do you think is the documentation which needs to change?