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 custom feature extractor #245

Merged
merged 1 commit into from
Jan 27, 2021
Merged

add custom feature extractor #245

merged 1 commit into from
Jan 27, 2021

Conversation

hspitzer
Copy link
Collaborator

implements a custom feature extractor, that allows the user can define a function to extract features.
This allows easy adoption of e.g. DL feature extractors, but is more general than that, because every function can be used to extract features. A test is implemented.
What do you think?

I'm happy to hold of merging this after the ImageContainer API improvements are done, @michalk8 - whatever you think works best.

@codecov
Copy link

codecov bot commented Jan 27, 2021

Codecov Report

Merging #245 (bccb033) into master (3bbb5f3) will decrease coverage by 0.02%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #245      +/-   ##
==========================================
- Coverage   78.41%   78.39%   -0.03%     
==========================================
  Files          30       30              
  Lines        2775     2786      +11     
  Branches      447      450       +3     
==========================================
+ Hits         2176     2184       +8     
- Misses        458      460       +2     
- Partials      141      142       +1     
Impacted Files Coverage Δ
squidpy/im/features.py 75.00% <0.00%> (-3.27%) ⬇️
squidpy/im/feature_mixin.py 87.35% <88.88%> (+0.01%) ⬆️
squidpy/_constants/_constants.py 100.00% <100.00%> (ø)

@michalk8
Copy link
Collaborator

Thanks @hspitzer !

I will merge this, but in #239, I suggest the following change:

  • feature_fn should be always mandatory - this gets rid of this assertion
  • feature_name should be optional (e.g. feature_fn.__name__ if present, otherwise e.g. custom_feature)

@michalk8 michalk8 merged commit b13fe72 into master Jan 27, 2021
@michalk8 michalk8 deleted the custom_features branch January 27, 2021 15:22
@hspitzer
Copy link
Collaborator Author

Thanks @hspitzer !

I will merge this, but in #239, I suggest the following change:

  • feature_fn should be always mandatory - this gets rid of this assertion
  • feature_name should be optional (e.g. feature_fn.__name__ if present, otherwise e.g. custom_feature)

great! Isn't feature_name already optional? I think it has a default value, no? But good idea to get it from feature_fn directly!

michalk8 pushed a commit that referenced this pull request Feb 14, 2021
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