Skip to content

Avoid storing any unnecessary variable after fit #134

Closed
@wdevazelhes

Description

@wdevazelhes

Some algorithms currently store a reference to the data at fit time (having a self.X_ attribute for instance). According to scikit-learn guidelines (https://scikit-learn.org/stable/developers/contributing.html#fitting), we should avoid this:

Note that the model is fitted using X and y, but the object holds no reference to X and y. There are, however, some exceptions to this, as in the case of precomputed kernels where this data must be stored for use by the predict method.

If we really need all the data we could maybe store a copy of X but I don't think it is the case in metric-learn's algorithms

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions