Skip to content

Architecture

eli knaap edited this page Mar 1, 2019 · 12 revisions

spopt Architecture

Following the proposal for groundrules, we want to try and mimic the class inheritance structures found in scikit. These structures require some modifications to account for the unique properties of regionalization. This doc is a brainstorm of how those conventions will need to be modified, and will serve as a guide for constructing spopt classes


Module Structure

spopt/

base.py

spopt.region/
spopt.allocate/
spopt.route/

Terminology

scikit uses BaseEstimator and ClassMixins to for every structure in the library. We want to follow a similar convention, providing a BaseClass, and appropriate mixins for each class. Rather than Estimator, we think Solver is a more appropriate and descriptive verb.

Modifying scikit conventions

In scikit, the estimator classes hold model parameters, and are indifferent toward data used to fit/solve the model. For regionalizers, this same pattern is complicated to mimic for two reasons: first,

  1. W objects cannot be abstracted away from a design matrix entirely because it is conditioned on values in D (i.e. missing values in D need to be removed from W. In theory this could be done by initializing the regionalizer with the "full" W, and subsetting it according to missing values in D, but that strategy would not work for, e.g. KNN weights, where dropping observations could violate the defined K
  2. the regionalizers dont really have the concept of "transform" or "assign" new observations based on the existing model
Clone this wiki locally