Skip to content

Global Options #930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Global Options #930

wants to merge 2 commits into from

Conversation

s3alfisc
Copy link
Member

@s3alfisc s3alfisc commented Jun 7, 2025

Allows to set global options for estimation. Would close #766.

Example:

%load_ext autoreload
%autoreload 2

import pyfixest as pf 
data = pf.get_data()

pf.set_option(
    data = pf.get_data().dropna(), 
    vcov = {"CRV1": "f1"}, 
    weights = "weights", 
    demeaner_backend = "rust"
)

# if arg not explicity provided, looks for and uses global default
fit1 = pf.feols(fml = "Y ~ X1 + X2 | f2", vcov = "hetero")
fit2 = pf.feols(fml = "Y ~ X1 | f1 + f2")
fit3 = pf.feols(fml = "Y ~ X1 + X2 ")
pf.etable([fit1, fit2, fit3],)

Is this a feature we'd like to have? Are there any risks? @apoorvalal @juanitorduz

@apoorvalal
Copy link
Member

I can see the appeal of something like this for interactive use, but also it introduces a lot of potentially consequential hidden state that makes reproducibility a pain and should generally be discouraged.
What if we did the intermediate thing where we let one set a bunch of preferences in a dict and pass the entire dict to each model fit call and unpack it inside feols with **kwargs ? That's roughly how scikit learners with many hyperparameters work right?

@juanitorduz
Copy link
Contributor

I agree with @apoorvalal ! Having these hidden variables can be very painful to debug. the intermediate suggestion seems reasonable :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Global Options to Set Estimation Parameters
3 participants