doubleml-for-py
doubleml-for-py copied to clipboard
Score mixin classes: `LinearScoreMixin` and `NonLinearScoreMixin`
Description
This PR contains the implementation of non-linear (in the parameter) score functions. In order to integrate non-linear score functions, the implementation for the linear case (used for all currently implemented model classes PLR, PLIV, IRM & IIVM) was moved into a mixin class called LinearScoreMixin
. The model classes DoubleMLPLR
, DoubleMLPLIV
, DoubleMLIRM
and DoubleMLIIVM
inherit from it to obtain the score function related functionality.
At the same time the NonLinearScoreMixin
mixin class allows to implement DML models with non-linear score function. The main difference is that the parameter estimate in the non-linear case is obtained by a numerical root search using the empirical moment condition. To make the estimation of asymptotic variances possible, one needs to implement the derivative of the score function when inheriting from the NonLinearScoreMixin
mixin class. Obviously, the evaluation of the score function itself also needs to be implemented model-specifically.
Comments
Models with linear score function can also be estimated with the functionality for non-linear score functions, i.e., utilizing the NonLinearScoreMixin
mixin class. This is used for unit testing.
A corresponding PR adding some information about non-linear score functions to the user guide can be found here: .
PR Checklist
- [x] The title of the pull request summarizes the changes made.
- [x] The PR contains a detailed description of all changes and additions.
- [x] The code passes all (unit) tests.
- [x] Enhancements or new feature are equipped with unit tests.
- [x] The changes adhere to the PEP8 standards.
This pull request introduces 4 alerts when merging 67ba2287a546735df4d3ab224e1e765ab308e8c7 into b6d130a7cbbf54c93222099f28a8a235922ae0c7 - view on LGTM.com
new alerts:
- 4 for Conflicting attributes in base classes
This pull request introduces 4 alerts when merging 15cdfec214589d36c8f450eb8b5aeece77cd2bf9 into b6d130a7cbbf54c93222099f28a8a235922ae0c7 - view on LGTM.com
new alerts:
- 4 for Conflicting attributes in base classes
This pull request introduces 4 alerts when merging 15cdfec into b6d130a - view on LGTM.com
new alerts:
* 4 for Conflicting attributes in base classes
I think this is a false alarm caused by the combination of the @property
and @abstractmethod
decorator.
This pull request introduces 4 alerts when merging f64692385bbd808c8b4ab07442ae7ba0de3027cd into b6d130a7cbbf54c93222099f28a8a235922ae0c7 - view on LGTM.com
new alerts:
- 4 for Conflicting attributes in base classes
This pull request introduces 5 alerts when merging dd0e53f1545a1ee5749be52724b2ce3d310f2942 into 1b2424852414c0dd0d26107829d7253ce6b9991c - view on LGTM.com
new alerts:
- 4 for Conflicting attributes in base classes
- 1 for Multiple calls to `__init__` during object initialization
This pull request introduces 5 alerts when merging bf42aa87821ea8b47a5d019fb179721ac17342a4 into a30b1da0de89614c598b2b95252f470b172d1ad7 - view on LGTM.com
new alerts:
- 4 for Conflicting attributes in base classes
- 1 for Multiple calls to `__init__` during object initialization
This pull request introduces 5 alerts when merging bd29e6694269443b44f487e323d1a8ae891835b0 into 43b660065f1118c63f2c0acc7fb93812c1e8b1a6 - view on LGTM.com
new alerts:
- 4 for Conflicting attributes in base classes
- 1 for Multiple calls to `__init__` during object initialization
Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. It looks like GitHub code scanning with CodeQL is already set up for this repo, so no further action is needed :rocket:. For more information, please check out our post on the GitHub blog.
Looks great. I like the solving for the root of the linear score and will implement some part of it in the quantile treatment estimation (for a preliminary estimation step).
Thanks for the review :pray:.