Skip to content
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

Adding CTFipsQuery class and demo #138

Merged
merged 9 commits into from
Aug 14, 2024

Conversation

Niklewa
Copy link
Collaborator

@Niklewa Niklewa commented Jul 26, 2024

In this PR, I added CTFipsQuery, a demo that exemplifies its use, and appropriate tests.

One challenge with CTFipsQuery is that it seems rather slow, the process of creating a comparison takes around 30-60 seconds.

Copy link
Contributor

@rfl-urbaniak rfl-urbaniak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please expand on the profiling, along the lines of what's in grouped_predictions.ipynb, along the lines of:

def basic_run():
    ci = CausalInsight(
        outcome_dataset=outcome,
        intervention_dataset=intervention,
        num_samples=num_samples,
        smoke_test=smoke_test,
    )

    ci.get_tau_samples()
    percent_calc = ci.slider_values_to_interventions(intervened_percent=50, year = year)
    assert percent_calc['intervened_transformed'] > -1
    
    for fips in texas:
        ci.get_fips_predictions(intervened_value=percent_calc['intervened_transformed'],
                                 fips=fips, intervention_is_percentile=True)


profiler_basic = cProfile.Profile()

profiler_basic.enable()
basic_run()
profiler_basic.disable()

profiler_basic.print_stats(sort='cumulative')

@Niklewa
Copy link
Collaborator Author

Niklewa commented Aug 8, 2024

Apart from adding a more thorough time performance test for CTFipsQuery, I also included an additional test for DataGrabber to make it easier to detect mismatches in data size between variables at the same level. Additionally, I fixed the problem with data mismatch (which explains the number of changes introduced by this PR) by modifying the VariableCleaner class.

Copy link
Contributor

@rfl-urbaniak rfl-urbaniak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the main reason of slowdown is multiple use of reduce:

4.174 0.035 4.174 0.035 {method 'reduce' of 'numpy.ufunc' objects}

at some point downstream we might investigate further if this is a major issue.

@rfl-urbaniak rfl-urbaniak merged commit de1347f into staging-census-tracts Aug 14, 2024
2 checks passed
@rfl-urbaniak rfl-urbaniak deleted the add-fipsQuery-census-tracts branch November 15, 2024 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants