pwollstadt / IDTxl

The Information Dynamics Toolkit xl (IDTxl) is a comprehensive software package for efficient inference of networks and their node dynamics from multivariate time series data using information theory.
http://pwollstadt.github.io/IDTxl/
GNU General Public License v3.0
237 stars 76 forks source link

Restructuring estimators using multiple inheritance #75

Closed daehrlich closed 2 years ago

daehrlich commented 2 years ago

I suggest restructuring the estimator classes by implementing abstract estimator classes for the different quantities that can be estimated (EstimatorMI, EstimatorCMI, EstimatorTE, EstimatorAIS); as well as an EstimatorDiscrete superclass with corresponding children (EstimatorDiscreteMI, ...) in the estimator class. All estimators that estimate the particular quantity should inherit from one of these classes in addition to their inheritance from the implementation-related superclasses.

For example, JIDTDiscreteTE would inherit from JIDTEstimator, which handles starting the JRE, and from EstimatorDiscreteTE, which handles discretisation of continuous data (via its superclass EstimatorDiscrete).

The abstract estimators (EstimatorMI, ...) clearly indicate which estimators are interchangeable from the point of view of the algorithms and allow for assertions to be added which make sure that an estimator of the correct quantity is submitted in an algorithm's settings. Furthermore, they avoid duplicate code, e.g. both JIDTEstimatorDiscrete and the upcoming bayesian estimators for discrete distributions may share the same discretisation methods.