Skip to content

REFACTOR: dict_learning and dict_learning_online should be merged into a single func #9009

@dohmatob

Description

@dohmatob

Description

  • There is code / logic duplication between decomposition.dict_learning.py.dict_learning and dict_learning_online. Formally, the code should be equivalent except, that

    • for the former the codes should be computed all at once (batch_size = n_samples) and this process iterated (alternating BCD, as it's already done), whilst
    • for the latter the each sample point's code is computed as the sample is pooled-in. The dictionary update function should the same in both case (Alg2 of the ref paper.)
  • As a side effect of this code duplication, there prototype of backend _update_dict function is somewhat "dangling". E.g the shape of argument code can be (n_components, n_features) or (n_components, n_features) depending on whether it's called from within dict_learning or dict_learning_online resp.

Proposal

Have a single function dict_learning_online(batch_size=some_default) which reproduces full-batch mode (the current dict_learning function) when batch_size == n_samples.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions