-
Notifications
You must be signed in to change notification settings - Fork 46
Architecture
eli knaap edited this page Mar 2, 2019
·
12 revisions
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
spopt/
base.py
region/
allocate/
route/
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 thinkSolver
is a more appropriate and descriptive verb. - rather than
fit()
the classes will define asolve()
method
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:
-
W
objects cannot be abstracted away from a dataset entirely because missing values 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 the dataset, but that strategy would not work for, e.g. KNN weights, where dropping observations could violate the defined K - the regionalizers dont really have the concept of "transform" or "assign" new observations based on the existing model
- or do they? like
grow_regions
in maxp?
- or do they? like
Regionalizer
Allocator
Router
RegionalizeMixin
-
LabelerMixin
(applies to both allocation and regionalization)
-
solve
(equivalent to scikit'sfit
) -
assign
(equivalent to scikit'spredict
)