Skip to content

Should Methods be Regrouped? #138

@pavelkomarov

Description

@pavelkomarov

The modules currently make some sense, but linear_model especially is kind of a catch-all. I've been pondering how many distinct methods there really are here, and I think the number is 7:

  1. Convolve with filter -> FD
  2. Polynomial-based: Splines, Sliding Polyfit, and SavGol
  3. Spectral with tricks
  4. TVR
  5. Kalman (RTS)
  6. Iterated FD
  7. Lineardiff

Four of these have good homes: Iterated FD, Smoothed FD, Kalman, and TVR.

Splines, Sliding Poly, and SavGol are related. SavGol is actually a special case of Sliding Poly. Splinediff currently lives in smoothed FD, although I updated it to not use FD in #137, and Splines can naturally handle irregularly-spaced data (#80), unlike the convolutional-filter-based methods in the rest of that module, so they seem to really not belong there. The other two currently live in linear_model, but I'd emphasize their polynomial-ness if I were regrouping from scratch.

(Fourier) spectral with tricks is a funny case. It's like you're really not supposed to do this on arbitrary signals, but it's so good for culling high frequency noise that we can contort and abuse the method and actually do okay.

That leaves Lineardiff, which is the longest in code, longest by runtime, most fragile, not particularly accurate, left out of the method-suggestion function's list, and least touched by Pavel's hands. It's its own approach, somewhat distinct from everything else, valuable to keep around and possibly tinker with, but probably the most challenging to work on.

What to do with the singletons can be a question, but honestly I see all the RTS, Iterated FD, and TVR methods as multiple expressions of a singleton too. The public-facing methods of each of those modules call down to their single private backing functions, ultimately, so I favor more groups, even if each only has a single public interface. Then again, maybe that extra layer, splintered too finely, adds friction for users. Should we instead make all methods importable at the top level and emphasize modules only as a conceptual and code-organizational structure?

If we are to mess with this, it will naively break imports and therefore backwards compatibility, so I'd first make each method importable in two ways, with the old places triggering deprecation warnings. Then the new release starts steering users appropriately, and in a couple years I go rectify, pull out the redundancy both for this and for params/options, and clean up all the warnings.

Metadata

Metadata

Assignees

Labels

simplificationunifying, shortening, and cleaning tasks that make the modules and user interface more cohesive

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions