Skip to content

fit_fast default model_type appears to contain a typo ("restrospective" vs "retrospective") #57

@robves99

Description

@robves99

Hi, I think there may be a bug in fit_fast related to the default value of model_type.

In the function signature I see:

def fit_fast(
    features,
    targets,
    model_type="restrospective",
    ...
):

but later in the code the checks are against "retrospective":

if model_type=="retrospective":
    ...
elif model_type=="prospective":
    ...
elif model_type=="prospective-restricted:":
    ...
else:
    ...

Because of this, calling fit_fast(...) without explicitly passing model_type seems to use "restrospective" (with typo), which does not match "retrospective" in the downstream conditionals.

This appears to change the behavior materially. In my case:

SparseSC.fit_fast(
    features=features,
    targets=targets,
    treated_units=treated_units,
)

gives different results from:

SparseSC.fit_fast(
    features=features,
    targets=targets,
    treated_units=treated_units,
    model_type="retrospective",
)

From reading the code, it looks like the default typo causes execution to fall through to the else branch instead of the intended "retrospective" branch.

There may also be another typo here:

elif model_type=="prospective-restricted:":

with a trailing : inside the string.

So I think there are possibly two string-matching issues:

  1. "restrospective" instead of "retrospective" in the default argument
  2. "prospective-restricted:" instead of "prospective-restricted"

Expected behavior:

  • the default model_type should likely be "retrospective"
  • calling fit_fast(...) with no explicit model_type should behave the same as fit_fast(..., model_type="retrospective")

Thanks for taking a look.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions