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

add function that unhardcodes features and filters #46

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

AmandaWasserman
Copy link
Collaborator

Working to unhardcode features and filters. This may need to be workshopped down the line but this does what we need in the meantime basically combining fit_snpcc fit_plasticc and fit_TOM. Allows any filters to be used, may need to workshop the any features functionality.

Copy link

github-actions bot commented Oct 15, 2024

Before [4e130d1] After [ee08560] Ratio Benchmark (Parameter)
173M 175M 1.01 benchmarks.peakmem_learn_loop('KNN')
169M 168M 1 benchmarks.peakmem_learn_loop('RandomForest')
178±3ms 178±6ms 1 benchmarks.time_learn_loop('KNN', 'RandomSampling')
181±3ms 181±4ms 1 benchmarks.time_learn_loop('KNN', 'UncSampling')
2.68±0.02s 2.67±0.02s 1 benchmarks.time_learn_loop('RandomForest', 'RandomSampling')
2.69±0.01s 2.68±0.03s 1 benchmarks.time_learn_loop('RandomForest', 'UncSampling')
143±5ms 142±2ms 0.99 benchmarks.time_feature_creation

Click here to view all benchmarks.

def fit(data_dic: dict, output_features_file: str,
number_of_processors: int = 1,
feature_extractor: str = 'bazin', filters: list = ['SNPCC'],
features: list = None, type: str = 'unspecified', Ia_code: list = [10]):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should type default to None?

List of Ia codes to be used. Default is 10 from ELAsTiCC.

"""
if feature_extractor == 'bazin':
Copy link
Collaborator

Choose a reason for hiding this comment

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

I might combine this if/else with the one on line 373.

header = make_features_header(filters, features)

multi_process = multiprocessing.Pool(number_of_processors)
if feature_extractor != None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will feature_extractor ever be None? Would it make sense to do this check earlier in the function and raise an exception?

Copy link
Collaborator

@drewoldag drewoldag left a comment

Choose a reason for hiding this comment

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

Overall this looks good to me. Just a couple of comments, but nothing blocking.

@AmandaWasserman AmandaWasserman merged commit 16b8cc1 into main Oct 17, 2024
7 checks passed
@AmandaWasserman AmandaWasserman deleted the generalize-features branch October 17, 2024 23:46
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.

2 participants